Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 25th, 2013  |  syntax: PHP  |  size: 2.58 KB  |  views: 88  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php include 'include/global.php'; ?>
  2. <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
  3. <html xmlns='http://www.w3.org/1999/xhtml'>
  4. <head>
  5. <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
  6. <title><?php echo $sitename; ?></title>
  7.  
  8.  
  9. <?php include 'header.php'; ?>
  10.  
  11. <table cellpadding='0' cellspacing='0' align='center' class='top'><tr><td valign='bottom'><div class='toptext'>Categorii</div></td></tr></table>
  12. <?php
  13. $today = mktime(0,0,0,date("d"),date("m"),date("Y"));
  14.  
  15. $sql="SELECT * FROM ads where '".date("d-m-Y", $today)."' >= data_expirare";
  16. $result=mysql_query($sql);
  17.  
  18. ?>
  19. <table cellpadding='0' cellspacing='0' align='center' class='content'>
  20. <tr><td>
  21. <table cellpadding='0' cellspacing='0' align='center' class='table1'>
  22. <tr>
  23. <td>
  24.  
  25. <form name="myform" action="" method="post" OnSubmit="return onDelete();">
  26. <input name="delete" type="submit" id="delete" value="Delete">
  27. <table border="0">
  28.   <tbody>
  29.     <tr>
  30.       <th> # </th>
  31.       <th> <input id="CheckAll" onclick="checkAll(document.myform.chkDel);" name="CheckAll" type="checkbox" /></th>
  32.       <th> Titlu Anunt</th>
  33.       <th> Email </th>
  34.       <th> Nume</th>
  35.       <th> Data expirare</th>
  36.     </tr>
  37.     <?php
  38.         $index = 1;
  39.         $result = 'MySQL SELECT Query';
  40. while ($row=mysql_fetch_array($result))
  41.     {
  42.         ?>
  43.     <tr>
  44.       <td><?php echo $index++; ?> </td>
  45.       <td><input name="chkDel[]" type="checkbox" value="&lt;?php echo $row['id'];?&gt;" /></td>
  46.       <td><?php echo $row['ad_headline']; ?></td>
  47.       <td><?php echo $row['email']; ?></td>
  48.       <td><?php echo $row['name']?></td>
  49.       <td><?php echo $row['data_expirare']?></td>
  50.     </tr>
  51. <?php }?>
  52.   </tbody>
  53. </table>
  54. </form>
  55.  
  56. <script language="JavaScript">  
  57. function checkAll(field)
  58. {
  59.         for (i = 0; i < field.length; i++)
  60.         if(document.myform.CheckAll.checked == true){
  61.                 field[i].checked = true ;
  62.         }
  63.         else{
  64.                 field[i].checked = false ;
  65.         }      
  66. }
  67. function onDelete()  
  68. {  
  69.         if(confirm('Do you want to delete ?')==true)  
  70.         {  
  71.                 return true;  
  72.         }  
  73.         else  
  74.         {  
  75.                 return false;  
  76.         }  
  77. }  
  78. </script>
  79. <?php
  80. if(isset($_POST['delete']))
  81.         {
  82.                  $delete_id = $_POST['chkDel'];
  83.                  $id = count($delete_id );
  84.                  if (count($id) > 0)
  85.                   {
  86.                          foreach ($delete_id as $id_d)
  87.                          {
  88.                                 $sql = "DELETE FROM `ads` WHERE id='$id_d'";
  89.                                 $delete = mysql_query($sql);
  90.                         }
  91.                 }
  92.                 if($delete)
  93.                 {
  94.                         echo $id." Records deleted Successfully.";
  95.                 }
  96.         }
  97.         ?>
  98.         </td>
  99. </tr>
  100. </table>
  101. </td></tr></table>
  102.  
  103. <?php include 'footer.php'; ?>
  104. </body>
  105. </html>
clone this paste RAW Paste Data