GameYin Posted April 9, 2008 Author Share Posted April 9, 2008 Ok, well give help me figure this out? Great advice, but I don't know how to position. Someone help? I've tried everything I can think of and I still lose. Edit: Ok, I positioned it differently, now it will ONLY display what you see on www.gameyin.com/login.php code now <?php session_start(); include 'config.php'; $n=$_SESSION['n']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Login | DevPlooth.com</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="Find webmasters, web designers, SEO techs, web developers, designers PHP experts, html experts, javascript experts, css experts, SEO advice, marketing tips and resources. Our forum provides a way for people to find web help and support!" /> <meta name="keywords" content="webmaster forum, web design, web developers, developer forum, web forum, php experts, web marketing, seo experts, database experts, support forum, programming, html, css, javascript, mysql, sql, web" /> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body> <div class="body-container"> <div class="body-outer" id="body-outer"> <div class="body-header"> <div class="logo"> <a href="index.php">DevPlooth.com</a><br /> <small>Forums | Arcade | Tutorials | Web Hosting |</small> </div> <div class="tmenu"> <b><a class="add" href="index.php">Home</a></b> <? if (empty($_SESSION['n'])) { ?> <a href="register.php">Register</a> <a href="login.php">Login</a> <? }else{ ?> <a href="logout.php">Logout</a> <a href="usercp/index.php">UserCP</a> <? } ?> <a href="arcade/index.php">Arcade</a> <a href="tutorials/index.php">Tutorials</a> <a href="forums/index.php">Forums</a> <a href="proxy/index.php">Proxy</a> </div> <div class="search"> <form method="get" action="search.php" style="display:inline;"> <div> <input type="text" name="search" class="input-search" value="Enter your Search Query" onblur="if(this.value=='') this.value='Enter your Search Query';" onfocus="if(this.value=='Enter your Search Query') this.value='';" /> <input type="image" src="images/search.gif" /></div> </form> </div> </div> </div> </div> <div class="navbar"> <small>Please browse our tutorials in many languages!</small> <br /> <table id="navbar"><tr><td>»<a href="tutorials/xhtml/index.html">(X)HTML</a></td></tr> <tr><td>»<a href="tutorials/css/index.html">CSS</a></td></tr> <tr><td>»<a href="tutorials/javascript/index.html">JavaScript</a></td></tr> <tr><td>»<a href="tutorials/php/index.html">PHP</a></td></tr> <tr><td>»<a href="tutorials/asp/index.html">ASP</a></td></tr> <tr><td>»<a href="tutorials/aspnet/index.html">ASP.NET</a></td></tr> <tr><td>»<a href="tutorials/coldfusion/index.html">ColdFusion</a></td></tr> <tr><td>»<a href="tutorials/mysql/index.html">MySQL</a></td></tr> <tr><td>»<a href="tutorials/apache/index.html">Apache</a></td></tr> <tr><td>»<a href="tutorials/dhtml/index.html">DHTML</a></td></tr> <tr><td>»<a href="tutorials/ajax/index.html">AJAX</a></td></tr> <tr><td>»<a href="tutorials/xml/index.html">XML</a></td></tr> <tr><td>»<a href="tutorials/xslt/index.html">XSLT</a></td></tr> <tr><td>»<a href="tutorials/actionscript/index.html">ActionScript</a></td></tr> <tr><td>»<a href="tutorials/vbscript/index.html">VBScript</a></td></tr> <tr><td>»<a href="tutorials/vb/index.html">VB</a></td></tr> <tr><td>»<a href="tutorials/python/index.html">Python</a></td></tr> <tr><td>»<a href="tutorials/rubyonrails/index.html">Ruby On Rails</a></td></tr> </table> </div> <?php if(isset($_POST['login'])) { $username = trim(addslashes($_POST['username'])); $password = md5(trim($_POST['password'])); $query = mysql_query("SELECT * FROM Users WHERE Username = '$username' AND Password = '$password' LIMIT 1") or die(mysql_error()); $row = mysql_fetch_array($query); // now we check if they are activated if(mysql_num_rows($query) > 0) { if($row['Activated'] > 0) { $_SESSION['s_logged_n'] = 'true'; $_SESSION['s_username'] = $username; $_SESSION['s_name'] = $row['Name']; header("Location: index.php"); } } } elseif ($row['Activated'] != 1){ echo ' <div class="error"><p>Sorry, either you entered invalid login details, or you must activate your account first. Please check your email for the email. <a href="login.php">Try again.</a></p> <p>Didnt get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p></div> <div id="footer"> <p> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Strict" height="25" width="70" /></a> © 2008-2009 DevPlooth.com. All rights reserved <a href="http://jigsaw.w3.org/css-validator/"> <img style="border:0;width:70px;height:25px" src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS!" /> </a> </p> </div> </body> </html>'; } else { echo ' <div class="error"> <p>You must login to view this page. Enter your username and password below and hit submit:</p> <form method="post" action="login.php"> <p>Username:<br> <input name="username" type="text" Cid="username"> <p>Password:<br> <input name="password" type="password" id="password"> </p> <p> <input name="login" type="submit" id="login" value="Submit"> </p> </form> <p>Didnt get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p> <p>Need an account? <a href="register.php">Click here</a> to register, its completely free! </p></div> <div id="footer"> <p> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Strict" height="25" width="70" /></a> © 2008-2009 DevPlooth.com. All rights reserved <a href="http://jigsaw.w3.org/css-validator/"> <img style="border:0;width:70px;height:25px" src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS!" /> </a> </p> </div> </body> </html>'; } mysql_close($l); ?> Quote Link to comment https://forums.phpfreaks.com/topic/100031-solved-syntax-error-then-moving-to-sessions/page/2/#findComment-513267 Share on other sites More sharing options...
Kieran Menor Posted April 9, 2008 Share Posted April 9, 2008 Would you please try moving the HTML into different files? You can still leave the small PHP bits in there as long as you just include the files (as opposed to file_get_contents, for instance). Quote Link to comment https://forums.phpfreaks.com/topic/100031-solved-syntax-error-then-moving-to-sessions/page/2/#findComment-513280 Share on other sites More sharing options...
GameYin Posted April 9, 2008 Author Share Posted April 9, 2008 The HTML is fine in there, I moved some of it before I started the PHP stuff because I want that stuff to always be displayed. Just try and help with why the error message is always being shown ;o Quote Link to comment https://forums.phpfreaks.com/topic/100031-solved-syntax-error-then-moving-to-sessions/page/2/#findComment-513282 Share on other sites More sharing options...
Kieran Menor Posted April 9, 2008 Share Posted April 9, 2008 How about you try to do what I say so that we can get an overview of the problem? You can't even figure out your own code! Quote Link to comment https://forums.phpfreaks.com/topic/100031-solved-syntax-error-then-moving-to-sessions/page/2/#findComment-513288 Share on other sites More sharing options...
GameYin Posted April 9, 2008 Author Share Posted April 9, 2008 I think, that it may have something to do with this..I kinda played around with putting this in, so I think the elseif statement here is messing it up.. } elseif ($row['Activated'] != 1){ echo ' <div class="error"><p>Sorry, either you entered invalid login details, or you must activate your account first. Please check your email for the email. <a href="login.php">Try again.</a></p> <p>Didnt get your validation email? <a href="resend.php">Click here</a> to resend the validation email.</p></div> <div id="footer"> <p> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10-blue" alt="Valid XHTML 1.0 Strict" height="25" width="70" /></a> © 2008-2009 DevPlooth.com. All rights reserved <a href="http://jigsaw.w3.org/css-validator/"> <img style="border:0;width:70px;height:25px" src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS!" /> </a> </p> </div> </body> </html>'; } Ok, so thinking it through, it will always show that message because as a guest, logically, I am not an activated user, so I am going to mess w/ the statement. What else kind of if statement should I put in there. @ Boom.dk, I do understand my code, I figured out that stuff on my own. Moving the HTML makes it harder for me. Quote Link to comment https://forums.phpfreaks.com/topic/100031-solved-syntax-error-then-moving-to-sessions/page/2/#findComment-513294 Share on other sites More sharing options...
Kieran Menor Posted April 9, 2008 Share Posted April 9, 2008 Well, whatever. I'm glad it worked out for you. Quote Link to comment https://forums.phpfreaks.com/topic/100031-solved-syntax-error-then-moving-to-sessions/page/2/#findComment-513299 Share on other sites More sharing options...
GameYin Posted April 9, 2008 Author Share Posted April 9, 2008 I'm not done yet, I need a new if statement in there ;o. Lol. I don't know what else I should do. Because I don't think I need them activated to view that...I could have a die message for that, once they try to login...So any ideas on a new if statement? Quote Link to comment https://forums.phpfreaks.com/topic/100031-solved-syntax-error-then-moving-to-sessions/page/2/#findComment-513303 Share on other sites More sharing options...
GameYin Posted April 9, 2008 Author Share Posted April 9, 2008 Anyone? Quote Link to comment https://forums.phpfreaks.com/topic/100031-solved-syntax-error-then-moving-to-sessions/page/2/#findComment-513345 Share on other sites More sharing options...
GameYin Posted April 9, 2008 Author Share Posted April 9, 2008 Thought of some. Quote Link to comment https://forums.phpfreaks.com/topic/100031-solved-syntax-error-then-moving-to-sessions/page/2/#findComment-513457 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.