webdogjcn Posted May 14, 2006 Share Posted May 14, 2006 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 19when 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] Quote Link to comment Share on other sites More sharing options...
AndyB Posted May 14, 2006 Share Posted May 14, 2006 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. Quote Link to comment Share on other sites More sharing options...
redbullmarky Posted May 14, 2006 Share Posted May 14, 2006 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] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.