Jump to content

Login Form


webdogjcn

Recommended Posts

Here is the coding for the login form:
[code]<?php
$name="";
$lock="";
$database="";

$user=$_POST['username'];
$pass=$_POST['password'];

mysql_connect(localhost,$name,$lock);
@mysql_select_db($database) or die( "Unable to select database");
$sql="SELECT user_name FROM user_info WHERE user_name='$user' and password=’$pass’”;
$r = mysql_query($sql);
if(!$r) {
$err=mysql_error();
print $err;
exit();
}
if(mysql_affected_rows()==0){
print "no such login in the system. please try again.";
exit();
}
else{
print "successfully logged into system.";
//HOW WOULD I GET IT TO REDIRECT AND INCLUDE SOME VARIABLE VALUES IN THE URL?
exit;
}
?>[/code]

returns the error:

Parse error: parse error, unexpected T_STRING in /home/www/altgames.awardspace.com/login.php on line 19

when I try to login. Also (as you will see in the comment string above), how would I go about refirecting the URL and include information such as username, for creating a member page? EG [a href=\"http://mypage.com/user.htm?name=blah&pass=true\" target=\"_blank\"]http://mypage.com/user.htm?name=blah&pass=true[/a]
Link to comment
https://forums.phpfreaks.com/topic/9653-login-form/
Share on other sites

You already have a thread going about exactly the same thing - [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=93366\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=93366[/a]

Please DO NOT post the same problem more than once. Continue the thread you started since that'll ensure that the solution ends up in one place where anybody can find it.

And - did you follow any of the advice given in the responses to the earlier thread? Those smart quotes are still there: whether you wrote it in Notepad or not, change them to a normal quote.
Link to comment
https://forums.phpfreaks.com/topic/9653-login-form/#findComment-35703
Share on other sites

you need:

[code]
mysql_connect('localhost',$name,$lock);
[/code]

and for your second question you just need to use 'header' to redirect the browser, providing that nothing has up to that point been output:

[code]
header("Location: http://mypage.com/user.htm?name=$user&pass=true");
exit;
[/code]
Link to comment
https://forums.phpfreaks.com/topic/9653-login-form/#findComment-35704
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.