Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php include 'include/global.php'; ?>
- <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
- <html xmlns='http://www.w3.org/1999/xhtml'>
- <head>
- <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
- <title><?php echo $sitename; ?></title>
- <?php include 'header.php'; ?>
- <table cellpadding='0' cellspacing='0' align='center' class='top'><tr><td valign='bottom'><div class='toptext'>Categorii</div></td></tr></table>
- <?php
- $today = mktime(0,0,0,date("d"),date("m"),date("Y"));
- $sql="SELECT * FROM ads where '".date("d-m-Y", $today)."' >= data_expirare";
- $result=mysql_query($sql);
- ?>
- <table cellpadding='0' cellspacing='0' align='center' class='content'>
- <tr><td>
- <table cellpadding='0' cellspacing='0' align='center' class='table1'>
- <tr>
- <td>
- <form name="myform" action="" method="post" OnSubmit="return onDelete();">
- <input name="delete" type="submit" id="delete" value="Delete">
- <table border="0">
- <tbody>
- <tr>
- <th> # </th>
- <th> <input id="CheckAll" onclick="checkAll(document.myform.chkDel);" name="CheckAll" type="checkbox" /></th>
- <th> Titlu Anunt</th>
- <th> Email </th>
- <th> Nume</th>
- <th> Data expirare</th>
- </tr>
- <?php
- $index = 1;
- $result = 'MySQL SELECT Query';
- while ($row=mysql_fetch_array($result))
- {
- ?>
- <tr>
- <td><?php echo $index++; ?> </td>
- <td><input name="chkDel[]" type="checkbox" value="<?php echo $row['id'];?>" /></td>
- <td><?php echo $row['ad_headline']; ?></td>
- <td><?php echo $row['email']; ?></td>
- <td><?php echo $row['name']?></td>
- <td><?php echo $row['data_expirare']?></td>
- </tr>
- <?php }?>
- </tbody>
- </table>
- </form>
- <script language="JavaScript">
- function checkAll(field)
- {
- for (i = 0; i < field.length; i++)
- if(document.myform.CheckAll.checked == true){
- field[i].checked = true ;
- }
- else{
- field[i].checked = false ;
- }
- }
- function onDelete()
- {
- if(confirm('Do you want to delete ?')==true)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- </script>
- <?php
- if(isset($_POST['delete']))
- {
- $delete_id = $_POST['chkDel'];
- $id = count($delete_id );
- if (count($id) > 0)
- {
- foreach ($delete_id as $id_d)
- {
- $sql = "DELETE FROM `ads` WHERE id='$id_d'";
- $delete = mysql_query($sql);
- }
- }
- if($delete)
- {
- echo $id." Records deleted Successfully.";
- }
- }
- ?>
- </td>
- </tr>
- </table>
- </td></tr></table>
- <?php include 'footer.php'; ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement