Ok, so im making a basic mysql cms for my website, it has an admin panel for you to edit the content of your site. The problem is, i want to make a login for it so someone doesnt randomly edit the site.
here is the code that sets the cookie.
and this is the content editing page, with the cookie reader.
the problem is, that the content editing page is completely blank, and doesnt display an error code at all.
here is the code that sets the cookie.
PHP:
setcookie("user", "logged_in", time()+3600);
and this is the content editing page, with the cookie reader.
PHP:
<?php
$loggedin = "logged_in";
if($_COOKIE["user"]==$loggedin)
include("connection.php");
$pageid = 1;
$con = @mysql_connect("$dbhost", "$dbuser", "$dbpass");
if (!$con)
{
die('Cant connect to databse retard');
}
mysql_select_db("$dbname", $con);
$result = mysql_query("SELECT id, header_text, content, advertisement FROM content_home WHERE id = 1");
while($row = mysql_fetch_array($result))
{
$id = $row["id"];
$header = $row["header_text"];
$content = $row["content"];
$ad = $row["advertisement"];
}
mysql_close($con);
?>
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="update.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong>Edit Content</strong></td>
</tr>
<tr>
<td width="78">Header Text</td>
<td width="6">:</td>
<td width="294"><textarea type="text" name="header_text" rows="1" cols="100"><?php echo $header ?></textarea></td>
</tr>
<tr>
<td>Main Content</td>
<td>:</td>
<td><textarea type="text" name="content" width="500" rows="20" cols="100"><?php echo $content ?></textarea></td>
</tr>
<tr>
<td>Advertisement</td>
<td>:</td>
<td><textarea type="text" name="advertisement" rows="1" cols="100"><?php echo $ad ?></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" value="Submit"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
<?php
else
echo "not logged in";
?>
the problem is, that the content editing page is completely blank, and doesnt display an error code at all.