Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
u2_progc [2011-01-21 10:47]
Joakim Forsgren
u2_progc [2011-01-21 11:09]
Joakim Forsgren
Line 35: Line 35:
 <code php> <code php>
  
-// forumController +// lite kod från forumController 
 if($_POST['a']=='InsertItem') { if($_POST['a']=='InsertItem') {
   if (!$_POST['Item']) {   if (!$_POST['Item']) {
Line 55: Line 55:
 } }
  
-// forum.php (model_forum)+// lite kod från forum.php (model_forum)
 public function DeleteThread ($threadid) { public function DeleteThread ($threadid) {
   $query = "DELETE lab5_Threads, lab5_Items FROM `lab5_Threads` LEFT JOIN `lab5_Items` USING(ThreadID)    $query = "DELETE lab5_Threads, lab5_Items FROM `lab5_Threads` LEFT JOIN `lab5_Items` USING(ThreadID) 
-            WHERE ThreadID = '" . $_POST['ThreadID'] . "' AND (lab5_Threads.UserID = '" . service_session::getInstance()->Get('UserID') . "' +            WHERE ThreadID = '" . $_POST['ThreadID'] . "'  
 +            AND (lab5_Threads.UserID = '" . service_session::getInstance()->Get('UserID') . "' 
             OR " . service_session::getInstance()->Get('Admin') . ")";             OR " . service_session::getInstance()->Get('Admin') . ")";
   return $this->db->Delete($query);   return $this->db->Delete($query);
 +}
 +
 +// Från forum.php
 +public function InsertItem ($data) {
 +  $this->table='lab5_Items';
 +  return $this->Insert($data);
 } }
  
 </code> </code>