Location: PHPKode > projects > Simple SMS Site Software > simple-sms-site-software/do_add_user.php
<?php 
/******************************************************************************
************** Simple SMS Site Software *********************************
************** SSSSv1.0*****************************************************
************** by (aq) limited http://aql.com *******************************
************** All Rights Reserved ******************************************
************** Please read COPYRIGHT file prior to modification********
********************************************************************************/
	
session_start();

$user = $_SESSION['user'];
$pass = $_SESSION['pass'];

include("inc/header.inc.php");

if ($access == "admin") {
	
	$newuser = $_POST['theUser'];
	$fullName = $_POST['theName'];
	$pass_in_words = $_POST['thePassword'];
	$newpass = md5($_POST['thePassword']);

	include("inc/options.inc.php");

	$add1 = $_POST['address1'];
	$add2 = $_POST['address2'];
	$add3 = $_POST['address3'];
	$postcode = $_POST['postcode'];

	$mobile = $_POST['theMobile'];
	$landline = $_POST['theLandline'];
	
	$email = $_POST['email'];
	
	$notes = $_POST['theNotes'];
	
	if ($_POST['theAdmin'] == "1")
		$admin = 'yes';
	else
		$admin = 'no';

	if ($_POST['theGuest'] == "1")
		$guest = 'yes';
	else
		$guest = 'no';
		
	$query = "SELECT * FROM users WHERE username LIKE '$newuser'";
	$result = mysql_query($query);
	$row = mysql_fetch_row($result);
	
	if ($row[0] == "") {
		$query = "INSERT INTO users VALUES ('$newuser','$newpass','$fullName','$notes','$add1','$add2','$add3','$postcode','$email','$mobile','$landline','$guest','$admin','$initial_credits','$account_locked')";
		mysql_query($query);

		?><p align="center"><?echo "User $newuser has been added";?></p><?
		mail($email, $signup_subject, $signup_contents, $from_header);
		if ($signup_notification == 'yes') {
			mail($admin_email, 'SMS site - new user', "User $newuser has signed up", $from_header);
		}	
	}
	else {
		?><p align="center"><?echo "User name $newuser already exists";?></p><?
	}
}
else {
	include("inc/restricted.inc.php");
}
include("inc/footer.inc.php");
?>
Return current item: Simple SMS Site Software