" . $_session['uid'] . "
"; if ($_session['uid']) { $admin = $_SESSION['uid']; }else{ header( "Location: robot.user.login.php" ); } /* ===== globals ====== */ $file= "globalpass.txt"; if (file_exists($file)) { include $file; } /* ===== database name ====== */ $dbname="hejni_users"; $dbname="hejni_robot"; $con=mysqli_connect($dbserver,$dbuser,$dbpass,$dbname); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } /* $form_id = $_REQUEST['id']; $form_col = $_REQUEST['col']; $form_value = $_REQUEST['value']; */ /* ======== form input section ======== */ // remove escape variables for security $form_id = mysqli_real_escape_string($con, $_POST['id']); $form_col = mysqli_real_escape_string($con, $_POST['col']); $form_value = mysqli_real_escape_string($con, $_POST['value']); /* ======== form input section ======== */ $sql = "UPDATE `robot` SET `" . $form_col . "` = '" . $form_value . "' WHERE (`robot`.`id` = " . $form_id . ") AND (`robot`.`admin` = " . $admin . ")"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "1 record added"; $_session['message']= "Changed " . $form_col . " to [ " . $form_value . " ]"; $returnpage=$_session['returnpage']; mysqli_close($con); header ( "Location: edit.robot.php" ); if($_session['returnpage']){ header( "Location: $returnpage" ); }else{ // edit.robot.php } /* ======== end of code ======== */ /* ====== ==== database column headers ==== start robot robot id admin user name type access online ip robot user uid username password email favorites users user id username password email ==== database column headers ==== end ==== */ /* ==== UPDATE `hejni_robot`.`robot` SET `location` = 'mars' WHERE `robot`.`id` = 12054978, UPDATE `hejni_robot`.`robot` SET `description` = 'a scientific exploration robot' WHERE `robot`.`id` = 12054978; === creating a new record == INSERT INTO `hejni_robot`.`robot` (`id`, `admin`, `user`, `name`, `description`, `location`, `type`, `access`, `online`, `ip`) VALUES ('987086352', '123456789', '12345678', 'Scoochi', 'undersea explorer', 'Atlantis', 'Sub', '123456789', 'Yes', '107.64.0.13'); === deleting a record == DELETE FROM `hejni_robot`.`user` WHERE `user`.`uid` = 44563447; DELETE FROM `hejni_robot`.`robot` WHERE `user`.`id` = 44563447; $sql="INSERT INTO robot (`id`, `admin`, `user`, `name`, `description`, `location`, `type`, `access`, `online`, `ip`) VALUES ('$id', '$admin', '$user', '$name', '$description', '$location', '$type', '$access', '$online', '$ip')"; UPDATE `hejni_robot`.`robot` SET table_to_update.col1 = table_info.col1 WHERE table_to_update.ID = table_info.ID, table_to_update.col2 = table_info.col2 ====== */ /* string fbsql_username ( resource $link_identifier [, string $username ] ); */ ?>