Page 2 of 3

Posted: Tue Feb 28, 2006 9:38 am
by feyd
Are you sure the redirection code is being run? I often recommend not looking for a submit button to be apart of the submission data, this is because some browsers don't send the submit button if it wasn't actually used.

Posted: Tue Feb 28, 2006 10:22 am
by chrys
nickman013 wrote:You need to specify the full URL for $url.

For example

videos.php would be somthing like http://www.mysite.com/videos.php.

Not necessarily true

Posted: Tue Feb 28, 2006 10:43 am
by feyd
If you want to conform to the HTTP standards, it's absolutely true.

Posted: Tue Feb 28, 2006 11:10 am
by chrys
It will work if you don't, is what I mean

Posted: Tue Feb 28, 2006 11:16 am
by feyd
Some browsers and agents out there will only conform to the standards. If you want the site to be accessible to all, conform to the standards. It's not like it's hard to write a full url for the redirection.. :roll:

Posted: Tue Feb 28, 2006 11:42 am
by chrys
feyd wrote:Some browsers and agents out there will only conform to the standards. If you want the site to be accessible to all, conform to the standards. It's not like it's hard to write a full url for the redirection.. :roll:
lol, true, for me it's just {$http_dir}/page.php, gotta love smart ;o

Posted: Tue Feb 28, 2006 10:22 pm
by Dark_AngeL
So there is no hope in solving it?

Posted: Tue Feb 28, 2006 10:39 pm
by Roja
Dark_AngeL wrote:So there is no hope in solving it?
Show the latest version of your code so we can clear this up. Each time you've mentioned an error, we've discussed the fix for it.

Show the code, and post the error, and we'll help you understand it. :)

Posted: Tue Feb 28, 2006 10:51 pm
by nickman013
Put this at the very top of your page, in between PHP tags.

Code: Select all

error_reporting('E_ALL');

latest code

Posted: Tue Feb 28, 2006 10:59 pm
by Dark_AngeL
feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Code: Select all

<?php 
error_reporting('E_ALL');  

if(isset($_POST['submit']) && $_POST['submit'] == 'Submit') //if form has been submitted
{
   $url = "http://localhost/Warehouse_Services_Operations_System/main.php";
   $denied = "";
   $name = $_POST['name'];
   $pass = $_POST['pass'];
   if ($name == "Heba" &&  $pass == "123")
   {
       header('Location: '.$url.''); /* Redirect browser */
       exit;                
   }
   else {
       $denied = "Sorry. You are not authorized to access this page<br>Go <a href='index.php' onclick='history.go(-1);return false'> Back </a>";
   }
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>SYS</title>
.
.
.
.
...
.
.
.
.
.
.
<body>
<?php
if(!empty($denied))
{
echo $denied;
}
?>
.
.


...



.
.
.
.
.
.
.
</body>
</html>
This is the check_login.php Code!


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Re: latest code

Posted: Tue Feb 28, 2006 11:01 pm
by Roja
Dark_AngeL wrote:This is the check_login.php Code!
What you've posted doesn't have a form to submit (so we cant test), and doesn't have an error.

Posted: Tue Feb 28, 2006 11:04 pm
by Dark_AngeL
This is the index.php the page which has the form in

Code: Select all

<form name="login" method="post" action="check_login.php"?>
	  <div align="center">
        <div align="center">
    <table width="232" border="2" cellspacing="3" bordercolor="#000000" bgcolor="#FFFFFF">
        <tr>
          <td width="64"><div align="center" class="style19 style21">
            <div align="left"><span class="style22">Username:</span></div>
          </div></td>
          <td width="120" colspan="2"><div align="center" class="style24">
            <div align="left">
              <input type="text" name="name" size="20">
            </div>
          </div></td>
          </tr>
        <tr>
          <td><div align="center" class="style24">
            <div align="left"><span class="style22">Password:</span></div>
          </div></td>
          <td colspan="2"><div align="center" class="style24">
            <div align="left">
              <input type="password" name="pass" size="20">
</div>
          </div></td>
          </tr>
    </table>
    <table width="200" border="0" cellspacing="6">
            <tr>
              <td><div align="center">
                <input name="btnletmein" type="submit" value="Let me in!" id="send" onclick="return checkForm()">
              </div></td>
              </tr>
          </table>
    </div>
        </div>
      </form>

Posted: Tue Feb 28, 2006 11:13 pm
by Roja
Your if statement is never triggered:

Code: Select all

if(isset($_POST['submit']) && $_POST['submit'] == 'Submit') //if form has been submitted
Remove that, and everything seems to work fine in my test.

Posted: Tue Feb 28, 2006 11:19 pm
by nickman013
Yeah, There is no need for that. Unless there is more code?

Posted: Tue Feb 28, 2006 11:36 pm
by Dark_AngeL
Yes :D

when a wrong info is intered this message occurs Sorry. You are not authorized to access this page But when correct info is entered it takes me to a page with HTTP 500 - Internal server error
Internet Explorer