How do you creat a website with member's area ?

TurtleMan

Golden Member
May 3, 2000
1,424
0
76
Hi all :D I am try to creat a website where I can creat account for my user to log in and place the goods they want with me
and there is no needs for any credit card transcation at all, i think it involed with cgi if im right
but does anyone any place that can show me some reference and how to do it ? or does my domain host place
support those function and have a built-in function i can use? all i need to know is how would I creat a member login place
and how do I received the information on the stuff they've choosed, do i get it via email or something ? thanks for the help! :]
 

TurtleMan

Golden Member
May 3, 2000
1,424
0
76
but i don't need forum tho, i need something like i have the power to set user login account, so i can give to the customer
so they can login to see the goods i have, and they can place the order with me, like for example those adult site, you need to log in first so you can view the member's area , i want to know how to creat such thing :\ thx !!
 

mugs

Lifer
Apr 29, 2003
48,920
46
91
Text

If all you want is forums, use Invision like the other guy said. Otherwise you gotta learn a scripting language. Or you could do it the ghetto way with .htaccess

Edit: If this is a really small-scale thing, then .htaccess would be the easiest way to go, as it wouldn't require you to learn PHP/ASP/PERL
 

mugs

Lifer
Apr 29, 2003
48,920
46
91
Originally posted by: TurtleMan
like if i need coldfusion to this ?

.... uh... k... it's unlikely ColdFusion will be supported by your web hosting service, because I think they charge for that. Most inexpensive web hosts run Linux servers, so they only really support PHP and PERL. out of those two, go with PHP. If you have no experience with programming, I recommend you pay someone else to do it.
 

yoda291

Diamond Member
Aug 11, 2001
5,079
0
0
if you know HTML, this should do it:

copy and paste the following code into a file called 'login.php':
//------BEGIN CODE---------
<?php
include("turtle.inc.php");
foreach($_POST as $value){
$value=stripslashes($value);
$value=mysql_escape_string($value);}

$db=mysql_connect("localhost", "$turtleusername", "$turtlepassword") or die ('SQL error: ' . mysql_error());
mysql_select_db ("turtlebase");
$querystring = "select username,password from users where username=$_POST[username] and password=$_POST[password] limit 1";
$query=mysql_query($querystring);
$myrow=mysql_fetch_assoc($query);

if(count($myrow)>0){
session_start();
$_SESSION[status]="logged";
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<html>
<head>
<title>Redirecting...</title>
<meta http-equiv=\"refresh\" CONTENT=0;URL=$tfirstpage>
</head><body></body></html>";
}else{die("improper login");}?>
//------END CODE------------

then make a file called 'install.php' with contents:
//----------BEGIN CODE----------
<?php
include("turtle.inc.php");
$db=mysql_connect("localhost", "$turtleusername", "$turtlepassword") or die ('SQL error: ' . mysql_error());
mysql_create_db("turtlebase");
mysql_select_db ("turtlebase");
$querystring = "select username,password from users where username=$_POST[username] and password=$_POST[password] limit 1";
$query=mysql_query("CREATE TABLE users (username VARCHAR(30) NOT NULL,password VARCHAR(30) NOT NULL)");
include("./index.html"};?>
//----------END CODE------------------------

rename every single MEMBERS' (ie, you should still have an index.html) page EXTENSION from htm or html to php. It won't futz with your layout...php is cool like that.

add the following line to every member's page at the VERY TOP of each MEMBERS' PAGE:
//-----BEGIN CODE------------
<?php session_start(); if($_SESSION[status]=="logged"){ ?>
//------END CODE-------------

add the following line to the very BOTTOM of every MEMBERS' page:
//---------BEGIN CODE--------
<?php }else{die("You are not logged in");} ?>
//------END CODE--------------

now make a file called 'turtle.inc.php' and paste the following code, filling in the necessary fields:
//------------BEGIN CODE-------------
<?php
$turtleusername="<USERNAME>"; // This is the name of a user for the mysql on your host
$turtlepassword="<PASSWORD>"; //This is the password for the user above
$tfirstpage="<FIRSTPAGE>"; /*This is the FIRST page a member should see after logging in. follow same convention as src attribute...like src=./filename.ext for current dir or ../filename.ext for parent dir...etc.*/
?>
//------------END CODE----------------

create a file called 'adduser.php' with the following:
//-----------BEING CODE-------------
<?php
include("turtle.inc.php");

if(isset($_POST[username]) && isset($_POST[password]))
{
$db=mysql_connect("localhost", "$turtleusername", "$turtlepassword") or die ('SQL error: ' . mysql_error());
mysql_select_db ("turtlebase");
$query=mysql_query("insert into users(username,password) values($_POST[username],$_POST[password])");
}
?>
<html><head><title>Adduser</title></head><body><form action=./adduser.php method=post>
username: <input type=text name=username>

password: <input type=text name=password>

<input type=submit></form>
</body></html>
//-----------END CODE-------------

now follow these instructions:
-make sure that ALL your site's pages are in the root of your site(same dir/folder that your index.html goes)
-double check the values in the file turtle.inc.php for correctness.
-double check that you modified all member pages
-copy all the files you just created into the root of your site.
-Move the old copies of your member's pages somewhere else...preferably off server but another folder would prolly work too.
-you should have a login.php, adduser.php, install.php, turtle.inc.php, your non-member pages with an htm or html or whatever extension they originally had, all your member's pages with a .php extension and the modifications from above.
-in a browser, type "http://yourdomain.com/install.php"

-your login should just be a form that you can put on ANY of your non-member pages that does the following:
it passes 2 pieces of data named "username" and "password" to the script called "login.php" using the post method.

-to add users to your site, goto "http://yourdomain.com/adduser.php"...there should be a self explanatory form there.
-just like your mom taught you, take adduser.php off the server when you don't need it.
-sorry this is so crude, but I'm on a public terminal that has a browser and word...so if anyone on ATOT sees a typo or goof, feel free to hack it off.
 

Ryan

Lifer
Oct 31, 2000
27,519
2
81
Why, you thinking of profeting off of your own nude webcam site?