Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- upload page --!>
- <?php
- include("connect.php");
- $_SESSION['username'];
- $username = $_SESSION['username'];
- if ($_POST['submit'])
- {
- $name = $_FILES['myfile']['name'];
- $tmp_name = $_FILES['myfile']['tmp_name'];
- if ($name)
- {
- // start upload procress
- $location = "avatars/$name";
- move_uploaded_file($tmp_name,$location);
- if ($name)
- if ($name)
- $query = mysql_query("UPDATE users SET imagelocation='$location' WHERE username='$username'");
- die("your avatar has been uploaded! <a href='view.php'>Home</a>");
- }
- else
- echo "please choose your avatar";
- }
- echo "<p>welcome, ".$username."!<p>";
- echo "upload your image:
- <form action='upload.php' method='POST' enctype='multipart/form-data'>
- File: <input type='file' name='myfile'> <input type='submit' name='submit' value='upload'>
- </form> ";
- ?>
- <!-- upload page end--!>
- <!-- register page --!>
- <?php
- echo "<h1>Register</h1>";
- $submit = $_POST['submit'];
- $fullname = strip_tags ($_POST['fullname']);
- $username = strip_tags ($_POST['username']);
- $password = strip_tags ($_POST['password']);
- $repeatpassword = strip_tags ($_POST
- ['repeatpassword']);
- $date = date("Y-m-d");
- if ($submit)
- {
- // check for existance
- if
- ($fullname&&$username&&$password&&$repeatpassword
- )
- {
- if ($password==$repeatpassword)
- {
- if (strlen ($username)>25||strlen ($fullname)>25)
- {
- echo "Lenght of username or fullname is too long";
- }
- else
- {
- if (strlen ($password)>32||strlen ($password)<4)
- {
- echo "Password must be between 4 and 32 characters";
- }
- else
- {
- // register user
- $password = md5 ($password);
- $repeatpassword = md5 ($repeatpassword);
- // open database
- $connect = mysql_connect("localhost","root","");
- mysql_select_db ("phpacademy");
- $queryreg = mysql_query("
- INSERT INTO users VALUES
- ('','$fullname','$username','','$password','$date')
- ");
- die ("you have been registered! <a href='index.php'>Click
- here</a> to login");
- }
- }
- }
- else
- echo "your passwords doesnt match";
- }
- else
- echo "Please fill in <b>all</b> fields!";
- }
- ?>
- <html><legend><b>Lol you noob aren't even registered
- </b></legend><p>
- <form
- action='register.php' method='POST'>
- <table
- border=\"0\" width=\"510\">
- <tr>
- <td>
- Your full name:
- </td>
- <td>
- <input type='text'
- name='fullname' value='<?php echo $fullname; ?>'>
- </td>
- </tr>
- <tr>
- <td>
- Choose a username:
- </td>
- <td>
- <input type='text'
- name='username' value='<?php echo $username; ?>'>
- </td>
- </tr>
- <tr>
- <td>
- Choose a password:
- </td>
- <td>
- <input type='password'
- name='password'>
- </td>
- </tr>
- <tr>
- <td>
- Repeat your password:
- </td>
- <td>
- <input type='password'
- name='repeatpassword'>
- </td>
- </tr>
- </table>
- <p>
- <input type='submit' name='submit' value='Register'>
- </form>
- </html>
- <--register page end-->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement