<?php
$name=trim($_POST['customername']);
$tel=trim($_POST['usertel']);
$email=trim($_POST['useremail']);
$city=trim($_POST['customercity']);
$job=trim($_POST['userjob']);
$username=trim($_POST['username']);
include_once("config.php");
$Tablename="usersinfo";
$db_link = mysql_connect($location, $mysql_user, $mysql_password) or die("error in connectiong to db" .mysql_error());
mysql_select_db($database, $db_link) or die("error in selecting db" .mysql_error());
$query=("insert into $Tablename values ('','".$username."','".$name"','".$tel"',.'".$email"','".$city"','".job"')");
$result=mysql_query($query) or die("error in sending request");
function generatePassword($length=9, $strength=0)
{
$vowels = 'aeuy';
$consonants = 'bdghjmnpqrstvz';
if ($strength & 1) {
$consonants .= 'BDGHJLMNPQRSTVWXZ';
}
if ($strength & 2) {
$vowels .= "AEUY";
}
if ($strength & 4) {
$consonants .= '23456789';
}
if ($strength & 8) {
$consonants .= '@#$%';
}
$password = '';
$alt = time() % 2;
for ($i = 0; $i < $length; $i++)
{
if ($alt == 1)
{
$password .= $consonants[(rand() % strlen($consonants))];
$alt = 0;
}
else {
$password .= $vowels[(rand() % strlen($vowels))];
$alt = 1;
}
}
$_SESSION['pass']= $password;
return ($_SESSION ['pass']);
}
generatePassword();
$pas=$_SESSION['pass'];
if('$result'){
$_SESSION['rightuser']=$username;
echo '3';
}
else{
echo '4';
}
?>