*/ echo "\n\n"; $DB_NAME = *****; $connect = @mysql_pconnect("*****", "*****", "*****"); // Connects to the database server $select = @mysql_select_db($DB_NAME); // Selects and opens the correct database // If the connection to the database fails, print failure XML if ((!$connect) || (!$select)) { echo ''; } else // If the database connects successfully continue { if (isset($_GET['projectName'])) // Checks to see if all GET variables are set { // Sanitizes input and intializes the GET variables $tableName = mysql_real_escape_string($_GET['projectName']); //$metricName = mysql_real_escape_string($_GET['variableName']); //$metricValue = mysql_real_escape_string($_GET['variableValue']); //date_default_timezone_set("America/New_York"); // Changes date function to EST. //$dateModified = strval(date('Y-m-d H:i:s')); // Converts date to string for DB datetime field. $queryCheckTable = "SHOW tables like \"$tableName\""; $resultCheckTable = mysql_query($queryCheckTable); if (mysql_num_rows($resultCheckTable) <= 0) // if the project does not exist print an XML failure { echo ''; } else // Creates and sets the variable if it does not exist, or overwrites it with the new value if it already exists { mysql_query("INSERT INTO `$tableName`() VALUES ()"); $lastID = mysql_insert_id(); echo ''; echo ''; echo '' . $lastID . ''; echo ''; echo ''; } } else // If the incorrect number of GET parameters are passed in, then it fails and prints an XML failure { echo ''; } // @mysql_close(); // Closes all open DB connections } ?>