puddin 0 Junior Poster in Training

DO YOU KNOW WHY THIS IS NOT WORKING ALL THE TIME ONLY SOMETIMES!

okay on my Login Page I Have At The Very Top

<?php
session_start();
?>

FOLLOWED BY THE LOGIN FORM THAT GOES TO welcome.php PAGE

<table class="form">
<form name="login_form" method="POST" action="welcome.php">
<tr>
<td>
<p class="b">Email Address<br>
<input name="email_address" type="text" "$email_address" value="">
</p>



<p class="c">Password<br>
<input name="password" type="password" "$password" value="">
</p>


<p class="d">
<input type="HIDDEN" name="$session_name"  value="$session_id">
</p>


<p class="e"><input type="submit" name="Submit" value="Activate Here!">
</p>
</form>
</td>
</tr>
</table>

AS SHOWN THIS GOES TO THE welcome.php PAGE - NOW ON THE welcome.php PAGE AT THE VERY TOP I AGAIN HAVE :

<?php
session_start();
?>

FOLLOWED BY THIS CODE SECURITY AND THE USER IS GREETED BY NAME: Thanks To DGStudios! Helping me with that code.

<?
include 'db.php';


// get the variables from home page
$password = $_REQUEST;
$email_address = $_REQUEST;



$sql_check = mysql_query("SELECT username FROM myd WHERE password='$password' AND
email_address='$email_address'");
$username = mysql_fetch_array($sql_check, MYSQL_ASSOC); //MYSQL_ASSOC;
$sql_check_num = mysql_num_rows($sql_check);
if($sql_check_num == 0){


echo ("You Must Login Or Signup!");
} else {
echo 'Welcome '.$username;
}


// Define post fields into simple variables
$email_address = $_REQUEST;
$password = $_REQUEST;


/* Let's strip some slashes in case the user entered
any escaped characters. */


$email_address = stripslashes($email_address);
$password = stripslashes($password);


/* Do some error checking on the form posted fields */


if((!$email_address) || (!$password)){
echo '<STRONG><br><br>Enter required fields as indicated below
<br>If you are a member!</STRONG><a href="login_form.php"><u> Login Here</u></a>
<br><STRONG>To become a member!</STRONG><a href="join_form.php"><u> Join Here</u>
</a><BR><br />';
if(!$email_address){
echo "<font color='#000000'>Email address is a required field.</font><br />";
}
if(!$password){
echo "<font color='#000000'>Password is a required field.</font><br />";
}
exit(); // if the error checking has failed, we'll exit the script!
}


?>

THE USER IS IN AND IS GREETED BY NAME... WHAT I THOUGHT I COULD DO WAS REPLACE $_REQUEST
WITH $_SESSION SO MY USER COULD GO TO VARIOUS LINKS AVAILABLE FROM THE welcome.php PAGE
AND STAY IN THEIR SESSION... SHOULDN"T THAT WORK!

ON THE LINK PAGES I ADDED THE SAME CODE THAT IS ON THE welcome.php PAGE AND Of COURSE I HAVE THE session_start(): AT THE TOP OF EVERY LINKED PAGE -

BUT IT'S NOT CONSISTANTLY WORKING... LIKE IT WORKS SOMETIMES IT'S CRAZY - THAN OTHER TIMES IT SAYS ON EVERYPAGE TO LOGIN... OR SIGNUP!

IS THIS ERROR FROM MY SERVER? OR IS MY CODE WRONG?

I HAVE REGISTER GLOBALS OFF I AM NOT USING COOKIES AND I DO NOT WANT TO USE THE GET METHOD

Thank-You Kindly I'm going in circles...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.