nitation Posted December 5, 2007 Share Posted December 5, 2007 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"> ??? ??? ??? Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 5, 2007 Share Posted December 5, 2007 your register_globals setting in your php.ini must be turned off you have to use <FORM name="install" action="<?php print $_SERVER['PHP_SELF']; ?>" method="post"> Quote Link to comment Share on other sites More sharing options...
nitation Posted December 5, 2007 Author Share Posted December 5, 2007 Thank you for your reply, but i dont have the privilledges to edit the php.ini, i am currently using a shared hosting from the service provider. what can i do in this regard??? Quote Link to comment Share on other sites More sharing options...
aschk Posted December 5, 2007 Share Posted December 5, 2007 The solution was given to you, check his post. Quote Link to comment Share on other sites More sharing options...
nitation Posted December 10, 2007 Author Share Posted December 10, 2007 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"); } } ?> Quote Link to comment Share on other sites More sharing options...
revraz Posted December 10, 2007 Share Posted December 10, 2007 Tell us what's not working. Quote Link to comment Share on other sites More sharing options...
trq Posted December 10, 2007 Share Posted December 10, 2007 $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. Quote Link to comment Share on other sites More sharing options...
nitation Posted December 10, 2007 Author Share Posted December 10, 2007 @ 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. Quote Link to comment Share on other sites More sharing options...
nitation Posted December 10, 2007 Author Share Posted December 10, 2007 i observed the main reason why my reply wasn't responded to was becos i didn't insert my code into the tags. People forgive me. Quote Link to comment Share on other sites More sharing options...
nitation Posted December 10, 2007 Author Share Posted December 10, 2007 @ 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.[ Quote Link to comment Share on other sites More sharing options...
trq Posted December 11, 2007 Share Posted December 11, 2007 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. Quote Link to comment Share on other sites More sharing options...
nitation Posted December 11, 2007 Author Share Posted December 11, 2007 $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 Quote Link to comment Share on other sites More sharing options...
trq Posted December 11, 2007 Share Posted December 11, 2007 That is syntactically incorrect, it should be.... $sqllog=mysql_query(" SELECT * FROM enter_code WHERE aname='{$_POST['loginname']}'"); but what error did you get? Quote Link to comment Share on other sites More sharing options...
nitation Posted December 11, 2007 Author Share Posted December 11, 2007 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. Quote Link to comment Share on other sites More sharing options...
nitation Posted December 11, 2007 Author Share Posted December 11, 2007 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. Quote Link to comment Share on other sites More sharing options...
revraz Posted December 11, 2007 Share Posted December 11, 2007 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. Quote Link to comment Share on other sites More sharing options...
trq Posted December 11, 2007 Share Posted December 11, 2007 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. Quote Link to comment Share on other sites More sharing options...
nitation Posted December 14, 2007 Author Share Posted December 14, 2007 Guys i finally got out of my mess. I thanked everyone that contributed to my question. Rajiv, Thorpe and others i can't instantly remember ur usernames. Kudos to yah all. Thanks Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 14, 2007 Share Posted December 14, 2007 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.