Darkness3477
March 18th, 2006, 10:41 PM
Hello everyone, yesterday my friend asked me to help him with a website.
What he asked was if I could show him how to make a website that allowed people to sign up, for him to validate or reject the people signing up, then those people who were validated could reach a members only area when signed in.
Now, I though straight away that PHP and Mysql would be the easiest way to do this, but I could be wrong. Now, not knowing much PHP I though I would find some source code, and perhaps tweak and edit it for his own needs, when I know a little bit more.
Now, I've found a good website (http://www.free2code.net/plugins/articles/read.php?id=99) that has a nice straight forward what-to-do on. Now, for those of you who are on the site, it's the first bit of code on the site, and those of you who are not on there, I'll post it:
<?php
//require the PEAR::DB classes.
require_once 'DB.php';
$db_engine = 'mysql';
$db_user = 'username';
$db_pass = 'password';
$db_host = 'localhost';
$db_name = 'database';
$datasource = $db_engine.'://'.
$db_user.':'.
$db_pass.'@'.
$db_host.'/'.
$db_name;
$db_object = DB::connect($datasource, TRUE);
/* assign database object in $db_object,
if the connection fails $db_object will contain
the error message. */
// If $db_object contains an error:
// error and exit.
if(DB::isError($db_object)) {
die($db_object->getMessage());
}
$db_object->setFetchMode(DB_FETCHMODE_ASSOC);
// we write this later on, ignore for now.
include('check_login.php');
?>
The site then says "There are various things you will have to customize
* $db_engine - Your database engine, a list of possible values is below.
* $db_user - Your username to access the database.
* $db_pass - Your password.
* $db_host - The host of the database server.
* $db_name - The name of the database to connect to."
Well, I know I have apache and PHP on my computer, and I'm almost positive I did a full lamp and got MySQL as well, but I don't ever rememer having to set up a username and password for the database. ANd the host of the databse server, well I'm doing it on my computer to test it out first, so what do I put? And I'm not sure what the databse name is, or which one I need to connect too. So, A little bit of help would be excellent and much appreciated.
What he asked was if I could show him how to make a website that allowed people to sign up, for him to validate or reject the people signing up, then those people who were validated could reach a members only area when signed in.
Now, I though straight away that PHP and Mysql would be the easiest way to do this, but I could be wrong. Now, not knowing much PHP I though I would find some source code, and perhaps tweak and edit it for his own needs, when I know a little bit more.
Now, I've found a good website (http://www.free2code.net/plugins/articles/read.php?id=99) that has a nice straight forward what-to-do on. Now, for those of you who are on the site, it's the first bit of code on the site, and those of you who are not on there, I'll post it:
<?php
//require the PEAR::DB classes.
require_once 'DB.php';
$db_engine = 'mysql';
$db_user = 'username';
$db_pass = 'password';
$db_host = 'localhost';
$db_name = 'database';
$datasource = $db_engine.'://'.
$db_user.':'.
$db_pass.'@'.
$db_host.'/'.
$db_name;
$db_object = DB::connect($datasource, TRUE);
/* assign database object in $db_object,
if the connection fails $db_object will contain
the error message. */
// If $db_object contains an error:
// error and exit.
if(DB::isError($db_object)) {
die($db_object->getMessage());
}
$db_object->setFetchMode(DB_FETCHMODE_ASSOC);
// we write this later on, ignore for now.
include('check_login.php');
?>
The site then says "There are various things you will have to customize
* $db_engine - Your database engine, a list of possible values is below.
* $db_user - Your username to access the database.
* $db_pass - Your password.
* $db_host - The host of the database server.
* $db_name - The name of the database to connect to."
Well, I know I have apache and PHP on my computer, and I'm almost positive I did a full lamp and got MySQL as well, but I don't ever rememer having to set up a username and password for the database. ANd the host of the databse server, well I'm doing it on my computer to test it out first, so what do I put? And I'm not sure what the databse name is, or which one I need to connect too. So, A little bit of help would be excellent and much appreciated.