Вход Регистрация
Файл: InstantSocial/uploud/components/users/rratings/db.php
Строк: 91
<?php
/*
--------------------------------------------------------- */
session_start();
    
define("VALID_CMS"1);
    
define('PATH'$_SERVER['DOCUMENT_ROOT']);
    
define('HOST''http://' $_SERVER['HTTP_HOST']);
 
    include(
PATH.'/core/cms.php');
        
$inCore cmsCore::getInstance();
$inCore->loadClass('config');       //конфигурация
    
$inCore->loadClass('db');           
    
$inCore->loadClass('user');
    
$inUser cmsUser::getInstance();
$inUser->update();


$is_user $inUser->id ;

     
$inDB cmsDatabase::getInstance();
        
$rating_unitwidth     '30';



//getting the values
$vote_sent preg_replace("/[^0-9]/","",$_REQUEST['j']);
$id_sent preg_replace("/[^0-9a-zA-Z]/","",$_REQUEST['q']);
$units preg_replace("/[^0-9]/","",$_REQUEST['c']);
$referer  $_SERVER['HTTP_REFERER'];

if (
$vote_sent $units) die("Sorry, vote appears to be invalid."); // kill the script because normal users will never see this.

//connecting to the database to get some information
$sql "SELECT total_votes, total_value FROM cms_rratings WHERE id='$id_sent' ";
$query$inDB->query($sql);
$numbers=$inDB->fetch_assoc($query);

$count $numbers['total_votes']; //how many votes total
$current_rating $numbers['total_value']; //total number of rating added together and stored
$sum $vote_sent+$current_rating// add together the current vote value and the total vote value

if ($count==1) {
$tense='голос';
} else if (
$count<=AND $count>=2) {
$tense='голосa';
} else {
$tense='голосов';
}

//$tense = ($count==1) ? "vote" : "votes"; //plural form votes/vote

// or increment the current number of votes
($sum==$added=$added=$count+1);


$sql "SELECT u_id FROM cms_rratings_users WHERE u_id='$is_user' AND vot_id='$id_sent' ";
$resu $inDB->query($sql);
$voted=$inDB->fetch_assoc($resu);

if(!
$voted) {     //if the user hasn't yet voted, then vote normally…


if (($vote_sent >= && $vote_sent <= $units) && ($ip == $ip_num)) { // keep votes within range
    
        
$update "UPDATE cms_rratings SET total_votes='".$added."', total_value='".$sum."' WHERE id='$id_sent'";
$result $inDB->query($update);
$sql "INSERT INTO cms_rratings_users (`vot_id`, `u_id`, `stats`, `vot`, `data` ) VALUES ('$id_sent', '$is_user', '1', '$vote_sent', NOW())";
$resule $inDB->query($sql);    

header("Location: $referer"); // go back to the page we came from 
exit;
//end for the "if(!$voted)"
?>
Онлайн: 1
Реклама