Skip to content

Instantly share code, notes, and snippets.

Created February 15, 2011 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/828273 to your computer and use it in GitHub Desktop.
Save anonymous/828273 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
//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['$_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