Jump to content

[SOLVED] Problems with php 5.2.4


nitation

Recommended Posts

I have php 5.2.4 running on my server. I have a problem. Whenever i try to process a form or install mysql database using php , it doesn't seem to work. But i have it working perfectly on lower versions of php. Can someone help me with this???  This is the form parameter am using:

 

<FORM  name="install" action="<?php print "$PHP_SELF" ?>" method="post">

 

??? ??? ???

Link to comment
Share on other sites

Can someone please tell me what is wrong with this code. Am using php version 5.2.4

 

<?php

 

session_start();

 

if (!isset ($_SESSION["admin_id"]))

 

{

  header ("Location:main.php?login=missing");

}

 

include("connect.php");

 

if($log){

 

$sqllog=mysql_query(" SELECT  * FROM  enter_code WHERE aname='$loginname'");

 

if($sqllog){

$row=mysql_fetch_array($sqllog);

$rowid=$row["id"];

}

 

$num=mysql_num_rows($sqllog);

if($num > 0){

 

$_SESSION["admin_id"]=$row["adminid"];

  header ("Location: index.php");

}

else

{

  header ("Location: main.php?login=wrong");

}

 

}

?>

Link to comment
Share on other sites

@ revraz

 

I have a form to login into my admin area, but doesn't seem working. The database is fine. An the login data is accurate. Although, the server running is php 4.4.7. Here is the break down.

 

main.php

***************************************************************

<?

include("session.php");

include("language/english/en.php");

include("connect.php");

$return=ADMIN_LOGIN;

 

if($login=="wrong"){

$return=ADMIN_ERROR_WRONG;

}

 

else if($login=="missing"){

$return=ADMIN_ERROR_MISSING;

}

 

require("lib/html_login.php");

 

?>

***************************************************************

session.php

***************************************************************

<?php

session_start();

$name=session_name();

$sid=session_id();

$usid=$_SESSION["adminid"];

 

?>

*****************************************************************

html_login.php

*****************************************************************

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title><? print ADMIN_TITLE; ?></title>

<link href="css/stylesheet.css" rel="stylesheet" type="text/css" />

</head>

<body id="login" onLoad="document.getElementById('loginname').focus()">

      <tr>

            <td height="80">

            <td>

            <td rowspan="3" valign="top"> <form action="login.php" method="post">

<fieldset>

          <legend><? print $return; ?></legend>

                <table width="300" height="50" bordercolor="#FF9900">

                    <tr>

  <td width="100" align="right" valign="top">

  <label class="loginLabel" for="loginname"><? print ADMIN_USERNAME; ?></label></td>

                    <td width="200"><input style="float: left" name="loginname" type="text"></td>

                  </tr><br class="clearBoth" />

                  <tr>

                    <td align="right" valign="top">

<label  class="loginLabel" for="passwd"><? print ADMIN_PASSWORD; ?></label></td>

                    <td><input style="float: left" name="passwd" type="password"></td>

                  </tr><br class="clearBoth" />

                  <tr align="center" valign="bottom">

                    <td colspan="2"><input type="submit" name="log" class="button" value="<? print ADMIN_ENTER;?>" />

<a style="float: right;" href="#"><? print ADMIN_RESEND_PASSWORD; ?></a>

</td>

                  </tr>

                </table>

  </fieldset>

              </form>

             

</body>

</html>

****************************************************************************

login.php

 

The login.php was my initial post.

 

Please kindly help.

Link to comment
Share on other sites

@ revraz

I have a form to login into my admin area, but doesn't seem working. The database is fine. An the login data is accurate. Although, the server running is php 4.4.7. Here is the break down.

main.php
***************************************************************
<?
include("session.php");
include("language/english/en.php");
include("connect.php");
$return=ADMIN_LOGIN;

if($login=="wrong"){
$return=ADMIN_ERROR_WRONG;
}

else if($login=="missing"){
$return=ADMIN_ERROR_MISSING;
}

require("lib/html_login.php");

?>
***************************************************************
session.php
***************************************************************
<?php
session_start();
$name=session_name();
$sid=session_id();
$usid=$_SESSION["adminid"];

