strategos Posted July 2, 2011 Share Posted July 2, 2011 I'm new to PHP and source coding in general. I recently set up a login/registration system using the following tutorial: http://tutorialzine.com/2009/10/cool-login-system-php-jquery/. However, when I copy HTML code to the PHP script and load it I get the error found on my site http://www.stgdarkrp.org. I can't seem to find what causes it. I have even installed Jquery 1.6 and added it to the script found below. Can you please help me resolve this issue and have it working like it is in the tutorial? All feedback is appreciated. Thanks! <?php define('INCLUDE_CHECK',true); require 'connect.php'; require 'functions.php'; // Those two files can be included only if INCLUDE_CHECK is defined session_name('tzLogin'); // Starting the session session_set_cookie_params(2*7*24*60*60); // Making the cookie live for 2 weeks session_start(); if($_SESSION['id'] && !isset($_COOKIE['tzRemember']) && !$_SESSION['rememberMe']) { // If you are logged in, but you don't have the tzRemember cookie (browser restart) // and you have not checked the rememberMe checkbox: $_SESSION = array(); session_destroy(); // Destroy the session } if(isset($_GET['logoff'])) { $_SESSION = array(); session_destroy(); header("Location: demo.php"); exit; } if($_POST['submit']=='Login') { // Checking whether the Login form has been submitted $err = array(); // Will hold our errors if(!$_POST['username'] || !$_POST['password']) $err[] = 'All the fields must be filled in!'; if(!count($err)) { $_POST['username'] = mysql_real_escape_string($_POST['username']); $_POST['password'] = mysql_real_escape_string($_POST['password']); $_POST['rememberMe'] = (int)$_POST['rememberMe']; // Escaping all input data $row = mysql_fetch_assoc(mysql_query("SELECT id,usr FROM tz_members WHERE usr='{$_POST['username']}' AND pass='".md5($_POST['password'])."'")); if($row['usr']) { // If everything is OK login $_SESSION['usr']=$row['usr']; $_SESSION['id'] = $row['id']; $_SESSION['rememberMe'] = $_POST['rememberMe']; // Store some data in the session setcookie('tzRemember',$_POST['rememberMe']); } else $err[]='Wrong username and/or password!'; } if($err) $_SESSION['msg']['login-err'] = implode('<br />',$err); // Save the error messages in the session header("Location: demo.php"); exit; } else if($_POST['submit']=='Register') { // If the Register form has been submitted $err = array(); if(strlen($_POST['username'])<4 || strlen($_POST['username'])>32) { $err[]='Your username must be between 3 and 32 characters!'; } if(preg_match('/[^a-z0-9\-\_\.]+/i',$_POST['username'])) { $err[]='Your username contains invalid characters!'; } if(!checkEmail($_POST['email'])) { $err[]='Your email is not valid!'; } if(!count($err)) { // If there are no errors $pass = substr(md5($_SERVER['REMOTE_ADDR'].microtime().rand(1,100000)),0,6); // Generate a random password $_POST['email'] = mysql_real_escape_string($_POST['email']); $_POST['username'] = mysql_real_escape_string($_POST['username']); // Escape the input data mysql_query(" INSERT INTO tz_members(usr,pass,email,regIP,dt) VALUES( '".$_POST['username']."', '".md5($pass)."', '".$_POST['email']."', '".$_SERVER['REMOTE_ADDR']."', NOW() )"); if(mysql_affected_rows($link)==1) { send_mail( '[email protected]', $_POST['email'], 'Registration System Demo - Your New Password', 'Your password is: '.$pass); $_SESSION['msg']['reg-success']='We sent you an email with your new password!'; } else $err[]='This username is already taken!'; } if(count($err)) { $_SESSION['msg']['reg-err'] = implode('<br />',$err); } header("Location: demo.php"); exit; } $script = ''; if($_SESSION['msg']) { // The script below shows the sliding panel on page load $script = ' <script type="text/javascript"> $(function(){ $("div#panel").show(); $("#toggle a").toggle(); }); </script>'; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>A Cool Login System With PHP MySQL & jQuery | Tutorialzine demo</title> <link rel="stylesheet" type="text/css" href="demo.css" media="screen" /> <link rel="stylesheet" type="text/css" href="login_panel/css/slide.css" media="screen" /> <<script type="text/javascript" src="/js/jquery1.6.js"></script> <!-- PNG FIX for IE6 --> <!-- http://24ways.org/2007/supersleight-transparent-png-in-ie6 --> <!--[if lte IE 6]> <script type="text/javascript" src="login_panel/js/pngfix/supersleight-min.js"></script> <![endif]--> <script src="login_panel/js/slide.js" type="text/javascript"></script> <?php echo $script; ?> </head> <body> <!-- Panel --> <div id="toppanel"> <div id="panel"> <div class="content clearfix"> <div class="left"> <h1>The Sliding jQuery Panel</h1> <h2>A register/login solution</h2> <p class="grey">You are free to use this login and registration system in you sites!</p> <h2>A Big Thanks</h2> <p class="grey">This tutorial was built on top of <a href="http://web-kreation.com/index.php/tutorials/nice-clean-sliding-login-panel-built-with-jquery" title="Go to site">Web-Kreation</a>'s amazing sliding panel.</p> </div> <?php if(!$_SESSION['id']): ?> <div class="left"> <!-- Login Form --> <form class="clearfix" action="" method="post"> <h1>Member Login</h1> <?php if($_SESSION['msg']['login-err']) { echo '<div class="err">'.$_SESSION['msg']['login-err'].'</div>'; unset($_SESSION['msg']['login-err']); } ?> <label class="grey" for="username">Username:</label> <input class="field" type="text" name="username" id="username" value="" size="23" /> <label class="grey" for="password">Password:</label> <input class="field" type="password" name="password" id="password" size="23" /> <label><input name="rememberMe" id="rememberMe" type="checkbox" checked="checked" value="1" /> Remember me</label> <div class="clear"></div> <input type="submit" name="submit" value="Login" class="bt_login" /> </form> </div> <div class="left right"> <!-- Register Form --> <form action="" method="post"> <h1>Not a member yet? Sign Up!</h1> <?php if($_SESSION['msg']['reg-err']) { echo '<div class="err">'.$_SESSION['msg']['reg-err'].'</div>'; unset($_SESSION['msg']['reg-err']); } if($_SESSION['msg']['reg-success']) { echo '<div class="success">'.$_SESSION['msg']['reg-success'].'</div>'; unset($_SESSION['msg']['reg-success']); } ?> <label class="grey" for="username">Username:</label> <input class="field" type="text" name="username" id="username" value="" size="23" /> <label class="grey" for="email">Email:</label> <input class="field" type="text" name="email" id="email" size="23" /> <label>A password will be e-mailed to you.</label> <input type="submit" name="submit" value="Register" class="bt_register" /> </form> </div> <?php else: ?> <div class="left"> <h1>Members panel</h1> <p>You can put member-only data here</p> <a href="registered.php">View a special member page</a> <p>- or -</p> <a href="?logoff">Log off</a> </div> <div class="left right"> </div> <?php endif; ?> </div> </div> <!-- /login --> <!-- The tab on top --> <div class="tab"> <ul class="login"> <li class="left"> </li> <li>Hello <?php echo $_SESSION['usr'] ? $_SESSION['usr'] : 'Guest';?>!</li> <li class="sep">|</li> <li id="toggle"> <a id="open" class="open" href="#"><?php echo $_SESSION['id']?'Open Panel':'Log In | Register';?></a> <a id="close" style="display: none;" class="close" href="#">Close Panel</a> </li> <li class="right"> </li> </ul> </div> <!-- / top --> </div> <!--panel --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>STG DarkRP Home</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta name="description" content="Designed and developed by Codify Design Studio - codifydesign.com"/> <link rel="stylesheet" type="text/css" href="stylesheet.css" /> <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- .style1 {font-size: 16px} .style3 {font-size: 18px; } .style4 {font-size: 15px} .style5 {font-size: 15px; color: #0033CC; } .style7 {color: #FFFFFF} .style8 {font-size: 16px; color: #0000FF; } .style9 {color: #666666} .style10 { font-size: 16px; color: #666666; font-weight: bold; font-style: italic; } .style11 {color: #0000FF} --> </style> </head> <body> <div class="bannerArea"> <div class="container"> <div class="bannernav"><a href="#" >Contact Strategos</a> <span class="style7">• <u>Register</u> •</span> </div> <div class="toplogo"><img src="images/bannersketch.png" width="223" height="51" border="0"/></a></div> <div style="clear:both;"></div> </div> </div> <div class="topnavigationArea"> <div class="container"> <div class="topnavigationgroup"> <ul class="MenuBarHorizontal" id="MenuBar1" style="margin-bottom: 0"> <li><a class="MenuBarItemSubmenu" href="#">Praesent vitae ligula</a> <ul> <li><a href="#">Item 1.1</a></li> <li><a href="#">Item 1.2</a></li> </ul> </li> <li><a href="#">Forums</a></li> <li><a class="MenuBarItemSubmenu" href="#">Vestibulum aecenas</a> <ul> <li><a class="MenuBarItemSubmenu" href="#">Item 3.1</a> <ul> <li><a href="#">Item 3.1.1</a></li> <li><a href="#">Item 3.1.2</a></li> </ul> </li> <li><a href="#">Item 3.2</a></li> <li><a href="#">Item 3.3</a></li> </ul> </li> <li style="border-right-style: solid;"><a href="#">Sign In</a></li> </ul> </div> <div style="clear:both;"></div> </div> </div> <div class="contentArea"> <div class="container"> <span style="margin-bottom: 0"><img src="images/gmod_logo_thingy.jpg" alt="Gmod" width="200" height="133" hspace="0" vspace="0" border="0" align="middle" class="imageright"/></span> <div class="contentleft"> <h1 style="margin-bottom: 0">STG DarkRP</h1> <hr /> <h1 class="style3">Updates:</h1> <p class="style1"> If you are reading this, the web site is finally up and running! Please help and contribute to this server by donating or purchasing admin. Since it is guaranteed that I won't be on at all times, please post complaints or recommendations in the <strong>FORUMS</strong>.</p> <p class="style1">Ideas are always appreciated. Please post suggested updates in forums.</p> <h3>Needed:</h3> <p class="style1">Experienced <span class="style11">coder</span> in the following: <span class="style11">Lua, HTML/CSS, Javascript, PHP</span></p> <p class="style8" style="margin-bottom: 0;"> <em><strong> <span class="style9">Note: Don't expect to be paid for your help.</span></strong></em></p> <p align="left" class="style10" style="margin-top: 0;"> However, if you want to help, please contact Strategos.</p> <p class="style4" style="margin-bottom: 0;"> </p> <hr /> <h2 style="margin-top: 0;"><em><strong>Admin list:</strong></em></h2> <p class="style4" style="margin-bottom: 0;">1: Strategos (owner)</p> <p class="style4" style="margin-top: 0; margin-bottom: 0;">2: Deercreekdude (SA)</p> <p class="style4" style="margin-top: 0;">3: </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p style="margin-bottom: 0;"> </p> </div> <div class="contentright"> <h2 align="center" style="margin-bottom: 0">Garrysmod Server IP</h2> <hr /> <p align="center" class="style1" style="margin-top: 0;">xxx.xxx.xxx.xxx:xxxxx</p> <p align="center" style="margin-bottom: 0;"> </p> </div> <div style="clear:both;"></div> </div> <p style="margin-bottom: 0;"> </p> </div> <div class="footerArea"> <div class="container"> <div class="copyright"></div> <span class="copyright">2011, Clayton Ingmire</span></div> </div> <script type="text/javascript"> <!-- var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"}); //--> </script> </body> </html> Link to comment https://forums.phpfreaks.com/topic/240924-graphics-error-with-loginregistration-system-using-jquery/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.