Skip to content

Instantly share code, notes, and snippets.

View anthonycvella's full-sized avatar

Anthony Vella anthonycvella

View GitHub Profile
[
{
"image_id":"mmwVV74",
"hits":"2",
"first_view":"1356242044"
},
{
"image_id":"jSOxa38",
"hits":"5",
"first_view":"1356245094"
[NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
NSURL *url = [NSURL URLWithString:[receiveItem objectForKey:@"image"]];
NSData *imageData = [NSData dataWithContentsOfURL:url];
UIImage *itemImage = [UIImage imageWithData:imageData];
itemImageView = [[UIImageView alloc] initWithImage:itemImage];
<?php
require "/classes/Database.php";
header("Content-type: text/json");
$dbinfo = array(
"host" => "127.0.0.1",
"user" => "root",
"pass" => "",
"name" => "hiskor"
function sendResponse($status, $body = '')
{
$status_header = 'HTTP/1.1 ' . $status;
header($status_header);
header('Content-type: application/json');
echo $body;
}
<?php
require "/classes/Database.php";
header("Content-type: text/json");
$dbinfo = array(
"host" => "127.0.0.1",
"user" => "root",
"pass" => "",
"name" => "hiskor"
// Send HTTP Response Method
function sendResponse($status, $body = '')
{
$status_header = 'HTTP/1.1 ' . $status;
header($status_header);
header('Content-type: application/json');
echo $body;
}
// Calling the HTTP Response Method with parameters
function login()
{
global $HTTP_RAW_POST_DATA, $db;
// remove the second argument or pass false if you want to use an object
//$user_info = json_decode($HTTP_RAW_POST_DATA, false);
// Check for required parameters
if (isset($_POST['username']) && isset($_POST['passwordMD5']))
{
//Put parameters into local variables
function register()
{
global $db;
if (isset($_POST['username']) && isset($_POST['passwordMD5']) && isset($_POST['email']))
{
$username = mysql_real_escape_string($_POST['username']);
$passwordMD5 = mysql_real_escape_string($_POST['passwordMD5']);
$email = mysql_real_escape_string($_POST['email']);
function login()
{
global $db;
// remove the second argument or pass false if you want to use an object
//$user_info = json_decode($HTTP_RAW_POST_DATA, false);
// Check for required parameters
if (isset($_POST['username']) && isset($_POST['password']))
{
//Put parameters into local variables