?>
*****************************************************************
html_login.php
*****************************************************************
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><? print ADMIN_TITLE; ?></title>
<link href="css/stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body id="login" onLoad="document.getElementById('loginname').focus()">
       <tr>
            <td height="80">
            <td>
            <td rowspan="3" valign="top"> <form action="login.php" method="post">
         <fieldset>
           <legend><? print $return; ?></legend>
                <table width="300" height="50" bordercolor="#FF9900">
                    <tr>
               <td width="100" align="right" valign="top">
               <label class="loginLabel" for="loginname"><? print ADMIN_USERNAME; ?></label></td>
                    <td width="200"><input style="float: left" name="loginname" type="text"></td>
                  </tr><br class="clearBoth" />
                  <tr>
                    <td align="right" valign="top">
               <label  class="loginLabel" for="passwd"><? print ADMIN_PASSWORD; ?></label></td>
                    <td><input style="float: left" name="passwd" type="password"></td>
                  </tr><br class="clearBoth" />
                  <tr align="center" valign="bottom">
                    <td colspan="2"><input type="submit" name="log" class="button" value="<? print ADMIN_ENTER;?>" />
               <a style="float: right;" href="#"><? print ADMIN_RESEND_PASSWORD; ?>[/url]
               </td>
                  </tr>
                </table>
              </fieldset>
              </form>
             
</body>
</html>
****************************************************************************
/code]
login.php

The login.php was my initial post.

Please kindly help.[

Link to comment
Share on other sites

i observed the main reason why my reply wasn't responded to was becos i didn't insert my code into the

 

I would suggest the main reason you haven't had further replies is bacause your questions have been answered yet you have failed to read the replies.

Link to comment
Share on other sites

$loginname is not defined anywhere. If its comming from a form (via the post method), you need to use $_POST['loginname'].

 

These changes where made to php long before php5. You really need to update all your code.

 

Thorpe, i did use $_POST['loginname'] like this;

$sqllog=mysql_query(" SELECT  * FROM  enter_code WHERE aname='$_POST['loginname']'");

but all i get is an error from Php.

 

Thank you

Link to comment
Share on other sites

That is syntactically incorrect, it should be....

 

$sqllog=mysql_query(" SELECT  * FROM  enter_code WHERE aname='{$_POST['loginname']}'");

 

but what error did you get?

 

Thorpe. This time it's no longer displaying any errors. But the login form is not logging in.

Link to comment
Share on other sites

No one is willing to assist me on phpfreak. I have myself sitted here for more than 8hours trying to get this problem solved, but is proved abortive.

 

Am using php 4.4.7 and my login script is not processing. Administrators can not login into the admin area. The data is accurate in the database. Can someone help me please!!!!

 

Am really in need of this solution.

Link to comment
Share on other sites

Plenty of people are willing to help, but it's hard to when you don't describe exactly what the problem is.  Saying admin's can't log in isn't telling us the problem.

 

There is too much wrong in the code, it would be faster to just redo it.

 

No one is willing to assist me on phpfreak. I have myself sitted here for more than 8hours trying to get this problem solved, but is proved abortive.

 

Am using php 4.4.7 and my login script is not processing. Administrators can not login into the admin area. The data is accurate in the database. Can someone help me please!!!!

 

Am really in need of this solution.

Link to comment
Share on other sites

If you'd read the replies you would have had a solution hours ago. register_globals is not enabled by default anymore. All these variable that used to magically appear, now need to be found within the $_POST and $_GET arrays. Fix these variables (site wide) and your problems will more than likely disappear.

 

As I said, these changes happened a long time ago, you should keep up to date with language/configuration changes if you expect to maintain an application over prolonged periods of time.

Link to comment
Share on other sites

Just a comment:

 

Register_globals were turned off by default in php 4.2 in the year 2002. No new code, tutorials, books... should have been written after that point in time that relied on register globals being on.

 

Register globals were a huge blunder and created a security problem where values from outside your program can replace values in program variables that are set as the result of register globals (such as from session variables.)

 

Register globals have been completely eliminated in php6. Everyone who currently has code that depends on register globals WILL need to fix their code if they want their code to work on php6.

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.