+ Reply to Thread
Results 1 to 7 of 7

Thread: cookey problem :(

  1. #1
    relisys is offline x10 Lieutenant relisys is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    birmingham uk
    Posts
    426

    cookey problem :(

    ok so im trying to search 2 words on my search bar and i get this

    Code:
    Warning:  Cookie names can not contain any of the folllowing '=,; \t\r\n\013\014' (crazy fireworks) in /home/atlantis/public_html/fireworks/include/recherche.php on line 106
    so when i look at my file recherche.php on line 106

    i get this code

    Code:
    // Count only one search per word per day per user
            setcookie($recherche,'1', time()+3600*24);
        }
    can someone suggest what i need to change?

    so i dont get
    Code:
    Warning: Cookie names can not contain any of the folllowing '=,; \t\r\n\013\014' (crazy fireworks) in /home/atlantis/public_html/fireworks/include/recherche.php on line 106
    any more
    Last edited by relisys; 06-17-2008 at 06:51 PM.
    The Firework Shop List | Fancy Dress Costumes

    A desperate disease requires a dangerous remedy.

  2. #2
    VPmase's Avatar
    VPmase is offline x10 Elder VPmase is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    Dixon, IL, USA
    Posts
    914

    Re: cookey problem :(

    What do you set "$recherche" as?

  3. #3
    woiwky is offline x10 Lieutenant woiwky is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    390

    Re: cookey problem :(

    It seems that $recherche is being set to the search text entered by the user. And it seems that a cookie is set for every search the user makes. But since I have no idea how this system works, I can't really recommend an alternative since I don't know what the effects will be. If you could post the complete source of recherche.php or attach it if it's large, that would be very helpful.
    "But you have access to the greatest source of knowledge in the universe."
    "Well I do talk to myself sometimes, yes."

    "I'm back, and I'm bad! Obviously within certain, sensible, preset parameters"

  4. #4
    relisys is offline x10 Lieutenant relisys is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    birmingham uk
    Posts
    426

    Re: cookey problem :(

    yes thats right it was in french but i tryed to clean it up into english

    any way her eis the complete code

    Code:
    <?php
    
    if(isset($_REQUEST["seek"]) and !empty($_REQUEST["seek"]) and strlen($_REQUEST["seek"]) >= $CONFIG['search_minlength'])
    {
    	$seek = $_REQUEST["seek"];
    }
    else if(!isset($_REQUEST['id']) || empty($_REQUEST['id']))
    {
    	$seek = "";
    }
    
    if (!empty($seek))
    {
    	if(isUTF8($seek)) {
    		$seek = utf8_decode($seek);
    	}
    	$seek = strip_tags($seek);
    	
    	$km =& get_manager("keyword");
    	$lm =& get_manager("link");
    	$myts =& MyTextSanitizer::getInstance();
    	$re = MyRewriteEngine::getInstance();
    	
    	$my_url = 'index.php?do=recherche&amp;seek='.$seek;
    	$start = isset($_GET['start']) ? $_GET['start'] : 0;
    	$limit = 10;
    	
    	$recherche = strtolower($seek);
    
    	$mots = str_replace('+', ' ', trim($recherche));
    	$mots = str_replace('\'', ' ', $mots);
    	$mots = str_replace('%', ' ', $mots);
    	$mots = str_replace(',', ' ', $mots);
    	$mots = str_replace(':', ' ', $mots);
    
    	$tab = explode(' ' , $mots);
    	$nb = count($tab);
    	
    	$criteriacompo = new CriteriaCompo(new Criteria('id',0,'='),'OR');
    
    	for($i = 0; $i < $nb; $i++)
    	{
    		if(strlen($tab[$i]) >= $CONFIG['search_minlength'])
    		{
    			$criteriacompo->add(new Criteria('name',"%".$tab[$i]."%",'LIKE'),'OR');
    			$criteriacompo->add(new Criteria('description',"%".$tab[$i]."%",'LIKE'),'OR');
    		}
    	}
    
    	$criteriacompo2 = new CriteriaCompo($criteriacompo,'AND');
    	$criteriacompo2->add(new Criteria('state',4,'='),'AND');
    	
    	$total_items = $lm->getCount($criteriacompo2);
    	$smarty->assign('total_results',$total_items);
    	
    	$criteriacompo2->setOrder('DESC');
    	$criteriacompo2->setSort('hits');
    	$criteriacompo2->setLimit($limit);
    	$criteriacompo2->setStart($start);
    
    	// Cols to be selected
    	$cols = array('id', 'name', 'url', 'description', 'pr', 'category', 'image', 'hits','vote');
    	// retrieving objects
    	$links =& $lm->getObjects($criteriacompo2,$cols);
    	
    	$total_keywords = $km->getCount();
    	
    	$hasresults = count($links) == 0 ? 0 : 1;
    	
    	if(count($links) > 0)
    	{
    		affichage_liens($links, $CONFIG['url_rewriting'], 1);
    	}
    	else
    	{
    		// No results
    	}
    	
    	$smarty->assign("resultsfor",$lang['resultsfor']);
    	$smarty->assign('searched_expr',$recherche);
    	
    	$pagenav = new PageNav($total_items, $limit, $start, $my_url);
    	
    	$smarty->assign('pagenav',$pagenav->renderNavNormal());
    	
    	if($total_keywords <= $CONFIG['max_keywords'] || $CONFIG['max_keywords'] == 0)
    	{
    		$criteria = new Criteria('word',$recherche,'=');
    		$criteria->setLimit(1);
    		$cols = array('occurence');
    		$keywords =& $km->getObjects($criteria,$cols);
    		
    		if(count($keywords) > 0 && !isset($_COOKIE[$recherche]))
    		{
    			$attributes = array('occurence' => $keywords[0]->getVar('occurence')+1, 'date' => date("Y-m-d"), 'hasresults' => $hasresults);
    			$km->update($criteria, $attributes);
    		}
    		else if(count($keywords) == 0)
    		{
    			$keyword = $km->create(true);
    			$keyword->setVars(array('id' => '', 'word' => $recherche, 'occurence' => 1, 'date' => date("Y-m-d"), 'hasresults' => $hasresults));
    			$km->insert($keyword);
    		}
    		
    		// Count only one search per word per day per user
    		setcookie($recherche,'1', time()+3600*24);
    	}
    }
    else if (!isset($_POST["seek"]))
    {
    	$directory =& MyDirectory::getInstance();
    	$directory->error301('./');
    }
    else
    {
        $smarty->assign("message",$lang['search_moreprecise']);
    }
    ?>
    Last edited by relisys; 06-18-2008 at 01:58 PM.
    The Firework Shop List | Fancy Dress Costumes

    A desperate disease requires a dangerous remedy.

  5. #5
    woiwky is offline x10 Lieutenant woiwky is an unknown quantity at this point
    Join Date
    Mar 2008
    Posts
    390

    Re: cookey problem :(

    I see what it's doing, but it should only be using the db to do that. Cookies are too volatile. But anyway, this should fix it:

    PHP Code:
    <?php

    if(isset($_REQUEST["seek"]) and !empty($_REQUEST["seek"]) and strlen($_REQUEST["seek"]) >= $CONFIG['search_minlength'])
    {
        
    $seek $_REQUEST["seek"];
    }
    else if(!isset(
    $_REQUEST['id']) || empty($_REQUEST['id']))
    {
        
    $seek "";
    }

    if (!empty(
    $seek))
    {
        if(
    isUTF8($seek)) {
            
    $seek utf8_decode($seek);
        }
        
    $seek strip_tags($seek);
        
        
    $km =& get_manager("keyword");
        
    $lm =& get_manager("link");
        
    $myts =& MyTextSanitizer::getInstance();
        
    $re MyRewriteEngine::getInstance();
        
        
    $my_url 'index.php?do=recherche&amp;seek='.$seek;
        
    $start = isset($_GET['start']) ? $_GET['start'] : 0;
        
    $limit 10;
        
        
    $recherche strtolower($seek);

        
    $mots str_replace('+'' 'trim($recherche));
        
    $mots str_replace('\''' '$mots);
        
    $mots str_replace('%'' '$mots);
        
    $mots str_replace(','' '$mots);
        
    $mots str_replace(':'' '$mots);

        
    $tab explode(' ' $mots);
        
    $nb count($tab);
        
        
    $criteriacompo = new CriteriaCompo(new Criteria('id',0,'='),'OR');

        for(
    $i 0$i $nb$i++)
        {
            if(
    strlen($tab[$i]) >= $CONFIG['search_minlength'])
            {
                
    $criteriacompo->add(new Criteria('name',"%".$tab[$i]."%",'LIKE'),'OR');
                
    $criteriacompo->add(new Criteria('description',"%".$tab[$i]."%",'LIKE'),'OR');
            }
        }

        
    $criteriacompo2 = new CriteriaCompo($criteriacompo,'AND');
        
    $criteriacompo2->add(new Criteria('state',4,'='),'AND');
        
        
    $total_items $lm->getCount($criteriacompo2);
        
    $smarty->assign('total_results',$total_items);
        
        
    $criteriacompo2->setOrder('DESC');
        
    $criteriacompo2->setSort('hits');
        
    $criteriacompo2->setLimit($limit);
        
    $criteriacompo2->setStart($start);

        
    // Cols to be selected
        
    $cols = array('id''name''url''description''pr''category''image''hits','vote');
        
    // retrieving objects
        
    $links =& $lm->getObjects($criteriacompo2,$cols);
        
        
    $total_keywords $km->getCount();
        
        
    $hasresults count($links) == 1;
        
        if(
    count($links) > 0)
        {
            
    affichage_liens($links$CONFIG['url_rewriting'], 1);
        }
        else
        {
            
    // No results
        
    }
        
        
    $smarty->assign("resultsfor",$lang['resultsfor']);
        
    $smarty->assign('searched_expr',$recherche);
        
        
    $pagenav = new PageNav($total_items$limit$start$my_url);
        
        
    $smarty->assign('pagenav',$pagenav->renderNavNormal());
        
        if(
    $total_keywords <= $CONFIG['max_keywords'] || $CONFIG['max_keywords'] == 0)
        {
            
    $criteria = new Criteria('word',$recherche,'=');
            
    $criteria->setLimit(1);
            
    $cols = array('occurence');
            
    $keywords =& $km->getObjects($criteria,$cols);
            
            if (isset(
    $_COOKIE['searches'])) {
                
    $searches unserialize($_COOKIE['searches']);
                
    $searches = (is_array($searches) ? $searches : array());
            }
            else {
                
    $searches = array();
            }
            
            if(
    count($keywords) > && empty($searches[$recherche]))
            {
                
    $searches[$recherche] = 1;
                
    $attributes = array('occurence' => $keywords[0]->getVar('occurence')+1'date' => date("Y-m-d"), 'hasresults' => $hasresults);
                
    $km->update($criteria$attributes);
            }
            else if(
    count($keywords) == 0)
            {
                
    $keyword $km->create(true);
                
    $keyword->setVars(array('id' => '''word' => $recherche'occurence' => 1'date' => date("Y-m-d"), 'hasresults' => $hasresults));
                
    $km->insert($keyword);
            }
            
            
    // Count only one search per word per day per user
            
    setcookie('searches',serialize($searches), time()+3600*24);
            unset(
    $searches);
        }
    }
    else if (!isset(
    $_POST["seek"]))
    {
        
    $directory =& MyDirectory::getInstance();
        
    $directory->error301('./');
    }
    else
    {
        
    $smarty->assign("message",$lang['search_moreprecise']);
    }
    ?>
    "But you have access to the greatest source of knowledge in the universe."
    "Well I do talk to myself sometimes, yes."

    "I'm back, and I'm bad! Obviously within certain, sensible, preset parameters"

  6. #6
    relisys is offline x10 Lieutenant relisys is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    birmingham uk
    Posts
    426

    Re: cookey problem :(

    omg, thank you so much

    it works perfectly, just waiting on my banner now and then im 100% fully working

    you deff get rep off me
    Last edited by relisys; 06-18-2008 at 02:53 PM.
    The Firework Shop List | Fancy Dress Costumes

    A desperate disease requires a dangerous remedy.

  7. #7
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228

    Re: cookey problem :(

    please close your answered threads. :d it makes us happy
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

+ Reply to Thread

Similar Threads

  1. DB number problem
    By lionheart8 in forum Free Hosting
    Replies: 5
    Last Post: 04-08-2008, 08:26 AM
  2. Apache + mod_rewrite problem
    By t2t2t in forum Free Hosting
    Replies: 3
    Last Post: 06-27-2007, 11:37 AM
  3. Problem with ad code (includes?)
    By Salvatos in forum Free Hosting
    Replies: 10
    Last Post: 12-12-2006, 04:16 PM
  4. Replies: 5
    Last Post: 09-07-2005, 05:05 AM
  5. Ad code problem!
    By Akkarin in forum Free Hosting
    Replies: 8
    Last Post: 08-29-2005, 10:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers