Jump to content

[SOLVED] coockie help / refresh


alwaysme

Recommended Posts

hi there, i have a script that increase views with IP ADDRESS...however i want it with a refresh....

 

my friend told me to do this

change

if(!isset($_COOKIE[$id])){
$twomonths = 60 * 60 * 24 * 60 + time();
setcookie("$id", $id, $twomonths);
$viewaddone = true;
}

 

to

if(!isset($_COOKIE[$id])){
$1sec = 1 + time();
setcookie("$id", $id, $1sec);
$viewaddone = true;
}

 

but that give me error

 

Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/public_html/multimedia/videos.php on line 13

 

anyone can help me please?

Link to comment
Share on other sites

i get another error

 

Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/public_html/multimedia/videos.php  on line 14

 

this is the whole file

 

<?php


$id = $_GET["id"];

if(!isset($_COOKIE[$id])){
$onesec = 1 + time();
setcookie("$id", $id, $1sec);
$viewaddone = true;
}

require('header.php');

if(isset($id)){
$result = mysql_query("SELECT * FROM pp_files WHERE id=$id LIMIT 1") or die();  
}elseif (isset($_GET["name"])){
$name = $_GET["name"];
$result = mysql_query("SELECT * FROM pp_files WHERE `approved` = '1' AND `name` = '$name' LIMIT 1") or die();  

}else{
$result = mysql_query("select * from pp_files WHERE approved='1' AND reject='0' order by rand() LIMIT 1") or die();  
}
// For each result that we got from the Database
while ($row = mysql_fetch_assoc($result))
{
$video[] = $row;

	if($viewaddone == true){
	$new_views = $row["views"] + 1;
	mysql_query("UPDATE pp_files SET views = '$new_views' WHERE id = '$id'");
}

$smarty->assign('vidtype', $row['video_type']);

if( $row['video_type'] == "dailymotion"){
$dm_xml_pic_string = @file_get_contents("http://www.dailymotion.com/atom/fr/cluster/extreme/featured/video/".$row['file']);
$dm_xml_pic_start = explode("/swf/",$dm_xml_pic_string,2);
$dm_xml_pic_end = explode("\"",$dm_xml_pic_start[1],2);
$dmid = $dm_xml_pic_end[0];
$smarty->assign('dmid', $dmid);
}
}

// Assign this array to smarty

$smarty->assign('video', $video);
$smarty->assign('id', $row['id']);


if(isset($_GET["pop"])){
$smarty->display('viewvidpop.tpl');
}else{
$smarty->display('viewvid.tpl');
}

mysql_close($mysql_link);
?>

 

 

what could have been fix,, ;[

Link to comment
Share on other sites

maybe this file also responsible?

<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/


/**
* Smarty {counter} function plugin
*
* Type:     function<br>
* Name:     counter<br>
* Purpose:  print out a counter value
* @author Monte Ohrt <monte at ohrt dot com>
* @link http://smarty.php.net/manual/en/language.function.counter.php {counter}
*       (Smarty online manual)
* @param array parameters
* @param Smarty
* @return string|null
*/
function smarty_function_counter($params, &$smarty)
{
    static $counters = array();

    $name = (isset($params['name'])) ? $params['name'] : 'default';
    if (!isset($counters[$name])) {
        $counters[$name] = array(
            'start'=>1,
            'skip'=>1,
            'direction'=>'up',
            'count'=>1
            );
    }
    $counter =& $counters[$name];

    if (isset($params['start'])) {
        $counter['start'] = $counter['count'] = (int)$params['start'];
    }

    if (!empty($params['assign'])) {
        $counter['assign'] = $params['assign'];
    }

    if (isset($counter['assign'])) {
        $smarty->assign($counter['assign'], $counter['count']);
    }
    
    if (isset($params['print'])) {
        $print = (bool)$params['print'];
    } else {
        $print = empty($counter['assign']);
    }

    if ($print) {
        $retval = $counter['count'];
    } else {
        $retval = null;
    }

    if (isset($params['skip'])) {
        $counter['skip'] = $params['skip'];
    }
    
    if (isset($params['direction'])) {
        $counter['direction'] = $params['direction'];
    }

    if ($counter['direction'] == "down")
        $counter['count'] -= $counter['skip'];
    else
        $counter['count'] += $counter['skip'];
    
    return $retval;
    
}

/* vim: set expandtab: */

?>

 

???

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.