peeji Posted July 8, 2009 Share Posted July 8, 2009 Hi there, I downloaded the CMS from this website http://www.cms-center.com/ and I've tried to run the login.php file but it won't work for some reason. When I try to log in, it just reloads the page without taking me to the admin page (which is what it is supposed to do upon successful login). Here's the code: <? session_start(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Login</title> <link href="/style.css" rel="stylesheet" type="text/css"> </head> <body style="font-family: tahoma;"> <? require ("config.php"); if ($e == "1") { echo "<p>Please Login</p>"; } ?> <h3>Simple CMS Login</h3> <p><img src='img/security.gif' title='please login'></p> <form action="login.php" method="post" name="frm"> <table cellspacing="4" cellpadding="4" style="border-bottom-width: thin; border-left-width: thin; border-right-width: thin; border-top-width: thin; border-style: dotted; border-color: red;"> <tr> <td>username</td> <td><input type="text" name="formlogin" class="cssborder"></td> </tr> <tr> <td>password</td> <td><input type="password" name="formpass" class="cssborder"></td> </tr> </table> <br> <input type="submit" value="login" class="cssborder"> </form> <? //echo "formlogin=$formlogin"; //echo "<br>formpass=$formpass"; //echo "<br>login=$login"; //echo "<br>pass=$pass"; if ($formpass == $pass && $formlogin == $login) { session_register("loggedin"); $loggedin = "1"; //logged in so run a javascript redirect to admin page. ?> <script language="javascript"> <!-- location.replace("admin"); --> </script> <h4><a href='admin'>you are now logged in, continue to the admin section</a></h4> <? } ?> <p><a href="login.php"><small>reload</small></a></p> </body> </html> Could anyone enlighten me on this? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/165129-cms-built-with-php-and-mysql-log-in-help/ Share on other sites More sharing options...
p2grace Posted July 8, 2009 Share Posted July 8, 2009 I'd check your error log and make sure that apache isn't having permission issues while attempting to save the session. <?php // Enable displaying of errors error_reporting(E_ALL); ini_set('display_errors','on'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/165129-cms-built-with-php-and-mysql-log-in-help/#findComment-870727 Share on other sites More sharing options...
JonnoTheDev Posted July 8, 2009 Share Posted July 8, 2009 if ($formpass == $pass && $formlogin == $login) { session_register("loggedin"); $loggedin = "1"; //logged in so run a javascript redirect to admin page. ?> <script language="javascript"> <!-- location.replace("admin"); --> </script> This is awful code (using javascript to redirect). session_register() is depreciated. Get yourself a new CMS (an upto date one at least) Quote Link to comment https://forums.phpfreaks.com/topic/165129-cms-built-with-php-and-mysql-log-in-help/#findComment-870880 Share on other sites More sharing options...
PFMaBiSmAd Posted July 8, 2009 Share Posted July 8, 2009 I'll second that, the script is way out of date. It is using register_globals and session_register() (both were turned off by default 7 years ago) and it is using short open tags (they should never be used in a script that is distributed for others to use on a server different form the one the code was developed to run on.) Quote Link to comment https://forums.phpfreaks.com/topic/165129-cms-built-with-php-and-mysql-log-in-help/#findComment-870996 Share on other sites More sharing options...
ignace Posted July 8, 2009 Share Posted July 8, 2009 This is awful code (using javascript to redirect). session_register() is depreciated. Get yourself a new CMS (an upto date one at least) The best part is this is up-to-date code (atleast for SimpleCMS it is) And just say you are referring to Drupal Quote Link to comment https://forums.phpfreaks.com/topic/165129-cms-built-with-php-and-mysql-log-in-help/#findComment-871001 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.