Jump to content

Works in Firefox but not IE.


Mr P!nk

Recommended Posts

<?php
include('includes/db_inc.php');

if(isset($submit)) // name of submit button
{
    $sql = "SELECT * FROM merc_users WHERE username='$username' AND password='$password'";
    $result = mysql_query($sql);
    $isAuth = false;
    
    
    while ($row = mysql_fetch_array($result)) {
        if($row['username'] == $username)
        
        {
            $isAuth = true;
            @session_start();
            session_register('username');
        }
        
    }
    
}
?>
</head>

<body topmargin="0" leftmargin="0">
<table width="800" height="489" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="19%" rowspan="3" bgcolor="#B7CA33" scope="col"><img src="images/global_nav_bg.gif" width="152" height="600" hspace="0" vspace="0" /></td>
<th width="81%" height="56" nowrap="nowrap" scope="col"><div id="Layer4"><img src="login/images/login_header.gif" width="648" height="316" /></div></th>
</tr>
<tr>
<td height="80"><p> 
</p>
<p> 
</p>
<p> 
</p></td>
</tr>
<tr>
<td height="79"><form action="index.php" method="post" enctype="multipart/form-data">
<p>
<?php

if ($isAuth && isset($submit)) {
    printf("<div id=\"system\" align=\"center\">You have logged in successfully. <a href=\"layout.php\">Go to Layout selection</a></div>");
}

else if (!$isAuth && isset($submit)) {
    printf("<div id=\"system\" align=\"center\">Login unsuccessful. Check your details and <a href=\"index.php\">try again</a></div>");
}

if (!isset($submit)) {
    
    echo("<table width=\"33%\" height=\"101\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"2\">
<tr>
<td height=\"58\" scope=\"col\"><p align=\"center\">Username
<input name=\"username\" type=\"text\" class=\"loginText\" id=\"username\" size=\"15\" maxlength=\"15\" />
<br />
<br />
Password
<input name=\"password\" type=\"password\" class=\"loginText\" id=\"password\" size=\"15\" maxlength=\"15\" />
</p></td>
</tr>
<tr>
<td scope=\"col\"><div align=\"center\" ><input type=\"image\" src=\"login/images/login_btn.gif\" alt=\"Submit\" name=\"submit\" type=\"submit\" id=\"submit\" value=\"login\"></div></td>
</tr>
</table>" 
}
?>

 

does anyone know why this works perfectly in Firefox, But in IE it just reloads the index.php when submit is clicked?

 

thanks

 

P!nk

Link to comment
Share on other sites

It probably shouldn't work in either. This...

 

if(isset($submit)) // name of submit button

 

should be....

 

if(isset($_POST['submit'])) // name of submit button

 

All your other posted variables need to be grabbed via the $_POST[] array as well.

 

Link to comment
Share on other sites

probably the pesky global reg's..

 

<?php
include('includes/db_inc.php');

if(isset($_POST['submit'])) // name of submit button
{
//Need to filter this..........
$username = $_POST['username'];
$password = $_POST['password'];
//SQL injection detected here.. Filter the above

    $sql = "SELECT * FROM merc_users WHERE username='$username' AND password='$password'";
    $result = mysql_query($sql);
    $isAuth = false;
    
    
    while ($row = mysql_fetch_array($result)) {
        if($row['username'] == $username)
        
        {
            $isAuth = true;
            @session_start();
            session_register('username');
        }
        
    }
    
}
?>
</head>

<body topmargin="0" leftmargin="0">
<table width="800" height="489" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="19%" rowspan="3" bgcolor="#B7CA33" scope="col"><img src="images/global_nav_bg.gif" width="152" height="600" hspace="0" vspace="0" /></td>
<th width="81%" height="56" nowrap="nowrap" scope="col"><div id="Layer4"><img src="login/images/login_header.gif" width="648" height="316" /></div></th>
</tr>
<tr>
<td height="80"><p> 
</p>
<p> 
</p>
<p> 
</p></td>
</tr>
<tr>
<td height="79"><form action="index.php" method="post" enctype="multipart/form-data">
<p>
<?php

if ($isAuth && isset($_POST['submit'])) {
    printf("<div id=\"system\" align=\"center\">You have logged in successfully. <a href=\"layout.php\">Go to Layout selection</a></div>");
}

else if (!$isAuth && isset($_POST['submit'])) {
    printf("<div id=\"system\" align=\"center\">Login unsuccessful. Check your details and <a href=\"index.php\">try again</a></div>");
}


if (!isset($_POST['submit'])) {
    
    echo("<table width=\"33%\" height=\"101\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"2\">
<tr>
<td height=\"58\" scope=\"col\"><p align=\"center\">Username
<input name=\"username\" type=\"text\" class=\"loginText\" size=\"15\" maxlength=\"15\" />
<br />
<br />
Password
<input name=\"password\" type=\"password\" class=\"loginText\" size=\"15\" maxlength=\"15\" />
</p></td>
</tr>
<tr>
<td scope=\"col\"><div align=\"center\" ><input type=\"image\" src=\"login/images/login_btn.gif\" alt=\"Submit\" name=\"submit\" type=\"submit\" value=\"login\"></div></td>
</tr>
</table>" 
}
?>

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.