I am just telling you, because some person is going to grab that code, and just use it somewhere.. then complain because they got hacked.Yes, I do know how insecure this is... It's intended for beginners.
That means someone whos new?
God, what happened to the nice Caleb? >_>
If it was intended for more advanced coders then I'd have used sessions.
Cookies are simple and are good for a PHP first-time programmer.
EDIT: Just noticed a huge error in edit.php:
Replace the previous edit.php code with this code: (I'd be greatful if a Moderator could replace the current edit.php file with the one below on the first post please!)
PHP Code:<?php
require("config.php"); //Includes the configuration file.
if($_COOKIE[loggedin] == "yes"){ //If they're logged in...
if(!isset($_POST['update'])){ //Check to see if they've posted the form yet.
echo("Please choose the setting to edit here:<br />
<form method=\"post\">
Site Status: <select name=\"status\"><option value=\"on\">On</option><option value=\"off\">Off</option></select>
<br />
Offline Message: <input type=\"text\" name=\"offmsg\" size=\"40\">
<br />
Online Page To Redirect To: <input type=\"text\" name=\"onpage\" size=\"30\">
<br />
<input type=\"submit\" value=\"Update!\" name=\"update\">
</form>");
//^^ Show them the form because they haven't posted it yet.
}else{ //If they have posted the form...
$status = $_POST['status']; //Makes the variable easier to handle.
$offmsg = $_POST['offmsg']; //Makes the variable easier to handle.
$onpage = $_POST['onpage']; //Makes the variable easier to handle.
mysql_query("UPDATE `sitestatus` SET `status` = '" . $status . "', `offmsg` = '" . $offmsg . "', `onpage` = '" . $onpage . "' ;"); //Updates the MySQL database with the information they specified in the form.
echo("The site has been succesfully updated!"); //Tells them that the database has been updated.
setcookie("loggedin","",time() - 3600); //Unsets the logged in cookie.
} //End the if statement (if have(n't) posted the form yet.
}else{ //If they're not logged in...
die("Please login to edit the site status!"); //End the if statement(if they're (not) logged in.
} //End the if statment (if not logged in)
mysql_close(); //Closes any remaining MySQL connections.
?>
![]()






Reply With Quote





