Jump to content

Opening a link in PHP


judacoor

Recommended Posts

Hey everyoneI'm having problems trying to load a new php file, I don't really know how.Here's the thing: I have a login and password input form on one page, wich sends the info to itself after being submitted.So what I do is that everytime the page loads, it first checks if there are $_POST variables available, if there aren't it just loads the form normally to input those variables; if the username and pw are present and are correct as well I want to load the next page, where the user is logged in.But I don't know how open/load a new php file.I tryed using < aref .....<\a> or something like that, but I can't seem to make it work.Please help!!

Link to comment
Share on other sites

Hey everyoneI'm having problems trying to load a new php file, I don't really know how.Here's the thing: I have a login and password input form on one page, wich sends the info to itself after being submitted.So what I do is that everytime the page loads, it first checks if there are $_POST variables available, if there aren't it just loads the form normally to input those variables; if the username and pw are present and are correct as well I want to load the next page, where the user is logged in.But I don't know how open/load a new php file.I tryed using < aref .....<\a> or something like that, but I can't seem to make it work.Please help!!
<meta http-equiv="refresh" content="1;url=http://google.co.uk">1 represents the number of seconds before your new page will load. After url= should be the full (not relative) adress of your file.. just to keep it simple!
Link to comment
Share on other sites

<?php include('../Connections/conn2.php');$login= $_POST["user"];$pw = $_POST["pw"];$link=Connection();//A function within conn2.phpif($login!=null&&$pw!=null){ $result = mysql_query("SELECT * FROM `users` WHERE `users`.`login` = '$login'",$link); if($result!=null){ while($row = mysql_fetch_array($result)){ if($row["password"]==$pw){ session_start(); $_SESSION['id_user']=$row["id_user"]; <meta http-equiv="refresh" content="1;url=http://localhost/TestSite/menu.php"> } else{ echo "User NOT found","<br>"; } } else{ echo "Usuario NO encontrado","<br>"; }}?>But I can't get it to open the new link, after the server verifies the user name and password!!!!What can I do???

Link to comment
Share on other sites

<?phpsession_start();include('../Connections/conn2.php');$login= $_POST["user"];$pw = $_POST["pw"];$link=Connection();//A function within conn2.phpif($login!=null&&$pw!=null){$result = mysql_query("SELECT * FROM `users` WHERE `users`.`login` = '$login'",$link); $row = mysql_fetch_assoc($result); if($row["password"]==$pw) { $_SESSION['id_user']=$row["id_user"]; header('location:http://localhost/TestSite/menu.php'); exit(); }}?> hoooo you alot of error try that first then add some missing litle by litle to avoid from breaking down that code

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...