View Single Post
Old 03-15-2006, 12:44 AM   #13 (permalink)
transfield
Code Monkey
 
Join Date: Mar 2006
Posts: 35
transfield is on a distinguished road
Hello Sde,
Thanks for your reply. Here's what I've done so far:-
I've created a file called head.php like you suggested. This file is working properly on it's own. My code is below.

Here's my problem:-
When I include head.php into my login page, it does not work(no error message whatsoever). My code is below.

Head.php
HTML Code:
<?php

// set mysql connection
$username="abc123";
$password="abc123";
$database="abc123";
$host="localhost";
$pass=$_POST['pass'];
$user=$_POST['user'];


$conn = mysql_connect("$host","$username","$password") or die('Could not connect: ' . mysql_error());
mysql_select_db($database) or die('Could not select database');

// declare function
function WriteLog() {
    $query="INSERT INTO logs VALUES date=CURDATE(), time=CURTIME(), username='$user', password='$pass'";
    $results=mysql_query($query);
}

// call function
WriteLog();
?>
Login page
HTML Code:
<?php
session_start();
$username="abc123";
$password="abc123";
$database="abc123";
$host="localhost";
$pass=$_POST['pass'];
$user=$_POST['user'];
$r1 = $_POST['R1'];
$r2 = $_POST['R2'];
mysql_connect ("$host","$username","$password");
mysql_select_db($database) or die( "Where's the database man?");
$query = "SELECT * FROM customers WHERE username = '$user' AND password = '$pass'"; 
$result = mysql_query($query);
if ($r2=='V2')
{
if ($query = mysql_num_rows($result) == 0)
{
header('Location:retrieve_password.php');
}
else
{

if ($r1=='V1')
{
	setcookie(robert, date("G:i - m/d/y"), time()+3600); 
}
$_SESSION['passwordprotect'] = mysql_result($result,0,"id");
header('Location:query_form2.php');
include "head.php";
}
}
else
{
$_SESSION['termswrong'] = 1;
header('Location:login2.php');
}  
?>
transfield is offline   Reply With Quote