Advertisement
Guest User

is_this_code_sql_injectable

a guest
Oct 20th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.50 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html>
  3. <head>
  4.     <?php include('includes/head.php') ?>
  5.     <title>1334 NEWS</title>
  6. </head>
  7. <body>
  8.  
  9. <div id="container">
  10.  
  11.         <?php
  12.         include 'core/init.php';
  13.         protect_page();
  14.         include('includes/links.php');
  15.         include 'includes/aside.php';
  16.         include 'core/database/connect.php';
  17.         ?>
  18.        
  19.         <div id="content_L">
  20.            
  21.             <!--ARTICLE 1-->
  22.             <div class="box">
  23.                 <div class="title">
  24.                 <?php
  25.                 if (has_access($session_user_id, 1) === true) {
  26.                     echo 'Administration Center';
  27.                 } else {
  28.                     echo 'Website Members';
  29.                 }
  30.                 ?>
  31.                 </div><hr>
  32.                     <?php
  33.                     if (has_access($session_user_id, 1) === true) {
  34.                         include('menu.php');
  35.                     }
  36.                    
  37.                     include_once ('includes/function.php');
  38.  
  39.                     $page = (int) (!isset($_GET["page"]) ? 1 : $_GET["page"]);
  40.                     $limit = 3;
  41.                     $startpoint = ($page * $limit) - $limit;
  42.                     ?>
  43.                     <table id="admin">
  44.                         <tr>
  45.                             <th>Username</th>
  46.                             <th>Name</th>
  47.                             <th>Email</th>
  48.                             <?php
  49.                             if (has_access($session_user_id, 1) === true) {
  50.                                 echo '<th>Action</th>';
  51.                             }
  52.                             ?>
  53.                         </tr>
  54.                    
  55.                     <?php
  56.                     //to make pagination
  57.                     $statement = "`users` where `active` = 1";
  58.                             //show users
  59.                             $query = mysql_query("SELECT * FROM {$statement} LIMIT {$startpoint} , {$limit}");
  60.                            
  61.                             while ($row = mysql_fetch_assoc($query)) {
  62.                             echo "
  63.                                 <tr>
  64.                                     <td width='200'>{$row['username']}</td>
  65.                                     <td width='200'>{$row['first_name']} {$row['last_name']}</td>";
  66.                                     if (has_access($session_user_id, 1) === true) {
  67.                                         echo "<td width='210'>{$row['email']}</td>";
  68.                                         echo "<td><a href='members.php?id={$row['user_id']}'>Delete</a></td>";
  69.                                        
  70.                                     } else {
  71.                                         echo "<td>{$row['email']}</td>";
  72.                                     }
  73.                                 echo '</tr>';
  74.                             }
  75.                     ?></table>
  76.                    
  77.                     <?php
  78.                       if($_GET['id'] != ""){
  79.                         if (has_access($session_user_id, 1) === false) {
  80.                           header('Location: index.php');
  81.                           exit();
  82.                         }
  83.                         $userID = $_GET['id'];
  84.                         $sql = "DELETE FROM users WHERE user_id='".$userID."'";
  85.                         $query  = mysql_query($sql);
  86.                       }
  87.                     ?>
  88.                
  89.                     <hr><div class="desc">
  90.                     <?php
  91.                     echo '<div class="underside">';
  92.                     include 'includes/widgets/user_count.php';
  93.                     echo'</div>';
  94.                     echo pagination($statement,$limit,$page);
  95.                     ?>
  96.                     </div>
  97.             </div>
  98.         </div>
  99. </body>
  100. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement