Jump to content
xisto Community
Sign in to follow this  
shadowdemon

? About A Code

Recommended Posts

this is about a code for people to joincould i make it so$loginName="have a text box here for people to type info in"$password=""another text box"then use the insert code to insert it into the table for members would that work as the code to have people to join my website

Share this post


Link to post
Share on other sites

Well that is the idea behind the code, yes. But there is a lot more that is involved in getting people to sign up for your site.For one, you need to run a check to make sure that the username and password are alpha numeric (only letters and numbers) to make sure that no one can use it to screw up your site.Secondly you need to take the username that they specify and check it against the database to see if someone has already used that username.If you want them to be able to log in with the same to input spots then your goin to need to check if the username already exists and if it does then u have to check to see if the password is right.If all you want to do is use those two lines to let users only sign up then you need to ( IF the username doesnt already exist) store both of them in the database.A good thing to do tho is to ask for thier email and send a verification code to that email that will allow them to activate thier accounts. Otherwise you could get people signing up with random information for random reasons and it will flood your site.Also in order to get that code to work right your going to need to learn how to use PHP with HTML forms and have the users info get sumbitted to a page (could be the same page if u want) that will manipulate the variables that are passed to the code.That should get u started at least =)I would suggest getting the PHP/MYSQL Visual QuickStart Guide from Amazon.com. It has a whole section that will teach you and show u the code involved in creating login/registration pages.Cheers :ph34r:

Share this post


Link to post
Share on other sites

If it was me, I would just use a script from hotscripts.com. But if you really want to do this, you should at least think of a way to encrypt your users' passwords to prevent them from "not trusting you"

Share this post


Link to post
Share on other sites

like hows this code

<?php /*
+---------------------------------------+
|Gamers-Fusion V3
|||||||||||||||||||||||||||||||||||||||||
|By Gamers-Fusion Dev Team (Splat1)
|LGPL © 2003 Gamers-Fusion Dev Team
|http://forums.xisto.com/no_longer_exists/
|||||||||||||||||||||||||||||||||||||||||
|Release V3-BETA1
|Date Nov-03
+---------------------------------------+
|Modfications:
|dan
|
|Modfication Version: 0.1
|Date: some date
+---------------------------------------+
*/

$checksum = "<!-- SMARTY CHECK SUM )!!^\"\"$*$$$ -->";
print "$checksum";
include("head.php");
$nump = mysql_num_rows(mysql_query("select * from players"));
if ($action == register) {
if (!$user || !$email || !$vemail ) {
$smarty->assign('error', 'Fill out all the feilds');
$smarty->display('failed.tpl');
exit;
}
$dupe1 = mysql_num_rows(mysql_query("select * from players where user='$user'"));
if ($dupe1 > 0) {
$smarty->assign('error', 'User name taken');
$smarty->display('failed.tpl');
exit;
}
$dupe2 = mysql_num_rows(mysql_query("select * from players where email='$email'"));
if ($dupe2 > 0) {
$smarty->assign('error', 'E-mail taken');
$smarty->display('failed.tpl');
exit;
}
if ($email != $email) {
$smarty->assign('error', 'E-mail addresses do not match');
$smarty->display('failed.tpl');
exit;
}
$ref = strip_tags($ref);
$user = strip_tags($user);
$email = strip_tags($email);
if ($ref) {
  mysql_query("update players set refs=refs+1 where id=$ref");
}
$pass = rand(10000 , 99999);
$message = "welcome to $gamename your pass is $pass login now and change it. have fun playing at $gamename. Webmaster";
  mail("$email", "$gamename", $message,
    "From: webmaster@{$gamename}\r\n"
    ."Reply-To: webmaster@{$gamename}\r\n"
    ."X-Mailer: PHP/" . phpversion()) or die("could not send mail");
    include("blowfish.php");
    $pass = GF_blowfish_encrypt($pass,$blowfish_secret);
    mysql_query("insert into players (user, email, pass) values('$user','$email','$pass')") or die("Could not register.");
}


$smarty->assign('action', $action);
$smarty->assign('nump', $nump);
$smarty->assign('ref', $ref);
$smarty->assign('user',$user);
$smarty->assign('email',$email);
$smarty->display('register.tpl');
?>


Share this post


Link to post
Share on other sites

You cant cut and past login scripts like that

 

Not only is it not really ethical but its nothing like what you need.

 

I would say that if you click this link right here you will find a book that will guide you through the entire process of creating a secure page that will let users sign up and log in and all that good stuff.

 

And the other guy was right... you need to make people "trust" your login stuff - especially with all the identity theft goin around.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.