Search
Left Quote    Knowledge speaks, but wisdom listens.
- Jimi Hendrix    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: strange error member system
  This user is offline  duece
  Subject: "strange error member system" Posted: @ 3:48 am on Aug 06 2007   
Member #: 341
Rank: User - (14)
Since: 06/12/07
Posts: 14

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


    Viewed: 11,810 Times | Reply to This | To top
  This user is offline  duece
  Subject: "re: strange error member system" Posted: @ 3:58 am on Aug 06 2007    
Member #: 341
Rank: User - (14)
Since: 06/12/07
Posts: 14

I have also occasionally gotten this error as well...
Warning: mysql_fetch_obj ect(): supplied argument is not a valid MySQL result resource in C:\wamp\www\ UserAuth\login .php on line 24
Login Failure: An error occured, please verify your username and password are correct.


?!?!
confusion abounds

Is there a good debugger for PHP... ??




    Viewed: 11,801 Times | Reply to This | To top
  This user is offline  bs0d
  Subject: "re: strange error member system" Posted: @ 4:22 am on Aug 06 2007    

Member #: 1
Rank: Admin. - (1,505)
Since: 02/06/05
Posts: 600
From: USA

Hrm, check the CHMOD of /defaultUser/ ?




-bs0d | AllSyntax.com

    Viewed: 11,797 Times | Reply to This | To top
  This user is offline  duece
  Subject: "re: strange error member system" Posted: @ 4:27 am on Aug 06 2007    
Member #: 341
Rank: User - (14)
Since: 06/12/07
Posts: 14

  bs0d said...

< i> Hrm, check the CHMOD of /defaultUser/ ?



the defaultUser
is in the localhost folder, using the WAMP development server
so it is the
localhost/defau ltUser/login.ph p

I have had no problems thus far with any other folders, files or the like and I haven't done anything with CHMOD yet..??




    Viewed: 11,795 Times | Reply to This | To top
  This user is offline  duece
  Subject: "re: strange error member system" Posted: @ 10:11 pm on Aug 08 2007    
Member #: 341
Rank: User - (14)
Since: 06/12/07
Posts: 14

okay got it... I had created the new database and had not opened up the users to that dB. I have only used mySQLadmin and myPHPadmin so when you said it like that it didn't quite make sense to me...

I just created a new user and gave them privileges on the dB i was using in my connect.php as well as used the appropriate login... (which is I assume is the total nube way of saying....check the CHMOD...)

Thanks
D




    Viewed: 11,754 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank