Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //include config
- require_once('includes/adminconfig.php');
- //check if already logged in move to home page
- if( $user->is_logged_in() ){ header('Location: home.php'); }
- //process login form if submitted
- if(isset($_POST['submit'])){
- $username = $_POST['username'];
- $password = $_POST['password'];
- if($user->login($username,$password)){
- $_SESSION['username'] = $username;
- header('Location: home.php');
- exit;
- } else {
- $error[] = 'Wrong username or password or your account has not been activated.';
- }
- }//end if submit
- ?>
- <div class="container-fluid clearfix">
- <div class="registrationContent">
- <div class="registrationHeader">
- <form method="post" action="" autocomplete="off">
- <img class="center img-responsive" src="login.png" alt="Login Logo">
- </div>
- <!--registrationHeader-->
- <br>
- <div class="row inputWrapper ">
- <div class="col-md-12">
- <div class="col-md-12">
- <div class="left-inner-addon ">
- <i class="fa fa-user"></i>
- <input type="text" name="username" id="username" class="form-control" placeholder="Username">
- </div>
- <br>
- </div>
- <div class="col-md-12 ">
- <div class="left-inner-addon ">
- <i class="fa fa-key"></i>
- <input type="password" name="password" id="password" class="form-control" placeholder="Password">
- </div>
- <br>
- </div>
- <br>
- <p class=""> <span><a href="reset.php">Go Back to Main Site.</a></span></p>
- </div>
- </div>
- <div class="registrationButtonPlaseholder">
- <button type="submit" name="submit" class="btn btn-default btn-df float-button-dark waves-effect waves-button waves-float waves-dark">Login</button>
- </div>
- <br>
- </form>
- </div>
- <?php
- //include config
- require_once('includes/config.php');
- //check if already logged in move to home page
- if( $user->is_logged_in() ){ header('Location: index.php'); }
- //process login form if submitted
- if(isset($_POST['submit'])){
- $username = $_POST['username'];
- $password = $_POST['password'];
- if($user->login($username,$password)){
- $_SESSION['username'] = $username;
- header('Location: profile.php');
- exit;
- } else {
- $error[] = 'Wrong username or password or your account has not been activated.';
- }
- }//end if submit
- ?>
- <div class="form-group ">
- <div class="col-xs-12">
- <input class="form-control" id="username" name="username" type="text" placeholder="Username" value="<?php if(isset($error)){ echo $_POST['username']; } ?>" tabindex="1">
- </div>
- </div>
- <div class="form-group">
- <div class="col-xs-12">
- <input class="form-control" type="password" id="password" name="password" placeholder="Password">
- </div>
- </div>
- <div class="form-group ">
- <div class="col-md-7 col-xs-12 m-t-5 text-right"><a href="forgot.php" class="text-dark"><i class="fa fa-lock m-r-5"></i> Forgot your password?</a></div>
- </div>
- <div class="form-group text-center m-t-40">
- <div class="col-xs-12">
- <button class="btn btn-boom btn-login btn-lg btn-block text-uppercase waves-effect waves-light" name="submit" type="submit" >Log In</button>
- </div>
- </div>
- <div class="form-group m-t-30 m-b-0">
- <div class="col-sm-12 text-center">
- <p>Don't have an account? <a href="register.php" class="text-primary m-l-5"><b>Sign Up</b></a></p>
- </div>
- </div>
- </form>
- </div>
- <?php
- //include config
- include('includes/adminconfig.php');
- if(isset($_GET['delete_id']))
- {
- $stmt_select = $DB_con->prepare('SELECT userprofile FROM users WHERE userid =:uid');
- $stmt_select->execute(array(':uid'=>$_GET['delete_id']));
- $imgRow=$stmt_select->fetch(PDO::FETCH_ASSOC);
- unlink("user_images/".$imgRow['userprofile']);
- $stmt_delete = $DB_con->prepare('DELETE FROM users WHERE userid =:uid');
- $stmt_delete->bindParam(':uid',$_GET['delete_id']);
- $stmt_delete->execute();
- header("Location: home.php");
- }
- //if not logged in redirect to login page
- if(!$user->is_logged_in()){ header('Location: login.php?action=login'); }
- ?>
- <?php
- $stmt = $DB_con->prepare('SELECT userid, username, description, userprofile FROM users ORDER BY userid DESC');
- $stmt->execute();
- if($stmt->rowCount() > 0)
- {
- while($row=$stmt->fetch(PDO::FETCH_ASSOC))
- {
- extract($row);
- ?>
- <div class="col-xs-3">
- <h3 class="page-header" style="background-color:cadetblue" align="center"><?php echo $username."<br>".$description; ?></h3>
- <img src="uploads/<?php echo $row['userprofile']; ?>" class="img-rounded" width="250px" height="250px" /><hr>
- <p class="page-header" align="center">
- <span>
- <a class="btn btn-primary" href="editform.php?edit_id=<?php echo $row['userid']; ?>"><span class="glyphicon glyphicon-pencil"></span> Edit</a>
- <a class="btn btn-warning" href="?delete_id=<?php echo $row['userid']; ?>" title="click for delete" onclick="return confirm('Are You Sure You Want To Delete This User?')"><span class="glyphicon glyphicon-trash"></span> Delete</a>
- </span>
- </p>
- </div>
- <?php
- }
- }
- else
- {
- ?>
- <div class="col-xs-12">
- <div class="alert alert-warning">
- <span class="glyphicon glyphicon-info-sign"></span> No Data Found.
- </div>
- </div>
- <?php
- }
- ?>
- <?php
- ob_start();
- session_start();
- //set timezone
- date_default_timezone_set('Europe/London');
- //database credentials
- define('DBHOST','localhost');
- define('DBUSER','xxxxxxxx');
- define('DBPASS','xxxxxxxx');
- define('DBNAME','xxxxxxx');
- //application address
- define('DIR','http://websiteaddress.com');
- define('SITEEMAIL','noreply@domain.com');
- try {
- //create PDO connection
- $db = new PDO("mysql:host=".DBHOST.";dbname=".DBNAME, DBUSER, DBPASS);
- $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- } catch(PDOException $e) {
- //show error
- echo '<p class="bg-danger">'.$e->getMessage().'</p>';
- exit;
- }
- //include the user class, pass in the database connection
- include('classes/adminuser.php');
- include('classes/phpmailer/mail.php');
- $user = new User($db);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement