Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Checklogin.php looks like this. <<<<<<<
- <?php
- $user=$_POST["user"];
- $pass=$_POST["password"];
- include("dblogin.php");
- $sql="SELECT * FROM login";
- $result=mysql_query($sql);
- while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
- }
- if($user==$row["username"]&&$pass==$row["password"])
- {
- }
- $_SESSION["userid"]=$row["id"];
- header ('Location: products.php');
- if ($_SESSION["userid"]=="")
- {
- header ('Location: login.php');
- }
- ?>
- dblogin.php looks like this. <<<<<<<<
- <?php
- $host="localhost"; // Host name
- $username="root"; // Mysql username
- $password=""; // Mysql password
- $db_name="db01"; // Database name
- mysql_connect("$host", "$username", "$password")or die("cannot connect");
- mysql_select_db("$db_name")or die("cannot select DB");
- session_start();
- ?>
- products.php looks like this. <<<<<<<<
- <?php
- include("dblogin.php");
- ?>
- <?php
- if ($_SESSION["userid"]=="")
- {
- header ('Location: login.php');
- }
- ?>
- The form in login.php looks in checklogin, checklogin looks in dblogin. Then directs to products.php if login is true.
- This doesn't work using xammp, windows. Added user in phpmyadmin. Or maybe I have a mistake in phpmyadmin??? do these scripts look ok???
- Error message at login, none just keep getting directed back to login.php. So maybe these scripts or it is phpmyadmin??? Any help?? Thanks.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement