[ PHPXref.com ] [ Generated: Sun Jul 20 19:47:34 2008 ] [ phpMyFAQ 1.6.1 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> savevoting.php (source)

   1  <?php
   2  /**
   3  * $Id: savevoting.php,v 1.8.2.9 2006/01/02 12:47:09 thorstenr Exp $
   4  *
   5  * Saves a user voting
   6  *
   7  * @author       Thorsten Rinne <thorsten@phpmyfaq.de>
   8  * @since        2002-09-16
   9  * @copyright    (c) 2001-2006 phpMyFAQ Team
  10  * 
  11  * The contents of this file are subject to the Mozilla Public License
  12  * Version 1.1 (the "License"); you may not use this file except in
  13  * compliance with the License. You may obtain a copy of the License at
  14  * http://www.mozilla.org/MPL/
  15  *
  16  * Software distributed under the License is distributed on an "AS IS"
  17  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  18  * License for the specific language governing rights and limitations
  19  * under the License.
  20  */
  21  
  22  if (!defined('IS_VALID_PHPMYFAQ')) {
  23      header('Location: http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']));
  24      exit();
  25  }
  26  
  27  $record = (isset($_POST["artikel"])) ? intval($_POST["artikel"]) : '';
  28  $vote = (isset($_POST["vote"])) ? intval($_POST["vote"]) : 0;
  29  $userip = (isset($_POST["userip"])) ? strip_tags($_POST["userip"]) : '';
  30  
  31  if (isset($vote) && $vote != "" && votingCheck($record, $userip) && intval($_POST["vote"]) > 0 && intval($_POST["vote"]) < 6) {
  32      
  33      $noUser = "0";
  34      $datum = date("YmdHis");
  35      Tracking("save_voting", $record);
  36      
  37      if ($result = $db->query("SELECT usr FROM ".SQLPREFIX."faqvoting WHERE artikel = ".$record)) {
  38          while ($row = $db->fetch_object($result)) {
  39              $noUser = $row->usr;
  40          }
  41      }
  42      
  43      if ($noUser == "0" || $noUser == "") {
  44          $db->query("INSERT INTO ".SQLPREFIX."faqvoting (id, artikel, vote, usr, datum, ip) VALUES (".$db->nextID(SQLPREFIX."faqvoting", "id").", ".$record.", ".$vote.", '1', ".time().", '".$userip."');");
  45      }  else {
  46          $db->query("UPDATE ".SQLPREFIX."faqvoting SET vote = vote + ".$vote.", usr = usr + 1, datum = ".time().", ip = '".$userip."' where artikel = ".$record);
  47      }
  48      
  49      $tpl->processTemplate ("writeContent", array(
  50                  "msgVoteThanks" => $PMF_LANG["msgVoteThanks"]
  51                  ));
  52      
  53  } elseif (isset($_POST["vote"])  && !votingCheck($record, $userip)) {
  54      
  55      Tracking("error_save_voting", $record);
  56      $tpl->processTemplate ("writeContent", array(
  57                  "msgVoteThanks" => $PMF_LANG["err_VoteTooMuch"]
  58                  ));
  59      
  60  } else {
  61      
  62      Tracking("error_save_voting", $record);
  63      $tpl->processTemplate ("writeContent", array(
  64                  "msgVoteThanks" => $PMF_LANG["err_noVote"]
  65                  ));
  66      
  67  }
  68  
  69  $tpl->includeTemplate("writeContent", "index");
  70  ?>


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