Jump to content


login script error


2 replies to this topic

#1 _*Creative Insanity_*

  • Guests

Posted 15 December 2007 - 12:52 PM

Ok I have a login script that seems to be out putting the wrong success location for some reason and I have no idea after 4 days.

The login form
<form id="login" name="login" method="POST" action="'.$loginFormAction.'">
	  <span class="tagline">Member Login </span> <br />
	  <input name="name" type="text" id="name" value="Name" onFocus="if(this.value == \'Name\'){ this.value = \'\'; }" />
	  <br />
	  <input name="pass" type="password" id="pass" value="password" onFocus="if(this.value == \'password\'){ this.value = \'\'; }" />
	  <br />
	  <input type="submit" name="button" id="button" value="Login" />
	</form>
The login script ( $loginFormAction )
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['name'])) {
  $loginUsername=$_POST['name'];
  $password= md5($_POST['pass']);
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "members/index.php";
  $MM_redirectLoginFailed = "inc/failed.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_DBcifarewell, $DBcifarewell);
  
  $LoginRS__query=sprintf("SELECT name, pass FROM members WHERE name=%s AND pass=%s",
	GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $DBcifarewell) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
	 $loginStrGroup = "";
	
	//declare two session variables and assign them
	$_SESSION['MM_Username'] = $loginUsername;
	$_SESSION['MM_UserGroup'] = $loginStrGroup;		  

	if (isset($_SESSION['PrevUrl']) && false) {
	  $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];	
	}
//	header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
	header("Location: ". $MM_redirectLoginFailed );
  }
}
As you can see the success location is members/index.php, but the xhtml output for the form action comes out wrong for some reason in the form and I am getting:
<form id="login" name="login" method="POST" action="/pf2/index.php"> 
	  <span class="tagline">Member Login </span> <br />
	  <input name="name" type="text" id="name" value="Name" onFocus="if(this.value == 'Name'){ this.value = ''; }" />
	  <br />
	  <input name="pass" type="password" id="pass" value="password" onFocus="if(this.value == 'password'){ this.value = ''; }" />
	  <br />

	  <input type="submit" name="button" id="button" value="Login" />
	</form>

Can anyone see the reason please?

ta muchly

#2 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 15 December 2007 - 01:09 PM

The reason is that you would a program to write a program. Dreamweaver was made for HTML, and it does a poor enough job at writing that, imagine how poor the pre-made php stuff for it is?

//	header("Location: " . $MM_redirectLoginSuccess );
Short of that line being commented out, i'm sorry, but i don't want to go through the rest of that code. There are plenty of tutorials on this site to learn how to make your own login system, i would recommend finding one of those instead.

p.s. I remember some topic a while back were you supported such programs...?

Edited by rc69, 15 December 2007 - 01:10 PM.


#3 _*Creative Insanity_*

  • Guests

Posted 15 December 2007 - 01:58 PM

Hmm.,. I have used that login heaps in the past with great success which is why I still use it.
I will suss it out soon enough.
ta anyway.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users