0

Ok here is my code for the authenticate page.

When l log in it comes on blank.

<?php

if(isset($_POST['log']))
{
$username = $_POST['username'];
$pass     = $_POST['passd'];

include("connectOrder.php");
$sql = "SELECT * FROM users WHERE user_name='$username' AND password = '$pass' AND access_level != 0";
mysql_query($sql);
$num=mysql_num_rows($sql);
if($num == 1)
{
    session_start();

$_SESSION["user_id"]=$row_sqllog["user_id"];
$_SESSION["username"]=$row_sqllog["user_name"];
   header ("Location: order.php");
 }
 [else]
 {
  header ("Location: login.php?login=wrong");
 }

 }
?>

Edited by Ezzaral: Fixed code tags.

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by network18
1

your syntax for the else is wrong, it should not have been square brackets there.
your code below -

if(isset($_POST['log']))
{
	$username = $_POST['username'];
	$pass = $_POST['passd'];
	
	include("connectOrder.php");
	$sql = "SELECT * FROM users WHERE user_name='$username' AND password = '$pass' AND access_level != 0";
	mysql_query($sql);
	$num=mysql_num_rows($sql);
	if($num == 1)
	{
		session_start();
		
		$_SESSION["user_id"]=$row_sqllog["user_id"];
		$_SESSION["username"]=$row_sqllog["user_name"];
		header ("Location: order.php");
	}
	else
	{
		header ("Location: login.php?login=wrong");
	}

}

Also make sure the filepath you including is all right and also the same in header.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.