Jump to content

Login issue


Edmachine

Recommended Posts

Hello!I have a weird problem with a login script I made from a tutorial here.When I try to log in, it shows this:ForbiddenYou don't have permission to access /techgeeks/< on this server.And this in the address bar:http://localhost/techgeeks/%3C?=%20$_SERVER['PHP_SELF']%20?%3EThe code is as follows:***Scratch those things, I solved it***But now I have a new problem:I have a member.php page (obviously a members CP), but nothing shows up! :) The code:

<?phpsession_start();if($_SESSION['s_logged_n'] == 'true'){include 'process.php';?><html><head><title>Members Page</title><link href="style.css" rel="stylesheet" type="text/css"></head><body><div id="wrapper"><div id="head">The member page</div><br><div id="container"><? include 'menus.php' ?></div><div id="spacer"> </div><div id="memmain"><?phpswitch($_GET['change']){case 'password':echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post"><p>Current password:<br><input name="current" type="password"></p><p>New password:<br><input name="new" type="password"></p><p>Confirm new password:<br><input name="confirm" type="password"></p><p><input type="submit" value="Change Password" name="changepassword"></p></form>';break;case 'email':echo '<p>WARNING! - By changing your email address you will have to re-validate. Make sure you email address is 100% correct.</p><form action="'.$_SERVER['PHP_SELF'].'" method="post"><p>Current email:<br><input name="current" type="text"></p><p>New email:<br><input name="new" type="text"></p><p>Confirm new email:<br><input name="confirm" type="text"></p><p><input type="submit" value="Change Email" name="changeemail"></p></form>';break;case 'account':echo '<p>WARNING - By closing your account, you will not be able to login again under this account. Press the button below to confirm you wish to close your account</p><form action="'.$_SERVER['PHP_SELF'].'" method="post"><p><input type="submit" value="Close Account" name="closeaccount"></p></form>';break;default:echo '<p>Welcome to the members only control panel!</p>';}?></div></body></html><?php} else {header("Location: login.php");}?>

At the beginning, it says to include menus.php, but it doesn't. All that I see, is The member page and Welcome to the members only control panel!

Link to comment
Share on other sites

That link was caused by this:<form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">I changed that to login.php and it solved itself...As for the other problem, now the menus won't show up :)And I solved that too... damn short tags...Now I enabled the short tags to prevent such stuff in the future...

Link to comment
Share on other sites

It's better to just use long tags, that way you can copy your code to other servers and it will still work. The long tag equivalent of this:<form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">is this:<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...