[ PHPXref.com ] [ Generated: Sun Jul 20 20:44:35 2008 ] [ Time Management 1.06 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> addevent.php (source)

   1  <?php
   2  session_start();
   3  ?>
   4  <html><head><title>Event Admin</title></head><body>
   5  <?php
   6  if ($_SESSION['admin'] != 'OK')
   7  die("<p>Only admins can view this please login <a href='login.php'>here</a></p>");
   8  
   9  include ("connect.php");
  10  include ("functions.php");
  11  
  12  echo $top;
  13  echo "Event Administration";
  14  echo $bottom;
  15  echo "<br />";
  16  
  17  if ($_SERVER['REQUEST_METHOD'] == 'POST')
  18  {
  19      $date = clean($_POST['date']);
  20      $time = clean($_POST['time']);
  21      $name = clean($_POST['name']);
  22      $des = clean($_POST['des']);
  23      
  24      if (empty($date))
  25      die("Please fill out the date.");
  26      if (empty($time))
  27      die("Please enter a time.");
  28      if (empty($name))
  29      die("Please enter a name.");
  30      if (empty($des))
  31      die("Please enter a description.");
  32      
  33      $link = "INSERT INTO events VALUES ('$date','$time','$name','$des','')";
  34      $res = mysql_query($link) or die(mysql_error());
  35      
  36      if ($res)
  37      echo "Date Succesfully Added.<br><br>";
  38  
  39  }
  40      echo $tablehead . '
  41      <tr>
  42      <td>
  43      <form action="" method="POST">
  44      <strong>date</strong>
  45      </td>
  46      <td>
  47      <input type="text" name="date">
  48      </td>
  49      </tr>
  50      <tr>
  51      <td>
  52      <strong>time</strong>
  53      </td>
  54      <td>
  55      <input type="text" name="time">
  56      </td>
  57      </tr>
  58      <tr>
  59      <td>
  60      <strong>name</strong>
  61      </td>
  62      <td>
  63      <input type="text" name="name" length="30">
  64      </td>
  65      </tr>
  66      <tr>
  67      <td>
  68      <strong>description</strong>
  69      </td>
  70      <td>
  71      <textarea rows="2" cols="50" name="des"></textarea><br /><br />
  72      </td>
  73      </tr>
  74      <tr>
  75      <td colspan="2">
  76      <input type="submit" value="Add Event">
  77      <input type="reset">
  78      </td>
  79      </tr>
  80      </table><br />
  81      ' . $top . 'Event List' . $bottom . '<br />
  82  
  83      <a href="calendar.php"><small>view calendar</small></a>
  84  
  85      ' . $tablehead . '<tr class="thstyle"><td class="theading">event date</td><td>event time</td><td>event name</td><td>event description</td><td >edit</td><td>delete</td></tr>';
  86  
  87      $link = "SELECT * FROM events ORDER BY `date` asc";
  88      $res = mysql_query($link) or die(mysql_error());
  89      $total = mysql_num_rows($res);
  90      
  91      while ($row = mysql_fetch_assoc($res))
  92      {
  93          $name = $row['name'];
  94          $date = $row['date'];
  95          $time = $row['time'];
  96          $des = $row['des'];
  97          $id = $row['id'];
  98          
  99          echo '<td><b>' . $date . '</b></td><td>'  . $time . '</td><td>' . $name . 
 100          '</td><td>' . $des . '</td><td><a href="modify.php?action=edit&id=' . $id . '">edit</a></td><td width=10%"><a href="modify.php?action=delete&id=' . $id . '">delete</a></td></tr>';
 101      }
 102      echo '</table><br /><small>You have ' . $total . ' event(s).<br /><br /><a href="logout.php">Logout</a></small></body></html>';
 103  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]