Jump to content

[SOLVED] Forward to a new page


TGWSE_GY

Recommended Posts

Okay so I have a script that is in a nested directory dev/php/includes/content/login_2/auth.php and I am wanting to forward the user to http://www.mysite.com/dev/index.php?section=membershome after auth.php is done executing and login is successful, however I can not use absolute path to direct the user on my host using the URL I have to use a relative path, however now matter how many ../../ I put in front of index.php?section=membershome it does not load the page. The index.php file is only four directories up so I should only have to do ../../../../index.php?section=membershome to work but it just errors out on me and tells me that it cannot find the page.

 

auth.php code:

<?php

/*
  @author George Young
  @copyright 2008
  This script is ment for a high security login system using advance algorythmic verification.
 */

// Call database connection info
include('config.php');
// Setting variable $con to hold the login information for the mysql server
$con = mysql_connect($Host, $Login, $Pass);

// Connects and selects the Table for authentication
mysql_select_db("login_ums", $con);

// Holding form username and password in variables for processing
$varUsr = $_POST['formUsr'];
$varPass = $_POST['formPass'];

// Store encrypted key "password" in variable
$tmp = sha1($varPass);

// Set encrypted password to a variable to hold for the remainder of the script         ------ May not need due to $tmp variable already holding the pass
$varPass = $tmp;

$testAcct = mysql_query("SELECT * FROM `login` WHERE Pass = '$tmp'");
If (mysql_num_rows($testAcct)){
	include('setstatus.php');
	include('activity.php');
	include('../../../../index.php?section=memberhome'); <------This is where it should be forwarding to. Line 31.

} else {
	include('AccessDenied.php');
	mysql_close($con);
}

?>

 

The error that i get is this

 

 

Warning: include(../../../../index.php?section=memberhome) [function.include]: failed to open stream: No such file or directory in /home/.deceasing/thegayestever/thegayestcommunityever.com/dev/php/includes/content/login_2/auth.php on line 31

 

Warning: include() [function.include]: Failed opening '../../../../index.php?section=memberhome' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/.deceasing/thegayestever/thegayestcommunityever.com/dev/php/includes/content/login_2/auth.php on line 31

 

 

Thanks

Link to comment
Share on other sites

Your not forwarding to that link, your including it

 

 

Try this

<?php   
$testAcct = mysql_query("SELECT * FROM `login` WHERE Pass = '$tmp'");
   If (mysql_num_rows($testAcct)){
      include('setstatus.php');
      include('activity.php');

     //Set your base directory
      $config_basdir = "http://www.mysite.com/dev/index.php";

    //Now forward the user to the members section
      header("Location: " . $config_basedir . "?section=memberhome");

      
   } else {
      include('AccessDenied.php');
      mysql_close($con);
   }
?>

 

Link to comment
Share on other sites

Alright that worked in sorts, however it didn't return me to index.php which holds all my navis and what not, it did load the page however no navi header or footer was displayed also it did not turn the url in the browser to http://www.mysite.com/dev/index.php?membershome but it returned http://www.mysite.com/dev/php/includes/content/login_2/auth.php?section=membershome. How do I handle this I am lost since this is my first time using phps header statement.

 

Thanks for all the help guys :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.