|
Posted by Darko on 11/09/07 23:11
On Nov 9, 11:37 pm, Big Moxy <bigm...@gmail.com> wrote:
> I've successfully tested sending the variable "msg" back to login.php.
> However further down I am sending the variable "id" to menu.php but it
> is not being sent. It does not appear in the URL in the format
> http://{domain}/menu.php?id={value}. It is also not retrievable via
> $_GET['id']; I don't see any differences yet one works the other
> doesn't. Please help!
>
> Thank you!
> Tim
>
> <?php
> session_start();
> require_once("Connections/usersDB.php");
>
> // username and password sent from signup form
> $userID=$_POST['userID'];
> $password=$_POST['password'];
> $userType=$_POST['clientType'];
>
> // encrypt password
> $encrypted_password=md5($password);
> $_SESSION["password"] = $encrypted_password;
>
> // if password encryption is not used
> //$sql="SELECT * FROM $table_name WHERE userName='$userID' and
> password='$password'";
> //$result=mysql_query($sql);
>
> // if password encryption is used
> if ($userType == ""){
> $sql="SELECT * FROM $table_name WHERE userName = '$userID' and
> userPassword = '$encrypted_password'";
> $result=mysql_query($sql);
> if (!$result) {
> header("location:login.php?msg=1");
> }
> else {
> $rows = mysql_num_rows($result);
> if($rows < 1) {
> // Return to login page with error message
> header("location:login.php?msg=2");
> }
> }}
>
> else {
> $sql = "INSERT INTO $table_name
> (`userName`,`userPassword`,`userType`,`userStatus`) VALUES
> ('$userID','$encrypted_password','$userType','1')";
> $result=mysql_query($sql);
> if (!$result) {
> header("location:login.php?msg=3");
> }
>
> }
>
> // Register $userID, $password, $userType
> $_SESSION['userID'] = $userID;
> $_SESSION['password'] = $encrypted_password;
> $_SESSION['userType'] = $userType;
>
> // Determine next page based on user type
> if ($userType == "admin") {
> header("location:menu.php?id=1");}
>
> elseif ($userType = "dynamixSI") {
> header("location:menu.php?id=2");}
>
> elseif ($userType == "VAR") {
> header("location:menu.php?id=3");}
>
> elseif ($userType == "salesAgent") {
> header("location:menu.php?id=4");}
>
> else {
> header("location:phone.php");
>
> }
>
> ?>
I don't know if it helps, but you have to use absolute URL's in the
location header. Also, I admit
I haven't seen yet an example of specifying the query string in the
location header. Are you
sure it's included by the protocol?
Navigation:
[Reply to this message]
|