TaylorSandbek Posted April 29, 2008 Share Posted April 29, 2008 I know this should go in the help section but that is currently down.. I have a script which I will post that continually gives me an error sign, even after I fix the things on the lines. Im lost as to what else could be wrong (and yes, I have cleared my cache before retrying it..) Any help and insight is appreciated! The Script - <?php ########## FRIEND CALENDAR HOMEPAGE, LOGIN, SHORT DESCRIPTION ######### /* Shows title and header logo * login.php */ echo <html><title>Friend Calendar</title> "<img src="FriendCalendar.psd"="FClogo">"<br><br> <body>Welcome. Friend Calendar is a free tool, where you may look at other peoples schedules, post your own, and request events to be planned. </body></html>; // Connects to your Database include("passwords.php"); mysql_connect("friendcalendar.godaddy.com", $username, $password) or die(mysql_error()); mysql_select_db($Database) or die(mysql_error()); //Checks if there is a login cookie if(isset($_COOKIE['ID_my_site'])) //if there is, it logs you in and directes you to the members page { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass != $info['password']) { } else { header("Location: membersHome.php"); } } } //if the login form is submitted if (isset($_POST['submit'])) { // if form has been submitted // makes sure they filled it in if(!$_POST['username'] | !$_POST['pass']) { die('You did not fill in a required field.'); } // checks it against the database if (!get_magic_quotes_gpc()) { $_POST['email'] = addslashes($_POST['email']); } $check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error()); //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That user does not exist in our database. <a href=register.php>Click Here to Register</a>'); } while($info = mysql_fetch_array( $check )) { $_POST['pass'] = stripslashes($_POST['pass']); $info['password'] = stripslashes($info['password']); $_POST['pass'] = md5($_POST['pass']); //gives error if the password is wrong if ($_POST['pass'] != $info['password']) { die('Incorrect password, please try again.'); } else { // if login is ok then we add a cookie $_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['username'], $hour); setcookie(Key_my_site, $_POST['pass'], $hour); //then redirect them to the members area header("Location: membersHome.php"); } } } else { // if they are not logged in ?> <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> <table border="0"> <tr><td colspan=2><h1>Login</h1></td></tr> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="40"> </td></tr> <tr><td>Password:</td><td> <input type="password" name="pass" maxlength="50"> </td></tr> <tr><td colspan="2" align="right"> <input type="submit" name="submit" value="Login"> </td></tr> </table> </form> <?php } echo <html> <body> <a href="register.php">"register"</a> </body> </html>; ?> Members Homepage - <?php #### Members Area #### <?php echo <html><title>Friend Calendar</title> <a href="membersHome"><img src="friendcalendarlogo.psd"="FClogo"></a> </html>; // Connects to your Database include(french.php); mysql_connect("friendcalendar.godaddy.com", $username, $password) or die(mysql_error()); mysql_select_db($Database) or die(mysql_error()); //checks cookies to make sure they are logged in if(isset($_COOKIE['ID_my_site'])) { $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { //if the cookie has the wrong password, they are taken to the login page if ($pass != $info['password']) { header("Location: login.php"); } //otherwise they are shown the members area else { echo = "Welcome to Friend Calendar."; ################## ## Show Nav bar ## ################## echo <html> <a href="MyCalendar.php"="MyCalendar"</a> <a href="Events.php"="Events"</a> <a href="Friends.php"="Friends"</a> <a href="Inbox.php"=Inbox"</a><br>; ################################## ### Search for requested event ### ################################## if { $events = "SELECT events FROM user WHERE username = '$username' AND read==o"; $result = mysql_query($events) or die ("there are no events requested at the moment"); } echo $result; else { echo <html>There are no requested events at this time. To request an event with a friend, go <a href="friends.php"=<b>"here"</b></a>.</html>; } ######################################## #### Show user their personal notes #### ######################################## if { $notes = "SELECT notes FROM user WHERE username='$username'"; $result = mysql_query($notes) or die ("You have created no notes. to create one, just fill in the empty text box below, and click the save button"); } echo $result; else { echo <html>You have no created notes at this time. If you wish to create a note, just start typing in the empty text box below, and click the "save" button</html>; } ###################################### ###### Form for entering notes ####### ###################################### echo <p>Do not include any special characters in your notes, this includes the equal sign, plus sign, exclamation point, etc. The Notes application will not work if there are any special chracters.; echo <html> <body> <form method="post" action="notesINSERT.php"> <input type="text" name="note" size="500"> </body></html>; ########################################################################## ############ Shows Calendar For Person ################################### ########################################################################## include "calendar_class.php"; $file = basename($_SERVER['PHP_SELF']); echo calendar($file); echo "<a href=logout.php>Logout</a>"; } } } else /*if *the cookie does not exist, *they are taken to the login screen*/ { header("Location: login.php"); } ?> Many more pages of code returned invalid also, but as it seems as though it is probably an issue of me being incorrect with one spot in my coding, I will leave it at these two examples to try and find the problem and see if it pertains to the others pages of code as well. Again, apologize for not posting this in help, but this is the closest place I could find.. you are sort of testing my code. Anyway, the "test" is greatly appreciated.. - the n00b Link to comment https://forums.phpfreaks.com/topic/103494-test-my-site-code/ Share on other sites More sharing options...
benphp Posted April 29, 2008 Share Posted April 29, 2008 What's the error? Link to comment https://forums.phpfreaks.com/topic/103494-test-my-site-code/#findComment-529941 Share on other sites More sharing options...
TaylorSandbek Posted April 30, 2008 Author Share Posted April 30, 2008 I keep getting "parser error on line ____" and now I have checked all the lines and redone a lot of things and I still get an error on some line everytime I change it Link to comment https://forums.phpfreaks.com/topic/103494-test-my-site-code/#findComment-529958 Share on other sites More sharing options...
benphp Posted April 30, 2008 Share Posted April 30, 2008 Look for a missing semicolon around the line number. Maybe you put in a colon rather than a semicolon. Link to comment https://forums.phpfreaks.com/topic/103494-test-my-site-code/#findComment-530401 Share on other sites More sharing options...
benphp Posted April 30, 2008 Share Posted April 30, 2008 Nevermind. You have lots of work to do. Something like this: echo <html>There are no requested events at this time. To request an event with a friend, go <a href="friends.php"="here"[/url].</html>; doesn't work. You need to enclose the line in quotes AND escape any internal quotes: echo "<html>There are no requested events at this time. To request an event with a friend, go <a href=\"friends.php\"=\"here\"[/url].</html>"; You have dozens of these. Link to comment https://forums.phpfreaks.com/topic/103494-test-my-site-code/#findComment-530404 Share on other sites More sharing options...
Recommended Posts