|
    |
|
|
Creating a small registration script in PHP and MySQL
This tutorial will show you how to add a user to a MySQL users database using PHP. You will need only one file for this (assuming you already have a web server, PHP and MySQL installed and working). Create a new database named tempdb (if you don't know how, see http://phpmyadmin.net/). Inside the database create a table named users with 3 columns: `id`, INT(11), auto_increase, primary `username` VARCHAR(50) `password` VARCHAR(50) Now let's create the PHP file. Go to your web root folder and create a file called register.php Open it with your favorite text editor and type the following: <?php if($_POST) if( && $_POST['user'] && $_POST['pass']){ $conn=mysql_connect("localhost","root","MYSQLPASSWORD"); //replace MYSQLPASSWORD with you MySQL password $sql="INSERT INTO users VALUES (NULL,'$_POST[user]','$_POST[pass]')"; $sql2=mysql_query($sql) or die(mysql_error()); } else echo "you didn't supply both, username and password"; else echo "<form action=\"$_SERVER[PHP_SELF]\" method=post>User: <input type=text name=user><br>Pass: <input type=password name=pass><br><input type=submit></form>"; ?> That should be it. This is a simple tutorial which doesn't include checking if the user exists and so on. It may be that it also has some mistakes, don't hesitate to contact me if it does. |
|
 |
|
No reactions yet.
Please login or sign up to rate this intel.
Please login or sign up to add a comment.
The copyright for this content entitled "Creating a small registration script in PHP and MySQL" has been specified by the contributor as:
All Rights Reserved
This content may not be copied, distributed or adapted by anyone under any circumstances.
|
 |
May, 2012
2008
January, February, March, April, May, June, July, August, September, October, November, December
2009
January, February, March, April, May, June, July, August, September, October, November, December
2010
January, February, March, April, May, June, July, August, September, October, November, December
2011
January, February, March, April, May, June, July, August, September, October, November, December
2012
January, February, March, April, May
|
|
Not a member yet?
Qondio is a powerful network for making it online. If you have a website to
promote, we can help.
Sign up and get in on the action.
|
|
Welcome to Qondio! Discover the awesome power this network can deliver by going to our About page. Or you could skip straight to the Sign Up form.
|
|