Login-Logout with session PHP Practice for Beginners

Language

This is a simple PHP sourcecode the Enables you to know how to login , logout with using sessions for security this sourcecode may help beginners want to learn Php.. hope this sourcecode my help you a Lot database_name: database include in the zip file.. thank you

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Tags

Comments

Submitted byAnonymous (not verified)on Mon, 06/03/2013 - 05:39

nice
Submitted byAnonymous (not verified)on Fri, 07/05/2013 - 19:24

This site very useful for php begginers include me thanks
Submitted byAnonymous (not verified)on Sun, 07/14/2013 - 14:43

awesome code I am searching from many days. Now I am at right place.
Submitted byAnonymous (not verified)on Mon, 08/05/2013 - 08:37

Hey, thank you very much for this. Simple yet very informative.
Submitted bymayank3359 (not verified)on Thu, 10/10/2013 - 19:57

where is the code?????
Submitted bymememe (not verified)on Mon, 10/14/2013 - 08:44

In reply to by mayank3359 (not verified)

there is a 'Download' button under the post :)
Submitted byAbdulrahman (not verified)on Sat, 10/12/2013 - 04:19

your code works well for me thanks

  1. <?php
  2. include("includes/header.php");
  3. $page_title="changepassword";
  4. include('connection.php');
  5.  
  6. if(isset($_POST['submitted'])){
  7. $rId = $_POST['submitted'];
  8. if(($_POST['newpassword']) == ($_POST['conpassword'])){
  9. $password = $_POST['change'];
  10. $npassword = $_POST['newpassword'];
  11. $cpassword = $_POST['conpassword'];
  12. $select = mysql_query("SELECT Pass FROM riderform WHERE RidersId='$rId'");
  13.  
  14. if(mysql_num_rows($select) == 1){
  15.  
  16. $row = mysql_fetch_array($select);
  17. $old_pass = $row['Pass'];
  18. if($old_pass == $password){
  19.  
  20. $subquery = mysql_query("UPDATE riderform SET Pass='$cpassword' WHERE RidersId='$rId'");
  21. if($subquery){
  22. $update= "your password has been change successfully<br/>from ".$password." to ".$npassword;
  23.  
  24. }
  25. else{
  26. echo "update is not ok ";
  27. }
  28. }
  29. else{
  30. $update= "confirm your old password".mysql_error();
  31. }
  32. }
  33. }
  34. else{
  35. $update = "your password do not match";
  36. }
  37. }
  38.  
  39. ?>
  40.  
  41. <h1 style="font-size:50px; text-align:center; color:green;" id="sub1">A.B.U</h1>
  42. <p style="font-size:20px; text-align:center; color:green;">Change your password here</p>
  43. <h4 align="center">
  44. </h4>
  45. <form action="rchange_password.php" method="POST">
  46. <div align="center">
  47. <h4 style="color:green">
  48. <?php
  49. if(isset($update)){
  50. echo $update;
  51. unset($update);
  52. }
  53. ?>
  54. </h4>
  55. <input type="password" required name="change" size="30" placeholder="Old password" ></br></br>
  56. <input type="password" required name="newpassword" size="25" placeholder="New password" ></br></br>
  57. <input type="password" required name="conpassword" size="25" placeholder="Confirm password" ></br></br>
  58. <p><input id="sub" type="submit" value="Send">&nbsp;<a class="ancor" href="user_activities.php?rId=<?php if(isset($_GET['id'])){ echo ($_GET['id']);} ?>"><input type="button" value="click back" id="sub"></a></p>
  59. <input type="hidden" name="submitted" value = "<?php if(isset($_GET['id'])){ echo base64_decode($_GET['id']);} ?>" />
  60. </div>
  61. </form>
  62. <br>
  63. <br>
  64. <br>
  65. <br>
  66. <br>
  67. <?php
  68. include("includes/footer.php");
  69. ?>
  70. </body>
  71. </html>
Submitted byNipun Ashan (not verified)on Sat, 11/09/2013 - 13:25

I love sourcecodester.com
Submitted byefi (not verified)on Mon, 02/03/2014 - 21:16

Thank you so so much!It helped me a lot...It seems so simple and easy with that way!Congratulations!!
Submitted bynozzy (not verified)on Thu, 08/14/2014 - 03:41

when i try to run this cold on my machine it just refreshes the page. any help please?
Submitted byDulal Chandra Barman (not verified)on Sun, 12/21/2014 - 20:31

This code is very nice and simple , it helps me as new php learner.

Add new comment