cluce
-
Posts
354 -
Joined
-
Last visited
Never
Posts posted by cluce
-
-
thanks a millioin
-
I have three pages a user_logon.html, userlogin.php, and a logon(if successful). I am trying to greet the user but my php is not on the same page as logon.php. Is their any way I can greet the user this way?? If so I can't get it to work. here is the userlogon.html code........
<form method="post" action="userlogin.php"> <p> </p> <p><strong>Username:</strong> <input name="username" type="text" size="25"/> </p> <p><strong>Password:</strong> <input name="password" type="password" size="25"/> </p> <blockquote> <blockquote> <p align="right"> <input name="submit" type="submit" onclick="MM_validateForm('username','','R','password','','R');return document.MM_returnValue" value=" Login "/> <input name="Reset" type="reset" id="Reset" value="Cancel" />
here is the userlogin.php code........
<?php //check for required fields from the form if ((!isset($_POST["username"])) || (!isset($_POST["password"]))) { header("Location: user_logon.html"); exit; } //connect to server and select database $mysqli = mysqli_connect("localhost", "root", "", "test"); //create and issue the query $sql = "SELECT f_name, l_name FROM auth_users WHERE username = '".$_POST["username"]."' AND password = PASSWORD('".$_POST["password"]."')"; $result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli)); //get the number of rows in the result set; should be 1 if a match if (mysqli_num_rows($result) == 1) { //if authorized, get the values of f_name l_name while ($info = mysqli_fetch_array($result)) { $f_name = stripslashes($info['f_name']); $l_name = stripslashes($info['l_name']); } //set authorization cookie setcookie("auth", "1", 0, "/", "yourdomain.com", 0); //directs authorized user header("Location: logon.php"); } else { //redirect back to login form if not authorized header("Location: registration.html"); exit; } ?>
here is the logon.php page code......
<p> <?php echo("<p>Welcome <b>".$_POST['f_name']."</b>!</p>") ?> </p>
Can someone suggest how I can get this accomplished??
-
does anybody know where to find some good instructions on how to set up php on windows server 2003. I tried 3 different websites and followed the instructions exactly and had no luck.
-
If you know you have the right code and you still can't pass data between pages. What else could be wrong? installation? configuration?????
-
Can someone tell me how to add an onclick behavior and tell it to do this ...
if (($_POST["password"]) !== ($_POST["confirmpassword"])){
echo ("passwords must be identical");
}else{
Instead of putting this on a second page and having duplicate pages to display the error message, I am trying to confirm the passwords before submitting or inserting a new record in the database and if they dont match have it display a message on the same page. Anybody have any ideas? I am using Dreamweaver 8 and PHP and mySQL.
-
-
I have a registration form that has a password textbox. The problem I have is it shows the password while they type. Can someone tell me how can I hide the characters while the user types it in?
I would appreciate it.
-
-
I am not sure wants going on here. Both of my fields are varchar(50). Can someone tell me what I am missing?
here is the code I am using.........
<?php
$mysqli = mysqli_connect("localhost", "root", "", "test");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} else {
$sql = "INSERT INTO testTable (testField) VALUES ('".$_POST['testfield']."','".$_POST['testfield2']."')";
$res = mysqli_query($mysqli, $sql);
if ($res === TRUE) {
echo "A record has been inserted.";
} else {
printf("Could not insert record: %s\n", mysqli_error($mysqli));
}
mysqli_close($mysqli);
}
?>
-
oh ok thanks for your input. Javascript does work with Dreamweaver.
-
lets say a year experience with dreamweaver 8 and mySQL experience. Im just doing some research thats all. It dont have to be an accurate answer based on experience.
-
this is all I use...
//connect to server and select database
$mysqli = mysqli_connect("localhost", "username", "password", "database");
//create and issue the query
$sql = "SELECT......................FROM..............
$result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
-
What is the average salary a php programmer can make?
-
Thanks. I plan on getting a book.
-
here is the code I am using but it will not echo their name. Does anybody have any suggestions on how to do this correctly?
<?php
$sql = "SELECT f_name, l_name FROM auth_users WHERE username = '".$_POST["username"]."' AND password = PASSWORD('".$_POST["password"]."')";
?>
<?php
echo "Welcome", $sql;
?>
-
cool; thanks.
if you can tell me . but where do I put that code in my page?
-
well how do you tunr off the cache? The code that was posted didn't seem to work. at least in the places where I coded.
-
here is the code I am using .......can someone tell me how to modify this on how I can do this.....
<?php
//check for required fields from the form
if ((!isset($_POST["username"])) || (!isset($_POST["password"]))) {
header("Location: userlogin.html");
exit;
}
//connect to server and select database
$mysqli = mysqli_connect("localhost", "root", "", "test");
//create and issue the query
$sql = "SELECT f_name, l_name FROM auth_users WHERE username = '".$_POST["username"]."' AND password = PASSWORD('".$_POST["password"]."')";
$result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));
//get the number of rows in the result set; should be 1 if a match
if (mysqli_num_rows($result) == 1) {
//if authorized, get the values of f_name l_name
while ($info = mysqli_fetch_array($result)) {
$f_name = stripslashes($info['f_name']);
$l_name = stripslashes($info['l_name']);
}
//set authorization cookie
setcookie("auth", "1", 0, "/", "yourdomain.com", 0);
//directs authorized user
header("Location: logon.php");
//prevents cache of logon info
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 01 Jan 1900 00:00:00 GMT");
} else {
//redirect back to login form if not authorized
header("Location: registration.html");
exit;
}
?>
<html>
-
I was talking about on the internet browsers.........I am trying to prevent the user from logging on with the next and previous buttons on the browser. Even after they log out. can someone me any suggestions on how to disable this?? What code or functions could I use??
thanks for your replies. I will check it out.
-
I am trying to prevent the logon and previous buttons from logging in a user. Even after they log out. can someone me any suggestions on how to disable this?? What code or functions could I use??
-
<form id="form1" name="form1" method="POST" action="<?php echo $loginFormAction; ?>">
<input name="username" type="text" id="username" />
</div></td></tr>
<tr>
<td><div align="left">Password:</div></td>
<td>
<div align="center">
<input name="password" type="text" id="password" />
</div></td></tr>
</table> <p>
<input type="submit" name="Submit" value="Logon" />
<input name="Cancel" type="reset" id="Cancel" value="Cancel" />
</form>
page 2 code.......
<?php echo( "Welcome ,$_POST[username]!" ); ?> </p>
OK, I can pass the data when I uses apache 1.2 version but when I use WAMP and apache 2 it won't pass the data from one page to another. I am puzzled.
Can someone see why I can't display the username upon them logon on?
Thanks
-
can someone tell me how to reconfigure this correctly so i can get rid of these errors....
Warning: open(/tmp\sess_df7e67aa92cb740cee4bce1b9ac58406, O_RDWR) failed: No such file or directory (2) in c:\phpdev5\www\user_logon.php on line 5
Warning: open(/tmp\sess_df7e67aa92cb740cee4bce1b9ac58406, O_RDWR) failed: No such file or directory (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
thanks
-
04/27/2007 07:00:41 PM
here is the code I am using..
<?php require_once('Connections/COnn2.php'); ?>
<?php
// *** Validate request to login to this site.
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['firstname'])) {
$loginUsername=$_POST['firstname'];
$password=$_POST['lastname'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "User_login.html";
$MM_redirectLoginFailed = "registration.html";
$MM_redirecttoReferrer = false;
mysql_select_db($database_COnn2, $COnn2);
$LoginRS__query=sprintf("SELECT id, f_name FROM auth_users WHERE id='%s' AND f_name='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $COnn2) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>
logon on with user name and password still brings me to the registration page. can someone give me any suggestions.
I did delete this code at the top because I was recieving crazy messages.........
if (!isset($_SESSION)) {
session_start();
}
....the error messages I was getting was .....
Warning: open(/tmp\sess_df7e67aa92cb740cee4bce1b9ac58406, O_RDWR) failed: No such file or directory (2) in c:\phpdev5\www\user_logon.php on line 5
Warning: open(/tmp\sess_df7e67aa92cb740cee4bce1b9ac58406, O_RDWR) failed: No such file or directory (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
when I deleted those two lines I can atleast get to the registration page but it does the same thing when I use a logon and password. its like its not retrieving and storing the data to access that page. can someone help me with this? I would really appreciate it.
-
unusual question here : anybody know how to put the check next to a topic that is solved??
Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and
in PHP Coding Help
Posted
I am trying to send an email through a web form but I am getting an error......
I am trying to use windows xp on my local machine.
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\sendmail.php on line 19
Can someone tell me how to fix this.
Here are my config settings for the mail server.....
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
;sendmail_from = me@localhost.com