I'm working on tweaking a classifieds program I obtained a year or 2 ago but I'm having some trouble.
If anyone could so kindly bail me out on this, I'd be most appreciative!!
I have this page: http://classifieds.your-adrenaline-fix.com/add.php
and the source code (with PHP) is
include ('header.php');
//header.php has session_start() and MySQL connect data
$current_file = $_SERVER['SCRIPT_NAME'];
if(isset($_POST['Email']) && isset($_POST['Password'])){
$email = $_POST['Email'];
$password = $_POST['Password'];
$MD5pass = md5($password);
if(!empty($email) && !empty($password)){
$query = "SELECT `ID` FROM `members` WHERE `Email`='".mysql_real_escape_string($email)."' AND `Password`='".mysql_real_escape_string($MD5pass)."'";
if($query_run = mysql_query($query)) {
$query_num_rows = mysql_num_rows($query_run);
if($query_num_rows==0) {
echo "<span class='error'>Invalid Login Credentials</span>";
} else if ($query_num_rows==1) {
$memberID = mysql_result($query_run, 0, 'ID');
$_SESSION['memberID'] = $memberID;
}
}
} else {
echo '<span class="error">Both Fields are Required</span>';
}
}
?>
<form id='generalform' class='container' method='POST' action= '<?php echo $current_file; ?>'>
<h3>Log In</h3>
<div class="field">
<label for"Email">Login Email:</label><input type="email" class="input" id="Email" name="Email" autofocus="on">
</div>
<div class="field">
<label for"password">Password:</label>
<input type="password" class="input" id="password" name="Password" maxlength="20">
</div>
<input type="submit" name="submit" id="submit" class="button" value="Login">
<a href="register.php" title="Click Here to Register">Not Yet A Member?</a>
</form>
I believe the 2 click problem began when I added the <?php echo $current_file; ?> so as to return a visitor back to the page they were previously on.
I can't take credit for this idea of returning the visitor to the previous page but I sure like the idea and would love to see this work properly.
if anyone could so kindly show me what's askew, I'd be most appreciative and I thank you all in advance!!