View previous topic :: View next topic |
Author |
Message |
Maes Advanced Cheater
Reputation: 10
Joined: 09 Apr 2009 Posts: 50
|
Posted: Mon Jun 28, 2010 8:17 pm Post subject: PHP + Mysql |
|
|
I just got cold-hosting.org/
and I was looking for a script that would let users signup for a domain that would require a password to work.
I know its not ethical to ask others to make one, but I just used my birthday money for this, and want to hold small hosting for users I know.
|
|
Back to top |
|
 |
Freiza Grandmaster Cheater
Reputation: 22
Joined: 28 Jun 2010 Posts: 662
|
Posted: Mon Jul 19, 2010 2:39 pm Post subject: |
|
|
specify your requirements in detail.
php-mysql is mandatory? or any other scripting language will work.
|
|
Back to top |
|
 |
BOU Expert Cheater
Reputation: 0
Joined: 15 Apr 2009 Posts: 239 Location: Youtube watching Japanese Rock, and Korean Pop - Music Videos =)
|
Posted: Mon Jul 19, 2010 3:44 pm Post subject: |
|
|
Signup form (.html or anything you want)
Code: |
<form method="POST" action="register.php">
<input type="text" name="form_username">Username<br />
<input type="password" name="form_pw1">Password<br />
<input type="password" name="form_pw2">Re-type password<br />
</form>
|
register.php
Code: |
<?php
#CONNECT TO DATABASE#
#ysql_connect('DATABASE','USERNAME','PASSWORD');
mysql_connect('localhost','root','');
mysql_select_db('user_data'); //PUT IN THE DATABASE
$form_username=$_POST['form_username'];
$form_pw1=$_POST['form_pw1'];
$form_pw2=$_POST['form_pw2'];
if($form_username==''||$form_pw1==''||$form_pw2=''){
if($form_pw1==$form_pw2){
mysql_query("INSERT INTO (tablename) VALUES('','$form_username','$form_pw1')");
}else{
echo'Both passwords must be the same!';
}
}else{
echo'Please fill in all forms';
}
?>
|
with this, the MYSQL table should look like
ID | USERNAME | PASSWORD
1 | testuser1 | password
_________________
Rawr |
|
Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Mon Jul 19, 2010 5:38 pm Post subject: |
|
|
JPU666's method above is extremely vulnerable to injection, I would not suggest using it in a live environment.
There are tons of scripts on the net, and tutorials, explaining how to make a login system for a website. You should probably do your homework and learn how to do things before attempting to run a site.
_________________
- Retired. |
|
Back to top |
|
 |
|