Jump to content

nathanvolker123

New Members
  • Posts

    1
  • Joined

  • Last visited

nathanvolker123's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I need help im building a website that is around social networking. each user has their own profile page. I have my registering code done. But now i want to add into it where when a user registers it adds a folder for them by their username. for example on my database side I have a folder called user. So when EX: Johnny registers then under that folder user he will have a folder for him called Johnny. Inside of johnnys folder is where I want to store his Pics ETC. The code I currently have is this just dont know how to make this mkdir happen. Please any response will help. <?php $submit = $_POST['submit']; // form data $fullname = strip_tags($_POST['fullname']); $username = strip_tags($_POST['username']); $password = strip_tags($_POST['password']); $confirmpassword = strip_tags($_POST['confirmpassword']); $date = date("Y-m-d"); if($submit) { //connect to database $connect = mysql_connect("XXXX", "XXXX", "XXXX"); mysql_select_db("XXXX"); $namecheck = mysql_query("SELECT username FROM user WHERE username='$username'"); $count = mysql_num_rows($namecheck); if ($count!=0) { die("Username is already taken!"); } // check for existance if($fullname&&$username&&$password&&$confirmpassword) { if($password==$confirmpassword) { if (strlen($username)>25||strlen($fullname)>25) { echo "Length of username or full name is too long!"; } else { if (strlen($password)>25||strlen($password)<6) { echo "Your password must be between 6 and 25 characters!"; } else { //register the user // encrypt password $password = md5($password); $confirmpassword = md5($confirmpassword); $queryreg = mysql_query(" INSERT INTO user VALUES('','$fullname','$username','$password','$date') "); die("You've successfully registered! <a href='index.php'>Click here to return to the login page!</a>"); } } } else echo "Your password does not match!"; } else echo "Please enter all fields!"; } ?> <html> <head> <meta charset="UTF-8"> <title>My Web Page</title> <link rel="stylesheet" href="style/style.css"> </head> <?php include_once("templates/template_pageTop.php"); ?> <body> <div id="pageMiddle"> <?php echo "<h1>Sign Up</h1>"; ?> <p> <form action='register.php' method='POST'> <table> <tr> <td> Full Name: </td> <td> <input type='text' name='fullname' value='<?php echo $fullname ?>'> </td> </tr> <tr> <td> Username: </td> <td> <input type='text' name='username' value='<?php echo $username ?>'> </td> </tr> <tr> <td> Password: </td> <td> <input type='password' name='password'> </td> </tr> <tr> <td> Confirm Password: </td> <td> <input type='password' name='confirmpassword'> </td> </tr> </table> <p> <input type='submit' name='submit' value='Create Account'> </form> </div> <?php include_once("templates/template_pageBottom.php"); ?> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.