Hello. everyone just a follow up as i work on this script.. its very secure adding with my other script which send a random number and there user name to a file.. this way they have to open there email, click a link to activate the account. and if the confirmation number isnt current the script wont add them and the number is random i used mt_rand which works great! but anyhow heres the script i came up with for adding a user BTW i fixed the fgetcvs issue by how i moved stuff around, re organized it the way it should be
<?php // Michael Deckard 2010 adduser.php
ini_set ('display_errors',1);
error_reporting (E_ALL & ~E_NOTICE);
$pack = $_GET['package'];
$problem = TRUE;
if(isset($_GET['config'])) {
if ($_GET['config'] == 'conf'){
$fp = fopen ('newer', 'rb');
while ( $line = fgetcsv($fp, 100, "\t")) {
if (($line[0] == $_GET['user']) AND ($line[2] == $_GET['num'])) {
$problem = FALSE;
fclose($fp);
break;
}
}
if (!$problem){
if ($pack == shell) {
$user = $_GET['user'];
$passwd = $_GET['pass'];
$md5pass = crypt($_GET['pass'],salt);
$final = str_replace('$', '\$', $md5pass);
$str5 = $final;
exec("sudo useradd -d /home/$user -s /bin/bash -p $str5 -m $user");
print 'Ftp And Shell access granted, username, password set';
} else {
$user = $_GET['user'];
exec("sudo useradd -d /home/$user -s /dev/null -p $str5 -m $user");
print 'Ftp Access granted public_html is the html directory';
}
}
}
if ($problem == TRUE){
print "<p>Confirmation number is wrong or info entered wrong try agian<p>";
}
} else {
print 'no info to send';
}
?>