hasek522 Posted July 24, 2008 Share Posted July 24, 2008 When i attempt to go to my login.php i get this error: Parse error: syntax error, unexpected $end in /home/brandoo8/public_html/jasonhedrick/mymoney/login.php on line 115 I just cant seem to figure out what is wrong. What makes things weird to me is the error is in the HTML not the php. Here is the code: <?php require_once("config.php"); $db = mysql_connect($dbhost, $dbuser, $dbpassword); mysql_select_db($dbdatabase, $db); if($_POST['Submit']) { // Prtect Against SQL Injections and make password into correct fromat $username = addslashes(htmlentities($_POST['username'])); $password = addslashes(htmlentities($_POST['password'])); //$password = md5("[HEPA7][".$password."][".$verstring."][PROTECTED]"); $sql = "SELECT * FROM users WHERE username = '" . $username . "' AND password = '" . $password . "';"; $result = mysql_query($sql); $numrows = mysql_num_rows($result); if($numrows == 1) { $row = mysql_fetch_assoc($result); session_register("USERNAME"); session_register("USERID"); $_SESSION['USERNAME'] = $row['username']; $_SESSION['USERID'] = $row['id']; echo('<p></p><p></p><p><center>' . $_SESSION['USERNAME'] . ', you have successfully been logged In!!!</center></p><br />'); } else { //user not found in database header("Location: " . $config_basedir . "login.php?error=invalid"); } } else { // submit button has not been clicked // check if there's an error switch($_GET['error']) { case "invalid": echo "<div id='error'>Invalid login information. Please try again.</div>"; break; } ?> <head> <meta name="author" content="Wink Hosting (www.winkhosting.com)" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="images/style.css" type="text/css" /> <title>Login</title></head> <body> <div id="page" align="center"> <div id="toppage" align="center"> <div id="date"> <div class="smalltext" style="padding:13px;"></div> </div> <div id="topbar"> <div align="right" style="padding:12px;" class="smallwhitetext"> <a href="#">Home</a> | <?php if(IsLoggedIn()) { echo '<a href="#">Logout</a>'; } { echo '<a href="#">Login</a>'; } ?> | <a href="#">Contact Us</a></div> </div> </div> <div id="header" align="center"> <div class="titletext" id="logo"> <div class="logotext" style="margin:30px">My$</div> </div> <div id="pagetitle"> <div id="title" class="titletext" align="right">Welcome to MyMoney!</div> </div> </div> <div id="content" align="center"> <div id="menu" align="right"> <div align="right" style="width:189px; height:8px;"><img src="images/mnu_topshadow.gif" width="189" height="8" alt="mnutopshadow" /></div> <div id="linksmenu" align="center"> <a href="#" title="Home">Home</a> <a href="#" title="About Us">About Us</a> <a href="#" title="Products">Products</a> <a href="#" title="Our Services">Our Services</a> <a href="#" title="Contact Us">Contact Us</a> </div> <div align="right" style="width:189px; height:8px;"><img src="images/mnu_bottomshadow.gif" width="189" height="8" alt="mnubottomshadow" /></div> </div> <div id="contenttext"> <div style="padding:12px;" align="justify"><span class="orangetitle">Hello User Please Login<br /> </span> <form id="login" name="login" method="post" action="login.php"> <label>Username: <input type="text" name="username" id="username" /> </label> <label><br /> Password: <input type="password" name="password" id="password" /> </label> <label><br /> <input type="submit" name="Login" id="Login" value="submit" /> </label> <p> </p> </form> <span class="orangetitle"><br /> </span>Some intro text.</div> </div> </div> <div id="footer" class="smallgraytext" align="center"> <a href="#">Home</a> | <a href="#">About Us</a> | <a href="#">Products</a> | <a href="#">Our Services</a> | <a href="#">Contact Us</a><br /> Your Company Name © 2007<br /> <a href="http://www.winkhosting.com" title="Hosting Colombia">Hosting Colombia</a><br /> </div> </div> </body> Link to comment https://forums.phpfreaks.com/topic/116486-help-with-error/ Share on other sites More sharing options...
ToonMariner Posted July 24, 2008 Share Posted July 24, 2008 this is all down to matching up your { and } also if(IsLoggedIn()) { echo '<a href="#">Logout[/url]'; } { echo '<a href="#">Login[/url]'; } is missing an else... Link to comment https://forums.phpfreaks.com/topic/116486-help-with-error/#findComment-599007 Share on other sites More sharing options...
hasek522 Posted July 24, 2008 Author Share Posted July 24, 2008 ok cool thanks i made those changes, however now im getting this error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/brandoo8/public_html/jasonhedrick/mymoney/login.php on line 14 does that mean that possibly the select statement isnt working? Link to comment https://forums.phpfreaks.com/topic/116486-help-with-error/#findComment-599008 Share on other sites More sharing options...
revraz Posted July 24, 2008 Share Posted July 24, 2008 Add a mysql_error() after your query and it will tell you if its working. Link to comment https://forums.phpfreaks.com/topic/116486-help-with-error/#findComment-599010 Share on other sites More sharing options...
hasek522 Posted July 24, 2008 Author Share Posted July 24, 2008 ok cool thanks i figured it all out. Link to comment https://forums.phpfreaks.com/topic/116486-help-with-error/#findComment-599072 Share on other sites More sharing options...
dezkit Posted July 24, 2008 Share Posted July 24, 2008 ok cool thanks topic solved pls Link to comment https://forums.phpfreaks.com/topic/116486-help-with-error/#findComment-599080 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.