Advertisement
Guest User

Sahar Far

a guest
Sep 15th, 2014
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.95 KB | None | 0 0
  1. <?php
  2.  
  3.     require_once 'config.php';
  4.  
  5.     // Grab token from the URL
  6.     $token = $_GET['token'];
  7.  
  8.     // Search token in database and show informations of the user
  9.     $searchToken = $db->prepare('
  10.                                 SELECT * FROM users
  11.                                 WHERE token = :token
  12.     ');
  13.  
  14.     $searchToken->execute([
  15.                             'token' => $token
  16.     ]);
  17.  
  18.     $items = $searchToken->rowCount() ? $searchToken : [];
  19.  
  20. ?>
  21. <!DOCTYPE html>
  22. <html lang="en">
  23.     <head>
  24.         <meta charset="UTF-8">
  25.         <title>Document</title>
  26.     </head>
  27.     <body>
  28.         <?php if(!empty($token)): ?>
  29.             <?php if(!$searchToken->rowCount() == 0): ?>
  30.                 <?php foreach($items as $item): ?>
  31.                     <p><b>First name: </b><?=$item['first_name']?></p>
  32.                     <p><b>Last name: </b><?=$item['last_name']?></p>
  33.                     <p><b>E-Mail: </b><?=$item['email']?></p>
  34.                 <?php endforeach; ?>
  35.             <?php else: ?>
  36.                     <p>That user does not exist!</p>
  37.             <?php endif; ?>
  38.         <?php else: ?>
  39.             <p>Please fill token URL!</p>
  40.         <?php endif; ?>
  41.     </body>
  42. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement