Jump to content

Script randomly quit working... Web based editor.. cookie problem and login form


amsgwp

Recommended Posts

Ok so I've been using this really old script called phpWebEd as a simple CMS so people without html knowledge could edit the site.  Well to make it better I integrated the SPAW web editor and everything has been working great.  Well I switched to PHP5 and the login form quit working.  So I installed PHP4.4.7 and it is working and htaccess is telling my php file to use 4.4.7.  Well something else must have started happening and the php upgrade didn't make difference.  Normally the script sets a cookie, then redirects to the homepage.  This is not happening anymore.

 

the script can be seen at http://www.nickgarmon.com/admin/admin.php

 

username: admin

password: austin

 

the login php code is as follows:

 

<?
include "config.inc.php";
include "$phpWebEd_language.inc.php";

if ($submit == "Login") {
if ($name == $phpWebEd_username && $pass == $phpWebEd_userpass) {
	setcookie("auth", md5($name.$pass), 0, "/");
	if ($ed_type == "ax") setcookie("edtype", "ax", time() + 2592000, "/");
	else setcookie("edtype", "", time() - 100000 , "/");
	if (eregi("Apache", $HTTP_SERVER_VARS["SERVER_SOFTWARE"])) header("Location: index.php?check_cookie=1");
	else echo "<meta http-equiv=\"refresh\" content=\"0;URL=index.php?check_cookie=1\">";
	error_log (date("Y-m-d H:i") . "\t$name\t" . gethostbyaddr($REMOTE_ADDR) . "\r\n", 3, "logins.txt");
	exit();
}
else $errstr = $login_fail_str;
}

if ($check_cookie == 1) {
if ($auth != "") {
	header("Location: $homepage_url");
	exit();
}
else $errstr = $cookie_warn_str; 
}
?>
<html>
<head>
<title>Login - phpWebEd v.<? echo $phpWebEd_version;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body { margin-left:0px; margin-right:0px; margin-top:0px; margin-bottom:0px }
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
  <tr align="center" bgcolor="#DDDDDD"> 
    <td height="30"><font face="Verdana" size="+1"> 
      <? echo $login_head_str;?>
      </font></td>
  </tr>
  <tr align="center"> 
    <td valign="middle"> 
      <form method="post" action="http://nickgarmon.com/admin/index.php">
        <table border="0" cellspacing="0" cellpadding="2" bgcolor="#CCCCCC">
          <tr> 
            <td> 
              <table border="0" cellspacing="0" cellpadding="10" bgcolor="#FFFFFF">
                <tr align="center"> 
                  <td colspan="2"><font face="Verdana" size="2"><b><font size="3">Login</font></b></font></td>
                </tr><? if (isset($errstr)) echo "<tr align=\"center\"><td colspan=\"2\">
                   <font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"2\"><b>$errstr</b></font></td></tr>";?>
                <tr> 
                  <td align="right"><font face="Verdana" size="2"> 
                    <b><? echo $login_user_str;?></b>
                    </font></td>
                  <td><input type="text" name="name"></td>
                </tr>
                <tr> 
                  <td align="right"><font face="Verdana" size="2"> 
                    <b><? echo $login_pass_str;?></b>
                    </font></td>
                  <td><input type="password" name="pass"></td>
                </tr>
                <tr align="center"> 
                  <td valign="top" nowrap><font size="2" face="Verdana"><b>Editor 
                    Type</b></font></td>
                  <td> 
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr valign="top"> 
                        <td><input type="radio" name="ed_type" <? if ($edtype != "ax") echo "checked";?>></td>
                        <td><font size="2" face="Verdana">Javascript</font></td>
                      </tr>
                      <tr valign="top"> 
                        <td><input type="radio" name="ed_type" value="ax"<? if ($edtype == "ax") echo "checked";?>></td>
                        <td><font size="2" face="Verdana">ActiveX<br>
                          <font size="1">(requires <a href="http://www.m-tecs.net/axwebed/" target="_blank">axWebEd</a>)</font></font></td>
                      </tr>
                    </table>
                  </td>
                </tr>
                <tr align="center"> 
                  <td colspan="2"><input type="submit" name="submit" value="Login"></td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </form>
    </td>
  </tr>
  <tr bgcolor="#DDDDDD" align="center"> 
    <td height="20"><font face="Verdana" size="2">phpWebEd 
      <? echo "$phpWebEd_version";?>
      - Copyright © 2001-2002 Holger Mauermann - <a href="http://www.m-tecs.net/">www.m-tecs.net</a></font> 
    </td>
  </tr>
</table>
</body>
</html>

 

thats what it seems so I have been trying to fix anything that uses register globals being on.

 

How do I pass the POST to the small function at the top that sets the cookie?  the if($submit == Login) doesn't seem to ever run.  How do I define that function is responding to the POST?

Archived

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

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