Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require_once('dbconfig/config.php');
- //phpinfo();
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Sign Up Page</title>
- <link rel="stylesheet" href="css/registeradmin.css">
- </head>
- <body>
- <div id="main-wrapper">
- <center><h1 class="logintitle">Identifikohuni</h1></center>
- <form action="registeradmin.php" method="post">
- <div class="inner_container">
- <input class="login-input" type="text" placeholder="Fusni Username" name="username" required> <br>
- <input class="login-input" type="password" placeholder="Fusni password-in" name="password" required> <br>
- <input class="login-input" type="password" placeholder="Konfirmo Password-in" name="cpassword" required><br>
- <input class="login-input" type="text" name="psig" placeholder="Pyetja e sigurise ">
- <button name="registeradmin" class="login-button" type="submit">Rregjistrohu</button>
- <a href="index.php"><button type="button" class="login-button"><< Kthehu ne fillim</button></a>
- </div>
- </form>
- <?php
- if(isset($_POST['registeradmin']))
- {
- @$username=$_POST['username'];
- @$password=$_POST['password'];
- @$cpassword=$_POST['cpassword'];
- @$psig=$_POST['psig'];
- if(($password == $cpassword) && ($psig === '123'))
- {
- $query = "select * from admin where user='$username'";
- $query_run = mysqli_query($con,$query);
- //echo mysql_num_rows($query_run);
- $numero = " select count (user) from admin ";
- $numero_run = mysqli_query($con, $numero);
- if(($query_run) &&($numero_run))
- {
- if(mysqli_num_rows($query_run)>0)
- {
- echo '<script type="text/javascript">alert("This Username Already exists.. Please try another username!")</script>';
- }
- elseif (mysqli_num_rows($numero_run)>1) {
- echo '<script type="text/javascript">alert("there cant be more than 1 user registred ")</script>';
- }
- else
- {
- $query = "insert into admin values('$username','$password')";
- $query_run = mysqli_query($con,$query);
- if($query_run)
- {
- echo '<script type="text/javascript">alert("User Registered.. Welcome")</script>';
- $_SESSION['username'] = $username;
- $_SESSION['password'] = $password;
- header( "Location: homepage.php");
- }
- else
- {
- echo '<p class="bg-danger msg-block">Registration Unsuccessful due to server error. Please try later</p>';
- }
- }
- }
- else
- {
- echo '<script type="text/javascript">alert("DB error")</script>';
- }
- }
- else
- {
- echo '<script type="text/javascript">alert("Password-et nuk perputhen ose pyetja e sigurise gabim")</script>';
- }
- }
- ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement