Jump to content

CripDawg

New Members
  • Posts

    4
  • Joined

  • Last visited

CripDawg's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i am watching a youtube tutorial for a register and login page the register and login parts work fine but once the user is logged in the logout button will not work it won't delete the session but if i delete the session using the inspect element of my browser and refresh the page the user will be logged out but the button will not work. here is the youtube part I'm up to. would like to continue with these parts once this problem is fixed I've tried a few debugging methods that you will see in my code witch there is a lot of but i think its all worth showing because the functions go across different files. index.php <?php require_once 'core/init.php'; if(Session::exists('home')) { '<p>' . Session::flash('home') . '</p>'; } $user = new User(); if($user->isLoggedIn()) { ?> <p>Hello <a href="#"><?php echo escape($user->data()->username); ?> </a></p> <ul> <li><a href="logout.php">Log out</a></li> </ul> <?php } else { echo '<p>You need to <a href="login.php">Log In</a> or <a href="register.php">Register</a></p>'; }
  2. im not really interested in finding a different tutorial this is only needs to be simple demonstration it wont actually be put into use
  3. i dont see any typo on that line? EDIT: i found it but now when i log in with my account it shows another blank page when it should say 'you have been looged in as my usename
  4. i need help with this login form im not sure whats wrong with it i just het a blank page when i try to load the form.... im using this youtube tutorial <?php error_reporting (E_ALL ^ E_NOTICE); session_start (); ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Login</title> </head> <body> <?php $form = "<form action='./login.php' method='post'> <table> <tr> <td>Username:</td> <td><input type='text' name='user' /></td> </tr> <tr> <td>Password:</td> <td><input type='password' name='password' /></td> </tr> <tr> <td></td> <td><input type='submit' name='loginbtn' value='Login' /></td> </tr> <table> </form"; if ($_POST['loginbtn']){ $user = $_POST['user']; $password = $_POST ['password']; if ($user){ if ($password){ require("connect.php"); $password = md5(md5("yjtfjtfjj".$password."xjtfjtfjj")); $query = mysql_query("SELECT * FROM users WHERE username='$user'"); $numrows = msql_num_rows($query); if ($numrows == 1){ $row = mysql_fetch_assoc($query); $dbid = $row['id']; $dbuser = $row['username']; $dbpass = $row['password']; $dbactive = $row['active']; if ($password == $dbpass){ if dbactive == 1){ $_SESSION['userid'] = $dbid; $_SESSION['username'] = $dbuser; echo "you have been logged in as <b>$dbuser</b> <a href './members.php'> Click here</a> to go to the Members page"; } else echo "you must activate your account to login $form"; } else echo "incorrect password $form"; } else echo "Incorrect username. $form"; mysql_close(); } else echo "You must enter your password. $form"; } else echo "You must enter your username. $form"; } else echo $form; ?> </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.