Skip to content

Instantly share code, notes, and snippets.

View anthonycvella's full-sized avatar

Anthony Vella anthonycvella

View GitHub Profile
<?php
require "/classes/Database.php";
header("Content-type: text/json");
$dbinfo = array(
"host" => "127.0.0.1",
"user" => "root",
"pass" => "",
"name" => "hiskor"
<?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;
}
// 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
{"sql_error":"SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''username', 'password', 'email') VALUES ('test', 'test', 'test')' at line 1"}
- (IBAction)btnLogout:(id)sender {
TabBarViewController *tabBarViewControllerObj = [[TabBarViewController alloc] init];
[Lockbox setString:@"FALSE" forKey:kLoggedinStatusKeyString];
[tabBarViewControllerObj loginCheck];
}
// HomeTableViewController
- (IBAction)btnLogout:(id)sender {
self.animateBOOL = YES;
[Lockbox setString:@"FALSE" forKey:kLoggedinStatusKeyString];
[(TabBarViewController *)[self tabBarController] loginCheck:animateBOOL];
}
// TabBarViewController