Hello,
Im trying to create a directory for the user when the users signs up but its not creating a directory. Its signing the user up, sending the email etc but not creating the directory, am i doing something wrong. Below is the code to sign the user up.
<?php
include('connection.php');
if(isset($_POST['submit'])){
$first_name = stripslashes($_POST['first_name']);
$last_name = stripslashes($_POST['last_name']);
$e_mail = stripslashes($_POST['e_mail']);
$type = stripslashes($_POST['type']);
$password = stripslashes($_POST['password']);
$hashedpassword = password_hash($e_mail, $password);
$Query = "SELECT * from users where e_mail='".$e_mail."'";
$result=mysql_query($Query);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
if($count > 0){
$message = $e_mail." is already registered please try another e-mail";
$_SESSION['message'] =$message;
if($type==1){
header("location: ".DOMAIN."register");
}else{
header("location:".DOMAIN."adminpanel/adminregister");
}
}else{
$sql="INSERT INTO users (first_name, last_name, e_mail, password, type, is_confirmed) VALUES ('$first_name','$last_name','$e_mail','$hashedpassword','$type','0')";
// Make a directory for the users
mkdir("userpanel/images/".$e_mail."/");
mkdir("userpanel/images/".$e_mail."/private");
mkdir("userpanel/images/".$e_mail."/public");
if(mysql_query($sql))
{
$to = $e_mail;
$subject = "Registration Confirmation";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "From: no-reply@pictogate.co.uk" . "\r\n";
$message = "
<html>
<head>
<title>Registration Confirmation</title>
</head>
<body>
<p>Hello ".$first_name.",</p>
<p>You have sucessfully registers at pictogate.co.uk please verify your registration by clicking the following link</p>
<p><a href='".DOMAIN."functions/confirm?email=".$e_mail."'>Confirm your registration</a></p>
<p>Login Information:</p>
<p>User name: ".$e_mail."</p>
<p>Password: ".$password."</p>
</body>
</html>";
mail($to,$subject,$message,$headers);
$message = "Please complete the verification process by following the step mention in email we just sent you.";
$_SESSION['message'] =$message;
header("location: ".DOMAIN."login");
}else{
$message = 'error please try again';
$_SESSION['message'] =$message;
if($type==1){
header("location: ".DOMAIN."register");
}else{
header("location:".DOMAIN."adminpanel/adminregister");
}
}
}
}else{
header("location: ".DOMAIN);
}
?>