how do i make a login and register form and when you login it shows you name that you are loged in with?
how do i make a login and register form and when you login it shows you name that you are loged in with?
That's PHP. But if you just want a saved cookie (no register), then you can just use Javascript cookies.
And how do i go by doing that?
Well, if you don't use a register thing, you use PHP to set a cookie that has the name, then display it wherever you want, like Welcome, NAME! (logout|settings) or something like that. I can't teach you PHP, go learn it here: http://w3schools.com/php/default.asp
For a register thing, it's the same thing, use a cookie to save that fact that you're logged in, but store the username and passwords in a database. That's mysql, and i think they teach some of that in the link.
Javascript can't and won't be secure. It won't be security in any way nor would it help you store information about the user, create an account, etc.
the only thing it could do is give the appearence of a login, which, unless it's just for fun, won't do you much good.
PHP is fairly complex, so dive right in and get to it. It's not so bad to learn about.
Basically... you need to use a database and store the user/(encrypted) password in there to compare to the values entered in a form.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
I did not create this post... but I am also in search of a secure way to do this. I just don't know where to get started, how do I learn what I need to know?
There is a way to do it with just PHP, but most people use a PHP/MySql database.
You could save the register settings into a file:
the html would be:Code:<?php $filename = 'userfile.txt'; $user = $_POST["user"]; $pass = $_POST["pass"]; $adduser = "User: $user\nPass: $pass\n\n"; if (is_writable($filename)) { if (!$handle = fopen($filename, 'm')) { echo "Cannot open file ($filename)"; exit; } if (fwrite($handle, $adduser) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Task complete."; fclose($handle); } else { echo "Entry failed."; } ?>
And call it laterCode:<form action="thefileabove.php"> <input name="user"> <br><input name="pass"> <br><input type="submit"> </form>
Last edited by mburt; 10-19-2006 at 10:37 PM.
- Mike
http://www.twey.co.uk/?q=loginscript is a pretty basic pre-made one. Requires PHP and MySQL.
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Bookmarks