that's easy to do...i could do one, but i need to know where the script gets all user names and passwords from...from a database to check if they are really hosting members ?![]()
Does ne1 know how to make a php or perl script that is like host.sk's createdb.php ? i tryed to make my own but failed miserably, and the person that gives me this script will have there name and website on the bottom of the script , i will prolly have lots of traffic to this page![]()
Insert lame joke here.
that's easy to do...i could do one, but i need to know where the script gets all user names and passwords from...from a database to check if they are really hosting members ?![]()
Last edited by hohoho; June 9th, 2002 at 02:23.
There are 3 kinds of people: the ones who can count and the others who cannot
ok...my script is nearly finished...it creates a db called PLDusername, and it creates a mysql user(same username/pass) with rights only in this database![]()
There are 3 kinds of people: the ones who can count and the others who cannot
thnx u so much mitja ! all the usernames and passwords are stndard UNIX usernames and passwords so there is no database,
Insert lame joke here.
hmm, i never worked with UNIX/Linux
but it should look like this if it was in a database...you can edit it beause i don't know how it works with unix users...
I tested it on my computer and it workedPHP Code:<?
if(isset($submit))
checkuser($username, $password);
else {
echo "<form action=$PHP_SELF method=post>
Username: <input name=username><br>
Password: <input type=password name=password><br>
<input type=submit name=submit value=Submit><input value=Reset type=reset></form>";
}
function checkuser($username, $password) {
$sqlserver = "localhost"; // You NEED to change these 3 variables
$sqluser = "user"; // an mysql user who has all rights
$sqlpass = "pass"; // his password
$link = mysql_connect ($sqlserver, $sqluser, $sqlpass)
or exit ("Couldn't connect to Database Server");
$res = mysql_db_query("users", "SELECT * FROM members");
$num = mysql_num_rows($res);
for($i=0;$i<$num;$i++)
{
$user = mysql_result($res, $i, "user");
$pass = mysql_result($res, $i, "pass");
$password2 = md5($password);
if(strcmp($username, $user)==0 && strcmp($password2,$pass)==0)
createdb($user, $password);
exit;
}
}
function createdb($user, $pass) {
$datab = "PLD$user";
if (mysql_query("CREATE DATABASE $datab")) {
print ("Database was created sucessfully\n");
} else {
printf ("Error: %s\n", mysql_error ());
}
$sql = "GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON $datab.* TO $user@localhost IDENTIFIED BY '$pass'";
mysql_query($sql);
}
?>![]()
There are 3 kinds of people: the ones who can count and the others who cannot
i dont need user checking as the script will be secured with .htaccess , what would the code be that just creates a db and user with the filled out info (the entire chking process cut out)
Insert lame joke here.
it's this funtion:
PHP Code:function createdb($user, $pass) {
$datab = "PLD$user";
if (mysql_query("CREATE DATABASE $datab")) {
print ("Database was created sucessfully\n");
} else {
printf ("Error: %s\n", mysql_error ());
}
$sql = "GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON $datab.* TO $user@localhost IDENTIFIED BY '$pass'";
mysql_query($sql);
}
There are 3 kinds of people: the ones who can count and the others who cannot
ok but , how do i take the info from the form
and change it to $user and $passPHP Code:echo "<form action=$PHP_SELF method=post>
Username: <input name=username><br>
Password: <input type=password name=password><br>
<input type=submit name=submit value=Submit><input value=Reset type=reset></form>";
}
would it be
?PHP Code:
$user = username
$pass =password
plz help
Insert lame joke here.
hmmm..i don't really know what you mean, but i think it should look like this
PHP Code:<?
if(isset($submit))
createdb($username, $password);
else {
echo "<form action=$PHP_SELF method=post>
Username: <input name=username><br>
Password: <input type=password name=password><br>
<input type=submit name=submit value=Submit><input value=Reset type=reset></form>";
}
function createdb($username, $password) {
$datab = "PLD$user";
if (mysql_query("CREATE DATABASE $datab")) {
print ("Database was created sucessfully\n");
} else {
printf ("Error: %s\n", mysql_error ());
}
$sql = "GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON $datab.* TO $username@localhost IDENTIFIED BY '$password'";
mysql_query($sql);
}
?>
There are 3 kinds of people: the ones who can count and the others who cannot
with that code i get Error: Access denied for user: '@localhost' to database 'PLD'
Insert lame joke here.
oh, i forgot the mysql connection code...
PHP Code:<?
if(isset($submit))
createdb($username, $password);
else {
echo "<form action=$PHP_SELF method=post>
Username: <input name=username><br>
Password: <input type=password name=password><br>
<input type=submit name=submit value=Submit><input value=Reset type=reset></form>";
}
function createdb($username, $password) {
$sqlserver = "localhost"; // You NEED to change these 3 variables
$sqluser = "user"; // an mysql user who has all rights
$sqlpass = "pass"; // his password
$link = mysql_connect ($sqlserver, $sqluser, $sqlpass)
or exit ("Couldn't connect to Database Server");
$datab = "PLD$username";
if (mysql_query("CREATE DATABASE $datab")) {
print ("Database was created sucessfully\n");
} else {
printf ("Error: %s\n", mysql_error ());
}
$sql = "GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON $datab.* TO $username@localhost IDENTIFIED BY '$password'";
mysql_query($sql);
}
?>
There are 3 kinds of people: the ones who can count and the others who cannot
thnx works great now, thnx mitja ! (i made two little changes to thnx u)![]()
PHP Code:<?
if(isset($submit))
createdb($username, $password);
else {
echo "<form action=$PHP_SELF method=post>
Username: <input name=username><br>
Password: <input type=password name=password><br>
<input type=submit name=submit value=Submit><input value=Reset type=reset></form><br>
dbmake.php made by mitja";
}
function createdb($username, $password) {
$sqlserver = "localhost"; // You NEED to change these 3 variables
$sqluser = "user"; // an mysql user who has all rights
$sqlpass = "pass"; // his password
$link = mysql_connect ($sqlserver, $sqluser, $sqlpass)
or exit ("Couldn't connect to Database Server");
$datab = "PLD$username";
if (mysql_query("CREATE DATABASE $datab")) {
print ("Database was created sucessfully\n <br><br> dbmake.php made by mitja");
} else {
printf ("Error: %s\n", mysql_error ());
}
$sql = "GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON $datab.* TO $username@localhost IDENTIFIED BY '$password'";
mysql_query($sql);
}
?>
Insert lame joke here.
you can test the script now...i signed up for PLH and need a mysql database lol
There are 3 kinds of people: the ones who can count and the others who cannot
go to http://www.project-linux.org/dbmake.php to signup for dbs ! (Warning do not abuse this script i still need to put a .htaccess file on this to protect it
Insert lame joke here.
wow...it really works
if someone tries to abuse, then it will tell him the database already exists![]()
There are 3 kinds of people: the ones who can count and the others who cannot
Bookmarks