?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?PHP Login screen with functionality
Author:??(---.server.ntli.net)
Date:???01-11-04 09:44

Hi, i have a quick question. I am trying to build and easy login screen with username and password using PHP. The login screen should contain client side checking written in javascript and it should be able to perform server side checking. Do you know how i can do this? I am using Dreamweaver which has PHP functionality built in.

Thanks

?Re: PHP Login screen with functionality
Author:??(209.250.16.---)
Date:???01-11-04 12:18

This question is somewhat vague? Can you be a little more specific about a PHP question you are having? In general your form will have an action="{some php script}" and method="post". You can add an onsubmit attribute to the form and specify a javascript function that checks for things like fieldname.value!='' and returns false if those checks fail. The php script can compare the values against hard coded ones, or a database, or a text file. Check out some of the webmonkey.com PHP tutorials. At least one deals with login scripts.

?Re: PHP Login screen with functionality
Author:??(---.server.ntli.net)
Date:???01-11-04 13:05

i wanted to create a basic login screen using php and client-side checking written in javascript and also som server side checking. Can give me some examples on how i will be able to create. I have dreamweaver and PHPDEV5. thanks

?Re: PHP Login screen with functionality
Author:??(66.62.43.---)
Date:???01-12-04 07:43

Yes, go here:
www.webmonkey.com
Look under programming, PHP. There may be other places to find online examples.

In particular try these:
http://hotwired.lycos.com/webmonkey/01/48/index2a.html?tw=programming

http://hotwired.lycos.com/webmonkey/programming/php/tutorials/tutorial4.html

http://hotwired.lycos.com/webmonkey/00/05/index2a.html?tw=programming

And try Julie Meloni's site (author of last link above):
http://www.thickbook.com/

Phil

?Re: PHP Login screen with functionality
Author:??(---.server.ntli.net)
Date:???01-14-04 06:49

ignore the earlier question this is where i am at: i have connected PHP to Access and created a login screen

$odbc = odbc_connect ('PHP Login', 'root', '') or die( "Could Not Connect to ODBC Database!" );
?>
//get variables from login screen.mdb
$user = $_POST['user'];
$pass = $_POST['pass'];
$sql = "SELECT * FROM login screen WHERE username_column = 'user" . $_POST['username'] . "' AND password_column = 'pass" . $_POST['password'] . "'"

also do u know how i can do a process.php script as i dont know if what i am doing is a process.php? Also how can i verify users and redirect them to a website? thanx

?Re: PHP Login screen with functionality
Author:??(66.62.43.---)
Date:???01-14-04 06:56

The code you have above would be appropriate in a process.php script. If you have login.php with a form pointing to process.php you would put your sql above into process. Then it's a matter of running the query and seeing of you got a row back.

$query=odbc_exec($odbc, $sql);
if (odbc_num_rows($query)) {
????header("Location: user.php");
????exit();
} else {
????echo "you can't log in.";
}

?Re: PHP Login screen with functionality
Author:??(---.server.ntli.net)
Date:???01-14-04 07:52

Thanx. so far this is what i have done: I put everything into one place:


Username



Password





$odbc = odbc_connect ('PHP Login', 'root', '') or die( "Could Not Connect to ODBC Database!" );
?>
//get variables from login screen.mdb
$user = $_POST['user'];
$pass = $_POST['pass'];
$sql = "SELECT * FROM login screen WHERE username_column = 'user" . $_POST['username'] . "' AND password_column = 'password" . $_POST['password'] . "'"

?>

so do i need to create a new file and put the script you gave me in there or can i somehow fit it in here? Please make any modifications to the code. Thanx

?Re: PHP Login screen with functionality
Author:??(---.server.ntli.net)
Date:???01-14-04 07:53

Thanx. so far this is what i have done: I put everything into one place:


Username



Password





$odbc = odbc_connect ('PHP Login', 'root', '') or die( "Could Not Connect to ODBC Database!" );
?>
//get variables from login screen.mdb
$user = $_POST['user'];
$pass = $_POST['pass'];
$sql = "SELECT * FROM login screen WHERE username_column = 'user" . $_POST['username'] . "' AND password_column = 'password" . $_POST['password'] . "'"

?>

so do i need to create a new file and put the script you gave me in there or can i somehow fit it in here? Please make any modifications to the code. Thanx

?Re: PHP Login screen with functionality
Author:??(66.62.43.---)
Date:???01-14-04 08:05

Put my code above after your last line, but before the last ?>

The form should be one file (form.php) and from

?Re: PHP Login screen with functionality
Author:??(---.server.ntli.net)
Date:???01-14-04 08:17

Hi, i did it and it came up with this error: Parse error: parse error, unexpected T_VARIABLE in c:\phpdev5\www\tmp87y5urhohs.php on line 15

where am i going wrong?

?Re: PHP Login screen with functionality
Author:??(---.server.ntli.net)
Date:???01-14-04 08:20

It worked so far this is what i have:

Username



Password





//get variables from login screen.mdb
$user = $_POST['user'];
$pass = $_POST['pass'];
if (odbc_num_rows($query)) {
header("Location: process.php");
exit();
} else {
echo "you can't log in.";
}
?>

it worked but this is the error:

Warning: odbc_num_rows(): supplied argument is not a valid ODBC result resource in c:\phpdev5\www\tmp8egm1rhoq8.php on line 14
you can't log in.

?Re: PHP Login screen with functionality
Author:??(---.server.ntli.net)
Date:???01-14-04 08:27

Hi one more question, i heard that ODBC_NUM_ROWS dont work with access also, how do i validate users and when validated, take them to a website? thanks for your contributions so far

?Re: PHP Login screen with functionality
Author:??(66.62.43.---)
Date:???01-14-04 09:20

You might try doing a while loop through the result set (1 row) and setting $login_ok=1 inside the while {}.

Then you could do if ($login_ok) { ... log in etc. } else { echo "you can't log in!"; } or something like that.

As for your error on line 15, what is the entire script? Are you puttting it into 2 files like recommended?

?Code for mysql+php+login
Author:??(---.campus.uaic.ro)
Date:???02-10-04 04:15

I need a code for a login form,using mysql and php

?Re: Code for mysql+php+login
Author:??(66.62.43.---)
Date:???02-10-04 07:49

Roxana, go here:

www.webmonkey.com

Look under programming, PHP. There may be other places to find online examples.

In particular try these:
http://hotwired.lycos.com/webmonkey/01/48/index2a.html?tw=programming

http://hotwired.lycos.com/webmonkey/programming/php/tutorials/tutorial4.html

http://hotwired.lycos.com/webmonkey/00/05/index2a.html?tw=programming

And try Julie Meloni's site (author of last link above):
http://www.thickbook.com/

?Re: PHP Login screen with functionality
Author:??(---.nyc.rr.com)
Date:???02-27-04 10:30

I would like to create a login screen for my web page. it will have two sections. one for friends and other for public.
could i have the codes for it.

thanks

Go to Top??|??Go to Topic??|??Threaded View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??

Provided By
Phorum