This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//use this function to clean values going into mysql | |
function mysql_prep($value) | |
{ | |
$magic_quotes_active = get_magic_quotes_gpc();//boolean - true if the quotes thing is turned on | |
$new_enough_php = function_exists("mysql_real_escape_string");//boolean - true if the function exists (php 4.3 or higher) | |
if($new_enough_php) | |
{ | |
if($magic_quotes_active) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function reduce_image_size($userfile_name, $userfile_type) | |
{ | |
//get the file and figure out what type of file it is and some of its attributes | |
switch ($userfile_type) | |
{ | |
case "image/pjpeg": $tempbig = imagecreatefromjpeg(IMG_PATH.$userfile_name); break; | |
case "image/jpeg": $tempbig = imagecreatefromjpeg(IMG_PATH.$userfile_name); break; | |
case "image/jpg": $tempbig = imagecreatefromjpeg(IMG_PATH.$userfile_name); break; | |
case "image/gif": $tempbig = imagecreatefromgif(IMG_PATH.$userfile_name); break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function create_square_thumbnails($userfile_name, $userfile_type) | |
{ | |
//get the file and figure out what type of file it is and some of its attributes | |
switch ($userfile_type) | |
{ | |
case "image/pjpeg": $tempbig = imagecreatefromjpeg(IMG_PATH.$userfile_name); break; | |
case "image/jpeg": $tempbig = imagecreatefromjpeg(IMG_PATH.$userfile_name); break; | |
case "image/jpg": $tempbig = imagecreatefromjpeg(IMG_PATH.$userfile_name); break; | |
case "image/gif": $tempbig = imagecreatefromgif(IMG_PATH.$userfile_name); break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function pagination () | |
{ | |
$per_page = 16; | |
$pages_query = mysql_query ("SELECT 'file_id' FROM 'imagefiles' LIMIT $star, $per_page"); | |
$pages = ceil(mysql_result($pages_query, 0) / $per_page); | |
$page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1; | |
$start = ($page - 1) * $page; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function authenticate_user($login, $password, $key) | |
{ | |
$val = set_codes(); | |
$query = "select * from users where login='$login' and password = encode('$password', '$key')"; | |
$result = mysql_query ($query); | |
$row = mysql_fetch_row($result); | |
if (mysql_num_rows($result) > 0) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IndexedDB | |
var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.OIndexedDB || window.msIndexedDB, | |
IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.OIDBTransaction || window.msIDBTransaction, | |
dbVersion = 1; | |
// Create/open database | |
var request = indexedDB.open("elephantFiles", dbVersion); | |
request.onsuccess = function (event) { | |
console.log("Success creating/accessing IndexedDB database"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html ng-app> | |
<head> | |
<script src="http://code.angularjs.org/angular-1.0.0rc10.min.js"></script> | |
</head> | |
<body> | |
<div> | |
<label>Name:</label> | |
<input type="text" ng-model="yourName" placeholder="Enter a name here"> | |
<hr> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div ng-controller="AlbumCtrl"> | |
<ul> | |
<li ng-repeat="image in images"> | |
<img ng-src="{{image.thumbnail}}" alt="{{image.description}}"> | |
</li> | |
</ul> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type="text" ng-model="todoText" size="30" placeholder="add new todo here"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function TodoCtrl($scope) { | |
$scope.todos = [ | |
{text:'learn angular', done:true}, | |
{text:'build an angular app', done:false}]; | |
// Add | |
$scope.addTodo = function() { | |
$scope.todos.push({text:$scope.todoText, done:false}); | |
$scope.todoText = ''; | |
}; |
OlderNewer