Skip to content

Instantly share code, notes, and snippets.

@aonic
Forked from anonymous/gist:828273
Created February 15, 2011 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aonic/828284 to your computer and use it in GitHub Desktop.
Save aonic/828284 to your computer and use it in GitHub Desktop.
<?php
//ICE //William Mantly //willaim@aonic.net //5-2-07
//session_start();
if("4"=="4"){
include("mysql.php"); //conects to D
array_map('addslashes', $_GET);
//adds new user
$query = "INSERT INTO sites (name, bname, address, notes, dline, tsgt, tline, adminlt, aline, co, cline, xo, xline, t1pri, t1sec, dell, tandberg, lcd, plasma, digi, extron, router, switch, biamp, apcback, apcbat, boro, type) VALUES ('{$_GET[name]}', '{$_GET[bname]}', '{$_GET[address]}', '{$_GET[notes]}', '{$_GET[dline]}', '{$_GET[tsgt]}', '{$_GET[tline]}', '{$_GET[adminlt]}', '{$_GET[aline]}', '{$_GET[co]}', '{$_GET[cline]}', '{$_GET[xo]}', '{$_GET[xline]}', '{$_GET[t1pri]}', '{$_GET[t1sec]}', '{$_GET[dell]}', '{$_GET[tandberg]}', '{$_GET[lcd]}', '{$_GET[plasma]}', '{$_GET[digi]}', '{$_GET[extron]}', '{$_GET[router]}', '{$_GET[switch]}', '{$_GET[biamp]}', '{$_GET[apcback]}', '{$_GET[apcbat]}', '{$_GET[boro]}', '{$_GET[type]}')";
$res = mysql_query($query) OR die ('Could not add user to DB:' . mysql_error()); //runs mysql API
if($res){ // if mysql API worked
$worked = "Site added:";
$ajax[] = array ('res'=>$worked);
}else{ // if mysql API failes ):
$ajax[] = array ('res'=>"User not added to DB.");
}
}else{
$ajax[] = array ('res'=>"Log in.");
}
$json = array ('res'=>$ajax);
echo stripslashes((json_encode($json)));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment