Jump to content

updates.txt error


Sniffy

Recommended Posts

I'm having another error with the update frontpage admin feature in my site and such, it doesn't seem to be to complex so please take a look at it to see what I did wrong.adminCheck.php

<?phperror_reporting(E_ALL);?><html><head><title>Bobville</title><link rel='stylesheet' type='text/css' href='style.css'></head><body><img src='logo.gif' width='100%' height='40'><br><table cellspacing='0' width='100%'><tr><td width='200'><div class='menu'><a href='index.php'>Home</a><br><a href='games/index.php'>Games</a><br><a href='movies/index.php'>Movies</a><br><a href='tutorials/index.php'>Tutorials</a><br><a href='links.php'>Links</a></td><td width='600'><div id='content'><font face="Comic Sans MS"><i><div id='titlebar'><font size="2">Updates</font>:</i></font></div><div id='main'><?php$adminID = $_POST['adminID'];$adminPass = $_POST['adminPass'];$entryTitle = htmlentities($_POST['entryTitle']);$content = htmlentities(nl2br($_POST['content']));$fName = "updates.txt";$fHandle = fopen($fname, 'a+');if($adminID = "####" && $adminPass == "####"){fwrite($fHandle, "<div id='content'><div id='titlebar'>".$entryTitle."</div><div id='main'>".$content."</div></div>";}else{echo "Your Admin ID or Password was incorrect.";}?></div></div></td><td width='200'></td></tr></table></body></html>

The Error

Parse error: syntax error, unexpected ';' in /home/www/sniffy.awardspace.com/adminCheck.php on line 34

Nevermind, fixed all of the errors. Just to make some use of this thread, I'll have to note, htmlentities(nl2br()) and nl2br(htmlentities()) do different things.htmlentities(nl2br($somevar)) - take all of the new lines and other html tags and converts them to normal characters/&gt and &lt.nl2br(htmlentities($somevar)) - converts newlines to <br> and replaces all other html tags with &gt and &lt.

Link to comment
Share on other sites

Okay, I'll just post the correct code for adminCheck.php

<?phperror_reporting(E_ALL);?><html><head><title>Bobville</title><link rel='stylesheet' type='text/css' href='style.css'></head><body><img src='logo.gif' width='100%' height='40'><br><table cellspacing='0' width='100%'><tr><td width='200'><div class='menu'><a href='index.php'>Home</a><br><a href='games/index.php'>Games</a><br><a href='movies/index.php'>Movies</a><br><a href='tutorials/index.php'>Tutorials</a><br><a href='links.php'>Links</a></td><td width='600'><div id='content'><font face="Comic Sans MS"><i><div id='titlebar'><font size="2">Updates</font>:</i></font></div><div id='main'><?php$adminID = $_POST['adminID'];$adminPass = $_POST['adminPass'];$entryTitle = htmlentities($_POST['entryTitle']);$content = nl2br(htmlentities($_POST['content']));$fName = "/home/www/sniffy.awardspace.com/updates.txt";$fHandle = fopen($fName, 'r+');if($adminID == "####" && $adminPass == "####"){fwrite($fHandle, "<div id='content'><div id='titlebar'>".$entryTitle."</div><div id='main'>".$content."</div></div>");}else{echo "Your Admin ID or Password was incorrect.";}fclose($fHandle);?></div></div></td><td width='200'></td></tr></table></body></html>

Here's adminLogin.php

<?phperror_reporting(E_ALL);?><html><head><title>Bobville</title><link rel='stylesheet' type='text/css' href='style.css'></head><body><img src='logo.gif' width='100%' height='40'><br><table cellspacing='0' width='100%'><tr><td width='200'><div class='menu'><a href='index.php'>Home</a><br><a href='games/index.php'>Games</a><br><a href='movies/index.php'>Movies</a><br><a href='tutorials/index.php'>Tutorials</a><br><a href='links.php'>Links</a></td><td width='600'><div id='content'><font face="Comic Sans MS"><i><div id='titlebar'><font size="2">Updates</font>:</i></font></div><div id='main'><div align='center'><form method='post' action='adminCheck.php'>Admin ID:<input type='text' width='200' name='adminID'><br />Admin Pass:<input type='password' width='200' name='adminPass'><br /><br />Entry Title:<input type='text' name='entryTitle' width='200'><br />Content:<br><textarea cols='65' rows='15' name='content'></textarea><br><input type='submit' value='Submit Entry'></form></div></div></div></td><td width='200'></td></tr></table></body></html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...