I am getting
the following
error....
Forbidden
You don't have
permission to
access
/defaultUser/&l
t; on this
server.
This error
comes after
pushing submit
on the login
page. I have
checked the dB
and the user
has been added
successfully
using the
register.php
my login.php is
as follows
Code:
<?php
include'page_he
ader.php';
if(isset($_SESS
ION['username']
) &&
isset($_SESSION
['password']))
{
//REDIRECT TO
USERS
PROFILE...
header("Lo
cation:
http://localhos
t/defaultUser/p
age.php" ;
} //end if
logged in
//IF SUBMIT
BUTTON PRESSED
if(isset($_POST
['submit'])) {
if(!$_POST['use
rname'])
die("Error
: You must
enter your
username before
logging
in." ;
if(!$_POST['pas
sword'])
die("Error
: You must
enter your
password before
logging
in." ;
//set cookie
if checked
if(!empty($_POS
T['stay_in']))
{
$joined
=''.$_POST['use
rname'].'[]'.md
5($_POST['passw
ord']).'';
setcookie('logi
n_cookie',
$joined,
2147483647,
'/',
'.www.yoursite.
com');
} //end if
//verify
user...
$get_user =
mysql_query(&qu
ot;SELECT *
FROM `members`
WHERE username
=
'".$_POST[
'username'].&qu
ot;' AND
password =
'".md5($_P
OST['password']
)."'"<
img
src=http://www.
allsyntax.com/f
orums/images/sm
ilies/wink.gif
border=0>;
$q =
mysql_fetch_obj
ect($get_user);
if(!$q)
die("Login
Failure: An
error occured,
please verify
your username
and password
are
correct."
//set session
variables
$_SESSION['logg
ed_in'] = 1;
$_SESSION['user
name'] =
$_POST['usernam
e'];
$_SESSION['pass
word'] =
$_POST['passwor
d'];
session_write_c
lose();
header("Lo
cation:
http://localhos
t/defaultUser/p
age.php"
} else {
//show login
form
?>
<form
name="logi
n"
method="po
st"
action="&l
t;?
$_SERVER['PHP_S
ELF'];
?>">
<table>
<tr>
<td>Usern
ame:<input
type="text
"
id="userna
me"
name="user
name">&
lt;/td>
</tr>
<tr>
<td>Passw
ord:<input
type="pass
word"
id="passwo
rd"
name="pass
word">&
lt;/td>
</tr>
<tr>
<td>Submi
t: <input
type="subm
it"
value="Sub
mit"
name="subm
it"
id="submit
"></
td>
</tr>
<tr>
<td>Remem
ber? <input
type="chec
kbox"
name="stay
_in[]"
checked="y
es"><
;/td>
</tr>
</table>
</form>
<?php
}//end else
?>
the page that
is goes to
page.php is as
follows
Code:
<?php
include'page_he
ader.php';
if($_SESSION['l
ogged_in'] ==
0)
{
echo('You must
be a member or
logged in to
view this page.
If you are a
member, Please
<a
href="http
://localhost/de
faultUser/login
.php">L
ogin</a>'
);
}
else
{
echo('You are
logged in.
Please Proceed
to <a
href="http
://www.brillian
tbundles.com&qu
ot;>Brillian
tBundles</a&
gt;. Or <a
href="http
://localhost/de
faultUser/logou
t.php">
Logout</a>
;');
}
?>
any help is
appreciated.
Thanks
D Edited at 03:58:34 am on 08/06/07
|