Hej alle sammen mit opret bruger system gider ikke at oprette brugeren og den gider heller ikke at uploade et billed.
Kode :
- <form action="register.php" name="login" method="post">
- <br />
- <?php
- if ($_POST) {
- $username = htmlentities($_POST['username']);
- $password = $_POST['password'];
- $SPS = $_POST['SPS'];
- $email = htmlentities($_POST['email']);
- $name = htmlentities($_POST['name']);
- $last = htmlentities($_POST['last']);
-
- /*IMG SETTINGS*/
- $img_name = $_FILES['img']['name'];
- $img_type = $_FILES['img']['type'];
- $img_size = $_FILES['img']['size'];
- $img_tmp = $_FILES['img']['tmp_name'];
- $ext = substr($img_name, strrpos($img_name, '.'));
-
- if ($username && $password && $SPS && $email && $name && $last) {
- if( $stmt = $mysqli->prepare("SELECT * FROM `users` WHERE username='$username' AND email='$email'")) {
- $stmt->bind_param('t', $_GET['username']);
- $stmt->execute();
- $result = $stmt->get_result();
- $row = $result->fetch_assoc();
- if ($row = 0) {
- $password = md5($password . $username . $salt);
- $password = sha1($password);
- $SPS = md5('s334sytgehnfyt3hrfen4' . $salt . 'feshnDE45r' . $password . $SPS);
- $SPS = sha1($SPS);
-
- /*Uploading image*/
-
- if ($img_name) {
- move_uploaded_file($img_tmp, "avatar/$username.$ext");
- $avatar = "avatar/$username.$ext";
- }
- echo $avatar;
- $date = date("Y/M/D h:i:s");
- $sql = "INSERT INTO `users`(`id`, `username`, `password`, `SPS`, `name`, `last_name`, `joined`, `bio`, `channel_name`, `channel_desc`, `group`, `profile_img`, `avatar`) VALUES (?,'$username','$password','$SPS','$name','$last','$date','','','','1','$avatar','')";
-
- if ($newuser = $mysqli->query($sql)) {
- echo 'You have a new user created, and you will also get a email from us.';
- } else {
- echo 'Can\'t insert data to the database.';
- }
- } else {
- echo 'The username or email is already in use!.';
- }
- }
- } else {
- echo 'All field with * is requried.';
- }
- }
- ?>
- <label for="username">Username *</label><br />
- <input type="text" name="username" id="username" placeholder="Write your username" /><label for="img" class="fakebtn">Profile image</label><br />
- <label for="password">Password *</label><br />
- <input type="password" name="password" id="password" placeholder="Write your password" /><br />
- <label for="SPS">Special password (can be anything) *</label><br />
- <input type="password" name="SPS" id="SPS" placeholder="Write your Speical password" /><br />
- <label for="email">Email *</label><br />
- <input type="email" name="email" id="email" placeholder="Write your email" /><br />
- <label for="name">Name *</label><br />
- <input type="text" name="name" id="name" placeholder="Write your name" /><br />
- <label for="last">Last name *</label><br />
- <input type="text" name="last" id="last" placeholder="Write your last name" /><br />
- <input type="file" name="img" id="img" style="display:none;" /><br /><br />
-
- <input type="submit" value="Register" />
- </form>