Hello, I am trying to create a membership system from PHP Freaks. I don’t know how to use phpmyadmin, and create a database and add the following to it:
[quote]
Let’s begin by creating a standard database structure for you to use. First, you may use phpMyAdmin or something that you are familiar with to create your databases. I use phpMyAdmin because it’s fairly easy to use and I don’t have to store any applications or use any command line stuff while on my computer. Simply create your own database and call it whatever you want. Inside that database, run this SQL statement.
[code=php]CREATE TABLE users (
userid int(25) NOT NULL auto_increment,
first_name varchar(25) NOT NULL default ”,
last_name varchar(25) NOT NULL default ”,
email_address varchar(25) NOT NULL default ”,
username varchar(25) NOT NULL default ”,
password varchar(255) NOT NULL default ”,
info text NOT NULL,
user_level enum(‘0′,’1′,’2′,’3’) NOT NULL default ‘0’,
signup_date datetime NOT NULL default ‘0000-00-00 00:00:00’,
last_login datetime NOT NULL default ‘0000-00-00 00:00:00’,
activated enum(‘0′,’1’) NOT NULL default ‘0’,
PRIMARY KEY (userid)
) TYPE=MyISAM COMMENT=’Membership Information’;
Also, since I skipped this to continue, I am stuck at what to do with this one code I was given. What do I name it and….does it go in another file??
[URL=http://www.phpfreaks.com/tutorials/40/4.php]Link here
[QUOTE]
Activating the Membership
This next step is to create a script that based upon the email we have sent the user with their information, we can activate the account by just calling the script. Here’s the script below:
[code=php]<?
/* Account activation script */
// Get database connection
include ‘db.php’;
// Create variables from URL.
$userid = $_REQUEST[‘id’];
$code = $_REQUEST[‘code’];
$sql = mysql_query(“UPDATE users SET activated=’1′ WHERE userid=’$userid’ AND password=’$code'”);
$sql_doublecheck = mysql_query(“SELECT * FROM users WHERE userid=’$userid’ AND password=’$code’ AND activated=’1′”);
$doublecheck = mysql_num_rows($sql_doublecheck);
if($doublecheck == 0){
echo “<strong><font color=red>Your account could not be activated!</font></strong>”;
} elseif ($doublecheck > 0) {
echo “<strong>Your account has been activated!</strong> You may login below!<br />”;
include ‘login_form.html’;
}
?>