Jump to content

Login system


MerlinJR

Recommended Posts

I'm working on my login system but my code doesn't work. it is always skip the "true" part, so basically dosen't matter if the user and pass I entered is right or wrong it's always said it's wrong. Please help....

 

<?php

 

session_start();

extract($_POST);

 

 

$host = 'localhost';

$user_name = '';

$password = '';

$data_base = '';

 

$connect = @mysqli_connect ($host, $user_name, $password, $data_base)or die('Error connecting to mysql');

 

$username=$_POST['user'];

$password=$_POST['pass'];

 

$query="SELECT * FROM user WHERE username='$username' and pass='$password'";

$result=mysqli_query($query);

 

$count=mysqli_num_rows($result);

 

if($count==1){

  $_SESSION['login'] = true;

header('location: location: ../main.php');

exit;

}

 

$_SESSION['error'] = 'Wrong name or password.  Try again.';

header('location: login.php');

?>

Link to comment
https://forums.phpfreaks.com/topic/183835-login-system/
Share on other sites

if u just open ur phpinfo file then it would b something like that shown in the jpg file. if the mysqli

mysqli.allow_local_infile is off then u cannot use this one..

if u want to know difference between both u can check it out here..

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/183835-login-system/#findComment-970411
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.