SitePoint Sponsor |
|
User Tag List
Results 1 to 16 of 16
-
May 21, 2003, 14:58 #1
- Join Date
- Jan 2002
- Location
- South Yorkshire - UK
- Posts
- 222
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
login page: MX/PHP? Any thoughts ?
Using Dreamweaver MX, Iam attempting to create a login page/register page in PHP, its adding users to the mysql database, but when i add a username that already exists its supposed to divert to another page called taken.php, & also an error page when the login fails,however its still taking me to the welcome page ! whatever i do ? any thoughts ?
the login page comes back with various errors too, am i missing some important values ? the code for the login is below...
this is my first attempt, be kind !
this is the error i get back from the login.php page,
Warning: open(/tmp\sess_61267ce9f0e04fa7dcd729aaad604a4c, O_RDWR) failed: m (2) in C:\apache\htdocs\login.php on line 4
and:
Warning: open(/tmp\sess_61267ce9f0e04fa7dcd729aaad604a4c, O_RDWR) failed: m (2) in Unknown on line 0
Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
Cheers !!
Richard.
-----------------------------------------------------------------------------------------------
<?php require_once('Connections/log.php'); ?>
<?php
// *** Start the session
session_start();
// *** Validate request to log in to this site.
$FF_LoginAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING']) && $HTTP_SERVER_VARS['QUERY_STRING']!="" ) $FF_LoginAction .= "?".$HTTP_SERVER_VARS['QUERY_STRING'];
if (isset($HTTP_POST_VARS['username'])) {
$FF_valUsername=$HTTP_POST_VARS['username'];
$FF_valPassword=$HTTP_POST_VARS['password'];
$FF_fldUserAuthorization="";
$FF_redirectLoginSuccess="welcome.html";
$FF_redirectLoginFailed="error.html";
$FF_rsUser_Source="SELECT ID, username ";
if ($FF_fldUserAuthorization != "" ) $FF_rsUser_Source .= "," . $FF_fldUserAuthorization;
$FF_rsUser_Source .= " FROM users WHERE ID='" . $FF_valUsername . "' AND username='" . $FF_valPassword . "'";
mysql_select_db($database_log, $log);
$FF_rsUser=mysql_query($FF_rsUser_Source, $log) or die(mysql_error());
$row_FF_rsUser = mysql_fetch_assoc($FF_rsUser);
if(mysql_num_rows($FF_rsUser) > 0) {
// username and password match - this is a valid user
$MM_Username=$FF_valUsername;
session_register("MM_Username" );
if ($FF_fldUserAuthorization != "" ) {
$MM_UserAuthorization=$row_FF_rsUser[$FF_fldUserAuthorization];
} else {
$MM_UserAuthorization="";
}
session_register("MM_UserAuthorization" );
if (isset($accessdenied) && false) {
$FF_redirectLoginSuccess = $accessdenied;
}
mysql_free_result($FF_rsUser);
session_register("FF_login_failed" );
$FF_login_failed = false;
header ("Location: $FF_redirectLoginSuccess" );
exit;
}
mysql_free_result($FF_rsUser);
session_register("FF_login_failed" );
$FF_login_failed = true;
header ("Location: $FF_redirectLoginFailed" );
exit;
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form name="form1" method="POST" action="<?php echo $FF_LoginAction?>">
<table width="80%" cellspacing="0" cellpadding="0">
<tr>
<td width="11%">Username/td>
<td width="89%">
<input name="username" type="text" id="username"></td>
</tr>
<tr>
<td>Password/td>
<td>
<input name="password" type="password" id="password">
<input type="submit" name="Submit" value="Log in"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</form>
</body>
</html>
Last edited by rikmg
-
May 21, 2003, 15:01 #2
- Join Date
- Jul 2002
- Location
- Along the Wasatch Fault line.
- Posts
- 1,771
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Create a "temp" dir off of your root. ie: C:\temp
John
-
May 21, 2003, 15:03 #3
- Join Date
- Jan 2002
- Location
- South Yorkshire - UK
- Posts
- 222
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
running on localhost with phpmyadmin apache,mysql all combined, what would the Session variable look like from session_start(); where would is my php.ini stored ?
-
May 21, 2003, 15:04 #4
- Join Date
- Jan 2002
- Location
- South Yorkshire - UK
- Posts
- 222
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
so would i create the temp folder in the apache folder or in htdocs ?
-
May 21, 2003, 15:05 #5
- Join Date
- Jul 2002
- Location
- Along the Wasatch Fault line.
- Posts
- 1,771
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Do a search for "php.ini". In it you will find a line like this:
; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
session.save_path = /tmpJohn
-
May 21, 2003, 15:05 #6
- Join Date
- Jan 2002
- Location
- South Yorkshire - UK
- Posts
- 222
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
i tried to add another user to the db, via kevins method and now i get submission error again without changing anything previously...
-
May 21, 2003, 15:06 #7
- Join Date
- Jan 2002
- Location
- South Yorkshire - UK
- Posts
- 222
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
i created a directory in the apache folder, i'll slow down in my excitement that you may e able to help..
-
May 21, 2003, 15:12 #8
- Join Date
- Jan 2002
- Location
- South Yorkshire - UK
- Posts
- 222
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
i've found the file, now i have the temp folder in the apache folder is this my server root, sorry if i sound dumb...
-
May 21, 2003, 15:19 #9
- Join Date
- Jan 2002
- Location
- South Yorkshire - UK
- Posts
- 222
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
i changed it to this;
; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
session.save_path = C:/apache/temp
still no joy....
-
May 21, 2003, 15:28 #10
- Join Date
- Aug 2000
- Location
- Houston, TX, USA
- Posts
- 6,455
- Mentioned
- 11 Post(s)
- Tagged
- 0 Thread(s)
Have you tried
session.save_path = C:\apache\temp
??ssegraves [at] gmail.com
On Image Use, Abuse, and Where We're Headed
stephan | XMLHttpRequest Basics
flickr | last.fm | Cogentas, LLC
-
May 21, 2003, 15:29 #11
- Join Date
- Jan 2002
- Location
- South Yorkshire - UK
- Posts
- 222
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
is it really that fussy ?
-
May 21, 2003, 15:31 #12
- Join Date
- Aug 2000
- Location
- Houston, TX, USA
- Posts
- 6,455
- Mentioned
- 11 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by rikmg
Also, make sure that after you make changes to the ini file, you restart Apache.ssegraves [at] gmail.com
On Image Use, Abuse, and Where We're Headed
stephan | XMLHttpRequest Basics
flickr | last.fm | Cogentas, LLC
-
May 21, 2003, 15:31 #13
- Join Date
- Jan 2002
- Location
- South Yorkshire - UK
- Posts
- 222
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
still getting databse error occured in your script iam using the tutorial from kevins PHP sessions/mysql user login tut.
-
May 21, 2003, 15:33 #14
- Join Date
- Jan 2002
- Location
- South Yorkshire - UK
- Posts
- 222
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
it worked once and added a user to the db then stopped and i changed nothing, did something time out ?
-
May 21, 2003, 15:43 #15
- Join Date
- Jan 2002
- Location
- South Yorkshire - UK
- Posts
- 222
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I would have thought this would have been relatively easy to sort out, why is it so fussy ? why add one then fail ? looks like Access/ASP or coldfusion is calling !! More expensive yep, but more reliable ? i refuse to give up on this though !!
-
May 21, 2003, 20:48 #16
- Join Date
- Aug 2000
- Location
- Houston, TX, USA
- Posts
- 6,455
- Mentioned
- 11 Post(s)
- Tagged
- 0 Thread(s)
I don't think it is a question of reliability, maybe just customization.
Try downloading phpdev from http://www.firepages.com.au
You can program your site in MX and just run them from the web browser. Everything works out of box with the phpdev setup. Just read the directions and run the install file.ssegraves [at] gmail.com
On Image Use, Abuse, and Where We're Headed
stephan | XMLHttpRequest Basics
flickr | last.fm | Cogentas, LLC
Bookmarks