Jump to content

bebs

Members
  • Posts

    4
  • Joined

  • Last visited

bebs's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. send me scripts about Display Name instead of Username .. newbie here. pls help. thanks
  2. can you please send me a login form which it displays the login user. thanks
  3. please help i want to display the login user but it cant be display, error! heres my code: login.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="css/style.css" /> <link rel="stylesheet" href="css/reset.css" type="text/css" media="all"> <link rel="stylesheet" type="text/css" href="css/login.css" /> <link rel="stylesheet" type="text/css" href="css/search.css" /> <link type="text/css" href="css/menu.css" rel="stylesheet" /> <link rel="stylesheet" href="css/blueberry.css" /> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/menu.js"></script> <script type="text/javascript" src="js/jquery-1.4.2.min.js" ></script> <script type="text/javascript" src="http://info.template...g/ie6_script.js"></script> <script src="https://ajax.googlea...1/jquery.min.js"></script> <script src="js/jquery.blueberry.js"></script> <title>What's Up HK</title> </head> <body> <div class="container"> <div class="header"> <div class="pink_line"></div> <div id="social_links"> <a href="#"><img src="images/social/fb.png" /></a> <a href="#"><img src="images/social/twitter.png" /></a> <a href="#"><img src="images/social/gplus.png" /></a> <a href="#"><img src="images/social/gmail.png"/></a> <a href="#"><img src="images/social/rss.png" /></a> </div> <div id="search"><!-- search --> <div id="tw-form-outer"> <form action="" method="post" id="tw-form"> <input type="text" id="tw-input-text" name="query" value='search' onFocus="if(this.value=='search'){this.value='';}" onBlur="if(this.value==''){this.value='search';}" /> <input type="submit" id="tw-input-submit" value="" /> </form> </div> </div><!-- end .search --> </div><!-- end .header --> <div id="menu"> <div id="menu"> <ul class="menu"> <li><a href="index.php"><span>Home</span></a></li> <li><a href="drink.php"><span>DRINK</span></a></li> <li><a href="eat.php"><span>EAT</span></a></li> <li><a href="contact.php"><span>Contact</span></a></li> </ul> </div> </div><!-- end .menu --> <div id="white_hr"> <b>Login Account</b> <h4>Buy card and write/read reviews</h4> <dragon><img src="images/dragon.png" width="200" height="100" /></dragon> </div> <div class="content"> <div id="login_form"> <div align="center"> <div style="width:300px; border: solid 1px #333333; margin-top:50px; " align="left"> <div style="background-color:#333333; color:#FFFFFF; padding:3px; font-family:Arial, Helvetica, sans-serif;"> <b>BUY card | READ/WRITE reviews</b></div> <div style="margin:30px"> <form name="form1" method="post" action="checklogin.php"> <label>Username :</label><input type="text" name="username" class="box"/><br /><br /> <label>Password :</label><input type="password" name="password" class="box" /><br/><br /> <div align="center" style="margin-left:75px;"> <input type="reset" name="reset" value="Clear"> <input type="submit" name="submit" value="Login"> </div> <br /> </form> <div id="forgot_password"> <img src="images/lock.png" /> <a href="#">Forgot password?</a> </div> <div style="margin-top:5px;"></div> <div id="signup"> <img src="images/reg.png" /> <a href="registration.php">Sign Up</a> for What's Up HongKong </div> </div> </div> </div> </div> </div><!-- end .content --> <div class="footer"> <a href="#">HOME</a> | <a href="#">DRINK</a> | <a href="#">EAT</a> | <a href="#">CONTACT US</a> </div> <div class="footer_down"> <space>© 2013 What's Up Hong Kong. All Rights Reserved. </space> </div><!-- end .footer --> </div><!-- end .container --> </body> </html> checklogin.php <?php ob_start(); $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="whatsuphk"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("whatsuphk")or die("cannot select DB"); // Define $myusername and $mypassword $username=$_POST['username']; $password = trim($_POST['password']); $password = md5($password); // To protect MySQL injection (more detail about MySQL injection) $username = stripslashes($username); $password = stripslashes($password); $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $sql="SELECT member_id FROM members WHERE username='$username' and password='$password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" $_SESSION['username']="username"; $_SESSION['password']="password"; header("location:index_user.php"); } else { header("location:login_page.php"); } ?> index_user.php <?php ob_start(); require('connectDB.php'); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="css/style.css" /> <link rel="stylesheet" href="css/reset.css" type="text/css" media="all"> <link rel="stylesheet" type="text/css" href="css/login.css" /> <link rel="stylesheet" type="text/css" href="css/search.css" /> <link type="text/css" href="css/menu.css" rel="stylesheet" /> <link rel="stylesheet" href="css/blueberry.css" /> <link type="text/css" href="css/drop.css" rel="stylesheet" /> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/menu.js"></script> <script type="text/javascript" src="js/jquery-1.4.2.min.js" ></script> <script type="text/javascript" src="http://info.template...g/ie6_script.js"></script> <script src="https://ajax.googlea...1/jquery.min.js"></script> <script src="js/jquery.blueberry.js"></script> <title>What's Up HK</title> <script> $(window).load(function() { $('.blueberry').blueberry(); }); </script> </head> <body> <div class="container"> <div class="header"> <div class="pink_line"></div> <div id="social_links"> <a href="#"><img src="images/social/fb.png" /></a> <a href="#"><img src="images/social/twitter.png" /></a> <a href="#"><img src="images/social/gplus.png" /></a> <a href="#"><img src="images/social/gmail.png"/></a> <a href="#"><img src="images/social/rss.png" /></a> </div> <div id="search"><!-- search --> <div id="tw-form-outer"><!-- search --> <form action="" method="post" id="tw-form"> <input type="text" id="tw-input-text" name="query" value='search' onFocus="if(this.value=='search'){this.value='';}" onBlur="if(this.value==''){this.value='search';}" /> <input type="submit" id="tw-input-submit" value="" /> </form> </div></div><!-- end .search --> </div><!-- end .header --> <div id="menu"> <ul id="menu"> <li> <a href="index.php">Home</a> </li> <li> <a href="drink.php">DRINK</a> </li> <li> <a href="eat.php">EAT</a> </li> <li> <a href="contact.php">Contact</a> </li> </ul> </div><!-- end .menu --> <div id="profile"> Welcome, <name> <?php session_start(); if(isset($_SESSION['fname'])) { echo "Welcome ".$_SESSION['fname'].""; } else { } ?></name> <br /> <div id="navMenu" align="right"> <ul> <li><a href="#"><font color="#333">Account ▼</font></a> <ul> <li><a href="#">View Profile</a></li> <li><a href="#">Edit Profile</a></li> <li><a href="#">Change Password</a></li> <li><a href="logout.php">Logout</a></li> </ul> </li> </ul> </div> </div> <div id="white_hr"> <img src="images/contact.jpg" width="960" height="100" /> </div> <div class="content"> <div id="thumbnail_bg"> </div> </div><!-- end .content --> <div class="footer"> <a href="#">HOME</a> | <a href="#">DRINK</a> | <a href="#">EAT</a> | <a href="#">CONTACT US</a> </div> <div class="footer_down"> <space>© 2013 What's Up Hong Kong. All Rights Reserved. </space> </div><!-- end .footer --> </div><!-- end .container --> </body> </html>
  4. please help i want to display the login user but it cant be display, error! heres my code: login.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="css/style.css" /> <link rel="stylesheet" href="css/reset.css" type="text/css" media="all"> <link rel="stylesheet" type="text/css" href="css/login.css" /> <link rel="stylesheet" type="text/css" href="css/search.css" /> <link type="text/css" href="css/menu.css" rel="stylesheet" /> <link rel="stylesheet" href="css/blueberry.css" /> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/menu.js"></script> <script type="text/javascript" src="js/jquery-1.4.2.min.js" ></script> <script type="text/javascript" src="http://info.template-help.com/files/ie6_warning/ie6_script.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <script src="js/jquery.blueberry.js"></script> <title>What's Up HK</title> </head> <body> <div class="container"> <div class="header"> <div class="pink_line"></div> <div id="social_links"> <a href="#"><img src="images/social/fb.png" /></a> <a href="#"><img src="images/social/twitter.png" /></a> <a href="#"><img src="images/social/gplus.png" /></a> <a href="#"><img src="images/social/gmail.png"/></a> <a href="#"><img src="images/social/rss.png" /></a> </div> <div id="search"><!-- search --> <div id="tw-form-outer"> <form action="" method="post" id="tw-form"> <input type="text" id="tw-input-text" name="query" value='search' onFocus="if(this.value=='search'){this.value='';}" onBlur="if(this.value==''){this.value='search';}" /> <input type="submit" id="tw-input-submit" value="" /> </form> </div> </div><!-- end .search --> </div><!-- end .header --> <div id="menu"> <div id="menu"> <ul class="menu"> <li><a href="index.php"><span>Home</span></a></li> <li><a href="drink.php"><span>DRINK</span></a></li> <li><a href="eat.php"><span>EAT</span></a></li> <li><a href="contact.php"><span>Contact</span></a></li> </ul> </div> </div><!-- end .menu --> <div id="white_hr"> <b>Login Account</b> <h4>Buy card and write/read reviews</h4> <dragon><img src="images/dragon.png" width="200" height="100" /></dragon> </div> <div class="content"> <div id="login_form"> <div align="center"> <div style="width:300px; border: solid 1px #333333; margin-top:50px; " align="left"> <div style="background-color:#333333; color:#FFFFFF; padding:3px; font-family:Arial, Helvetica, sans-serif;"> <b>BUY card | READ/WRITE reviews</b></div> <div style="margin:30px"> <form name="form1" method="post" action="checklogin.php"> <label>Username :</label><input type="text" name="username" class="box"/><br /><br /> <label>Password :</label><input type="password" name="password" class="box" /><br/><br /> <div align="center" style="margin-left:75px;"> <input type="reset" name="reset" value="Clear"> <input type="submit" name="submit" value="Login"> </div> <br /> </form> <div id="forgot_password"> <img src="images/lock.png" /> <a href="#">Forgot password?</a> </div> <div style="margin-top:5px;"></div> <div id="signup"> <img src="images/reg.png" /> <a href="registration.php">Sign Up</a> for What's Up HongKong </div> </div> </div> </div> </div> </div><!-- end .content --> <div class="footer"> <a href="#">HOME</a> | <a href="#">DRINK</a> | <a href="#">EAT</a> | <a href="#">CONTACT US</a> </div> <div class="footer_down"> <space>© 2013 What's Up Hong Kong. All Rights Reserved. </space> </div><!-- end .footer --> </div><!-- end .container --> </body> </html> checklogin.php <?php ob_start(); $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="whatsuphk"; // Database name $tbl_name="members"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("whatsuphk")or die("cannot select DB"); // Define $myusername and $mypassword $username=$_POST['username']; $password = trim($_POST['password']); $password = md5($password); // To protect MySQL injection (more detail about MySQL injection) $username = stripslashes($username); $password = stripslashes($password); $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $sql="SELECT member_id FROM members WHERE username='$username' and password='$password'"; $result=mysql_query($sql); // Mysql_num_row is counting table row $count=mysql_num_rows($result); // If result matched $myusername and $mypassword, table row must be 1 row if($count==1){ // Register $myusername, $mypassword and redirect to file "login_success.php" $_SESSION['username']="username"; $_SESSION['password']="password"; header("location:index_user.php"); } else { header("location:login_page.php"); } ?> index_user.php <?php ob_start(); require('connectDB.php'); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="css/style.css" /> <link rel="stylesheet" href="css/reset.css" type="text/css" media="all"> <link rel="stylesheet" type="text/css" href="css/login.css" /> <link rel="stylesheet" type="text/css" href="css/search.css" /> <link type="text/css" href="css/menu.css" rel="stylesheet" /> <link rel="stylesheet" href="css/blueberry.css" /> <link type="text/css" href="css/drop.css" rel="stylesheet" /> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/menu.js"></script> <script type="text/javascript" src="js/jquery-1.4.2.min.js" ></script> <script type="text/javascript" src="http://info.template-help.com/files/ie6_warning/ie6_script.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <script src="js/jquery.blueberry.js"></script> <title>What's Up HK</title> <script> $(window).load(function() { $('.blueberry').blueberry(); }); </script> </head> <body> <div class="container"> <div class="header"> <div class="pink_line"></div> <div id="social_links"> <a href="#"><img src="images/social/fb.png" /></a> <a href="#"><img src="images/social/twitter.png" /></a> <a href="#"><img src="images/social/gplus.png" /></a> <a href="#"><img src="images/social/gmail.png"/></a> <a href="#"><img src="images/social/rss.png" /></a> </div> <div id="search"><!-- search --> <div id="tw-form-outer"><!-- search --> <form action="" method="post" id="tw-form"> <input type="text" id="tw-input-text" name="query" value='search' onFocus="if(this.value=='search'){this.value='';}" onBlur="if(this.value==''){this.value='search';}" /> <input type="submit" id="tw-input-submit" value="" /> </form> </div></div><!-- end .search --> </div><!-- end .header --> <div id="menu"> <ul id="menu"> <li> <a href="index.php">Home</a> </li> <li> <a href="drink.php">DRINK</a> </li> <li> <a href="eat.php">EAT</a> </li> <li> <a href="contact.php">Contact</a> </li> </ul> </div><!-- end .menu --> <div id="profile"> Welcome, <name> <?php session_start(); if(isset($_SESSION['fname'])) { echo "Welcome ".$_SESSION['fname'].""; } else { } ?></name> <br /> <div id="navMenu" align="right"> <ul> <li><a href="#"><font color="#333">Account ▼</font></a> <ul> <li><a href="#">View Profile</a></li> <li><a href="#">Edit Profile</a></li> <li><a href="#">Change Password</a></li> <li><a href="logout.php">Logout</a></li> </ul> </li> </ul> </div> </div> <div id="white_hr"> <img src="images/contact.jpg" width="960" height="100" /> </div> <div class="content"> <div id="thumbnail_bg"> </div> </div><!-- end .content --> <div class="footer"> <a href="#">HOME</a> | <a href="#">DRINK</a> | <a href="#">EAT</a> | <a href="#">CONTACT US</a> </div> <div class="footer_down"> <space>© 2013 What's Up Hong Kong. All Rights Reserved. </space> </div><!-- end .footer --> </div><!-- end .container --> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.