function error_logger($name = "Error", $message = "") { $sName = sqlSafe($name); $sMsg = sqlSafe($message); $sDate = sqlSafe(date("Y-m-d H:i:s")); $query = "INSERT INTO error_log (`timestamp`,`error_name`,`error_description`) VALUES ({$sDate},{$sName},{$sMsg});"; writeQuery($query); }
function saveStats($stats, $id, $type) { $date = sqlSafe(date("Y-m-d H:i:s")); $followers = sqlSafe($stats['followers']); $id = sqlSafe($id); $type = sqlSafe($type); $query = "INSERT INTO account_stats (`user_id`, `act_type`, `record_date`, `followers`)\n VALUES ({$id}, {$type}, {$date}, {$followers})"; print $query; $result = writeQuery($query); }
function createAccount($email, $name) { $query = "INSERT INTO accounts (`email`, `fullname`) VALUES (" . sqlSafe($email) . ", " . sqlSafe($name) . ")"; if (writeQuery($query)) { authorize($email); return true; } else { var_dump(getSQLerrors()); return false; } }
function createProject() { $account = getAccount(); $projdue = tryRetrieve($_POST, 'projDue'); $projtime = strtotime($projdue); $duedate = sqlsafe(date("Y-m-d H:i:s", $projtime)); $title = sqlSafe(tryRetrieve($_POST, 'projName')); //$notes = sqlSafe(tryRetrieve($_POST, 'projNotes')); $query = "INSERT INTO projects (account_id, duedate, title) VALUES ({$account}, {$duedate}, {$title})"; if (writeQuery($query)) { $id = getInsertID(); //Now give the project a hash $hash = sqlSafe(hash('adler32', $id)); $query = "UPDATE projects SET hash={$hash} where id='{$id}'"; if (writeQuery($query)) { $_SESSION['project'] = $id; return getProjectInfo(); } } return null; }
function SDticket($project) { $results = genSD($project); if (isset($results)) { $query = "UPDATE projects SET `SDurl` = " . sqlSafe($results['url']) . " WHERE id = " . sqlSafe($project); writeQuery($query); print json_encode(array("url" => $results['url'])); } }
case 2: $sql = writeQuery("ImprovementsBuildings", $startDate, $endDate, $municipalityCityID, $rpuClass); $db->query("select description from ImprovementsBuildingsActualUses where code = '{$actualUse}'"); if ($db->next_record()) { $rpuClassDesc = $db->f("description"); } break; case 3: $sql = writeQuery("Machineries", $startDate, $endDate, $municipalityCityID, $rpuClass); $db->query("select description from MachineriesActualUses where code = '{$actualUse}'"); if ($db->next_record()) { $rpuClassDesc = $db->f("description"); } break; case 4: $sql = writeQuery("PlantsTrees", $startDate, $endDate, $municipalityCityID, $rpuClass); $db->query("select description from PlantsTreesActualUses where code = '{$actualUse}'"); if ($db->next_record()) { $rpuClassDesc = $db->f("description"); } break; default: break; } /*$sql = "select Receipt.receiptNumber as orNo". ", Receipt.receiptDate as datePaid". ", Collection.collectionID". ", Receipt.receiptID". ", Payment.paymentID". ", Due.dueID". ", TD.tdID".
function attachObject($record) { $project = $_SESSION['project']; $object = $record['irn']; $query = "INSERT INTO `emuProjects`.`objectProject` (`project_id`, `object_irn`, object_holder) VALUES (" . sqlSafe($project) . "," . sqlSafe($object) . "," . sqlSafe($record['is_holder']) . ")"; writeQuery($query); }
function deleteProject($project) { // To make this more secure check the account in the session field to ensure the account has access to the project $query = "DELETE FROM projects WHERE id=" . sqlSafe($project); writeQuery($query); }