View unanswered posts | View active topics It is currently Mon May 23, 2022 2:25 am



Reply to topic  [ 1 post ] 
 403 Error Access forbidden 
Author Message
Junior Member

Joined: Wed Oct 21, 2009 11:55 am
Posts: 1
Post 403 Error Access forbidden
Hi

Just for starters this is one of my first PHP work that I do so my knowledge is limited, which is why I'm coming to you for help :)

The following code is supposed to be a simple log on on a web page. This is just a school project so there is no real need for this to be ultra secure. But feel free to comment on it as you want, thats what I'm here for.

My problem is that when I click the "Submit" button I get a 403 Error Access Forbidden.

So this authmain.php:

<?php
session_start();

if(isset($_POST['UserId']) && isset($_POST['Password']))
{
$userid = $_POST['UserId'];
$password = $_POST['Password'];

//Checks if the correct user and password was inputed
if($userid == 'User' && $password == 'Password')
{
$_SESSION['valid_user'] = $userid;
}

}
?>
<html>
<body>
<?
if(isset($_SESSION['valid_user']))
{
//If the user is logged in
echo 'Þú ert skráður inn sem '.$_SESSION['valid_user'].'
';
echo '<a href="logout.php">Log in</a>
';
}
else
{
if(isset($userid))
{
//Unable to log in
echo 'Gat ekki skráð þig inn.
';
}
else
{
//Not logged in
echo 'Þú ert ekki skráður inn.
';
}
//The log in form
echo '<form method="post" action="authmain.php">';
echo '<table>';
echo '<tr><td>Notandi:</td>';
echo '<td><input type="text" name="UserId"></td></tr>';
echo '<tr><td>Lykilorð</td>';
echo '<td><input type="password" name="Password"></td></tr>';
echo '<tr><td colspan="2" align="center">';
echo '<input type="submit" value="Skrá inn"></td></tr>';
echo '</table></form>';
}
?>


<a href="members_only.php">Meðlimir aðeins</a>
</body>

</html>


This is currently hosted here on my schools network. I know its running on Apache and supports PHP 4.3.4 version.
I did this with the help of a book that teaches PHP 5 so am I doing something that isn't a part of 4.3.4?

I have tried skipping the internal if-statement at the top, and the userid and password decleration, and only had $_SESSION['valid_user'] = 'User' there and that worked (still inside the outer if-statement).

I have no way of doing anything with the server just so you know. I am only able to upload files to it.

All help is appreciated.


Wed Oct 21, 2009 12:18 pm
Report this post
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
© Copyright 2003-2008 www.php-editors.com. The ultimate PHP Editor and PHP IDE site.