Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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