Current location: Hot Scripts Forums » Programming Languages » PHP » problem in cookies @ phppro list


problem in cookies @ phppro list

Reply
  #1 (permalink)  
Old 06-17-03, 10:12 AM
vb2vb vb2vb is offline
Newbie Coder
 
Join Date: Jun 2003
Location: yeme
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
problem in cookies @ phppro list

i install phplist pro ver 1.75

evreything ok but when vote this apper


given in /home/*******/public_html/in.php on line 105

Warning: Cannot modify header information - headers already sent by (output started at /home/*******/public_html/in.php:105) in /home/********/public_html/in.php on line 121

Warning: Cannot modify header information - headers already sent by (output started at /home/*****/public_html/in.php:105) in /home/****

lne 105 :
setcookie("CheckCookie_$site", "", "", "$cookiepath"); //delete checkcookie

line 121
setcookie("phpListPro_$site", "1", "$cookietime", "$cookiepath");

plz solve this problems
__________________
No God Only ALLLAh
Reply With Quote
  #2 (permalink)  
Old 06-17-03, 10:15 AM
!!! HotCGIScripts !!!'s Avatar
!!! HotCGIScripts !!! !!! HotCGIScripts !!! is offline
Guru Programmer
 
Join Date: Jun 2003
Location: USA
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
There problem not in cookies. So this warnings is because of previose errors.

Show us all errors that show PHP.
Reply With Quote
  #3 (permalink)  
Old 06-17-03, 10:25 AM
vb2vb vb2vb is offline
Newbie Coder
 
Join Date: Jun 2003
Location: yeme
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
this in.php
PHP Code:

require ("config.php");


if (
getenv(HTTP_CLIENT_IP)){
    
$ipaddr=getenv(HTTP_CLIENT_IP);
} else {
    
$ipaddr=getenv(REMOTE_ADDR);
}

mysql_connect($server$db_user$db_pass) or die ("Database Connect Error");

if (
$site) {
  
$sql "SELECT * FROM sites WHERE id='$site' ";
  
$query mysql_db_query($database$sql) or die(geterrdesc($sql));
  
$result mysql_fetch_array($query);
  if (
$result[cat]>0) {
    
$catlink="&cat=$result[cat]";
  }

  if (
$result && empty($vote) && $gateway) {

    if (
$cookievotesonly) {     //set testcookie
    
$cookietime=time()+360;
    
setcookie("CheckCookie_$site""1""$cookietime""$cookiepath");  //must vote within 360 seconds
    
}

    include(
$header);

    echo 
"<div class=\"maincenter\">";
    echo 
"$lang[in_msg1]";
    echo 
" <a href=\"$result[site_addr]\" target=_blank>$result[site_name]</a><br>\n";
    echo 
"$lang[in_msg2]<p>\n";

    if (
$show_rating) {
        echo 
"\n\n<script Language=\"JavaScript\"><!--\n";
    echo 
"function Form_Validator(theForm) {\n";
        echo 
"    exit=false;\n";
        echo 
"    if (theForm.rating.selectedIndex == 0) {\n";
        echo 
"      alert(\"$lang[in_chose]\");\n";
    echo 
"      theForm.rating.focus();\n";
        echo 
"      return (false);\n";
    echo 
"    }\n";
        echo 
"    return (true);\n";
    echo 
"} //--></script>\n\n";
        echo 
"<form action=\"in.php\" method=\"post\" onsubmit=\"return Form_Validator(this)\" name=\"Form\">\n";
    echo 
"<select name=rating size=1>\n";
        echo 
"<option selected value=0>تقييم الموقع</option>\n";
    echo 
"<option value=1>1 (الأسوأ)</option>\n";
        echo 
"<option value=2>2</option>\n";
    echo 
"<option value=3>3</option>\n";
        echo 
"<option value=4>4</option>\n";
    echo 
"<option value=5>5</option>\n";
        echo 
"<option value=6>6</option>\n";
    echo 
"<option value=7>7</option>\n";
        echo 
"<option value=8>8</option>\n";
    echo 
"<option value=9>9</option>\n";
        echo 
"<option value=10>10 (الأفضل)</option>\n";
        echo 
"</select>&nbsp;&nbsp;\n";
    } else {
    echo 
"<form action=\"in.php\" method=\"post\" name=\"Form\">\n";
    }
    echo 
"<input type=submit name=vote value=\"$lang[in_vote]\">\n";
    echo 
"<input type=hidden name=site value=\"$site\">\n";
    echo 
"<input type=hidden name=referer value=\"$HTTP_REFERER\">\n";

    echo 
"</form>\n";

    echo 
"<a href=$list_url/list.php?status=NOV$catlink onclick=\"exit=false\">$lang[in_msg3]</a></div>\n";

    include(
$infooter);

  } elseif(!empty(
$vote) && !eregi("$list_url/in.php",$HTTP_REFERER) && $gateway) {

    
header("location: $list_url/list.php?status=NOR$catlink");

  } elseif(
$result) {

    
$status="OK";

    if (
$bad_ips) {
    if(
check_bad_ips($ipaddr) || $HTTP_COOKIE_VARS["BanCookie"]) {
            
$status="BAN";
        
$cookietime=time()+($banip_cookietime*24*3600);
        
setcookie("BanCookie""1""$cookietime""$cookiepath");
    }
    }

    if (
$cookievotesonly) {     // check testcookie
        
if($HTTP_COOKIE_VARS["CheckCookie_$site"] != 1){
            
$status="NOC";
    } else {
        
setcookie("CheckCookie_$site""""""$cookiepath");  //delete checkcookie
    
}
    }

    if (
$anti_cheating && $status=="OK") {    // anti-cheating
    
$votetimestamp=time()-($vote_timeout*3600);
    
$sql "SELECT * FROM votes WHERE id='$site' AND timestamp>'$votetimestamp' AND ip='$ipaddr' AND status='OK'";
    
$query mysql_db_query($database$sql) or die(geterrdesc($sql));
    
$votesresult mysql_fetch_array($query);

    if (
$votesresult) {
        
$status="NOK";
    }

        if(
$HTTP_COOKIE_VARS["phpListPro_$site"] != 1){
        
$cookietime=time()+($vote_timeout*3600);
        
setcookie("phpListPro_$site""1""$cookietime""$cookiepath");
    } else {
            
$status="NOK";
    }


    }

    if (
$tilt_insp) {        // check cheating

    
$tilttimestamp=time()-($tilt_insp_timeframe*60);

    
$sql "SELECT id FROM votes WHERE id='$site' AND timestamp>'$tilttimestamp' AND status='OK'";
    
$query mysql_db_query($database$sql) or die(geterrdesc($sql));
    
$tiltresultok mysql_num_rows($query);

    if (
$tiltresultok>=$tilt_insp_maxvotesok) {
        
$status="TILT";
    }

    
$sql "SELECT id FROM votes WHERE id='$site' AND timestamp>'$tilttimestamp' AND status='NOK'";
    
$query mysql_db_query($database$sql) or die(geterrdesc($sql));
    
$tiltresultnok mysql_num_rows($query);

    if (
$tiltresultnok>=$tilt_insp_maxvotesnok) {
        
$status="TILT";
    }

    if (
$status=="TILT") {            // ban this site for $tilt_insp_timeout

        
$sql "SELECT * FROM sites WHERE id='$site' ";
        
$query mysql_db_query($database$sql) or die(geterrdesc($sql));
        
$result mysql_fetch_array($query);

        
$tilt_time=time()+($tilt_insp_timeout*60);
        
$sql "UPDATE sites SET tilt_time='$tilt_time' WHERE id='$site'";
            
mysql_db_query($database$sql) or die(geterrdesc($sql));

        if (
$result[tilt_time]<($tilt_time-(2*$tilt_insp_timeout*60))) { // check if this is a new tilt
        
if ($tilt_insp_adminnotify) {    // send notification to admin
            
mail_tiltuser($result);
        }
        if (
$tilt_insp_sitenotify) {    // send notification to site-admin
            
mail_tiltadmin($result);
        }
        }


    }

    }


    if (
$show_rating && $gateway && $vote && $rating && $rating<=10) {
    if (
$status=="OK") {
        
$newrating=round((($result[votes]*$result[rating])+$rating)/($result[votes]+1)*10)/10;
        
$sql "UPDATE sites SET votes=votes+1,rating='$newrating' WHERE id='$site'";
            
mysql_db_query($database$sql) or die(geterrdesc($sql));
    }
    
$sql "INSERT INTO votes VALUES ('$site','$ipaddr','".time()."','$referer','$status')";
    
mysql_db_query($database$sql) or die(geterrdesc($sql));
    } elseif (
$status=="OK") {
    if (
$status=="OK") {
        
$sql "UPDATE sites SET votes=votes+1 WHERE id='$site'";
            
mysql_db_query($database$sql) or die(geterrdesc($sql));
    }
    
$sql "INSERT INTO votes VALUES ('$site','$ipaddr','".time()."','$HTTP_REFERER','$status')";
    
mysql_db_query($database$sql) or die(geterrdesc($sql));
    }

    if (
$votelog_timeout>0) {          // delete old votelogs
    
if ($votelog_timeout<$vote_timeout) {$votelog_timeout=$vote_timeout;}
    
$deletetimestamp=time()-($votelog_timeout*3600);
        
$sql "DELETE FROM votes WHERE timestamp<'$deletetimestamp'";
    
mysql_db_query($database$sql) or die(geterrdesc($sql));
    }

    
header("location: $list_url/list.php?status=$status$catlink");

  } else {    
// ERROR - Site not found
    
header("location: $list_url/list.php?status=NF$catlink");
  }
} else {     
// ERROR - NO SiteId
    
header("location: $list_url/list.php?status=NF$catlink");
}

mysql_close();

?> 

and these important lines in config.php


$cookievotesonly = true; // enable ONLY votes with cookie-enabled browsers !!! (ture) or not (false)
// $gateway MUST true, for this function !!!
$cookiepath ="/"; // enter your listpro-url-path (eg. "/listpro/") here or "/" for hole domain

$exiturl = ""; // if you want an popup-window on exit, enter url here. "" is disabled
$outexiturl[0] = ""; // if you want an additional (advertising) exitwindow on outclick,
// enter url here. enter "SELFLINK" to open VoteGateway, "" is disabled.
$outexiturl[1] = ""; // possible url-array for random outexiturl generation
$outexiturl[2] = ""; // add as many you want ...
$outexiturl[3] = "";
__________________
No God Only ALLLAh
Reply With Quote
  #4 (permalink)  
Old 06-17-03, 01:55 PM
!!! HotCGIScripts !!!'s Avatar
!!! HotCGIScripts !!! !!! HotCGIScripts !!! is offline
Guru Programmer
 
Join Date: Jun 2003
Location: USA
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
Ok, there is 150 strings of code. I am not compiller to take a look on code and say "Hay, error is here", sorry.
And I could not run it on my server to see where is error too.

So, may be you could provide us with URL of your script? May be it could help us help you
Reply With Quote
  #5 (permalink)  
Old 06-17-03, 03:29 PM
SilkySmooth's Avatar
SilkySmooth SilkySmooth is offline
Newbie Coder
 
Join Date: Jun 2003
Location: In the PHP Engine :-)
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Hi,

I read through the code a few times and I didn't find any obvious errors (I'm sure the code was tested extensively before release anyway) so the next thing was compatibility.

I noticed there were two instances of $HTTP_COOKIE_VARS which have been deprecated in newer versions of PHP, I am not sure if this would cause output but as a suggestion, if your PHP is greater than PHP 4.1 then change those two instances to $_COOKIE and see if that makes any difference.
__________________
---------------------
-- SilkySmooth --
---------------------
Directory Share | Free phpLD Mods
Reply With Quote
  #6 (permalink)  
Old 06-17-03, 03:51 PM
msu msu is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
hey vb2vb

cuz of new php version u need to do the following

- go to the last line in config.php and delete spaces ..

and let the last line in config file is ( ?> )

i hope u got what i meant !!

if u didnt let me know and will send the new edited file

to you

good lock
__________________
not yet
Reply With Quote
  #7 (permalink)  
Old 06-17-03, 04:03 PM
vb2vb vb2vb is offline
Newbie Coder
 
Join Date: Jun 2003
Location: yeme
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
i attach

plz make edit and attch again


ok thnx alot


.txt

chnage to php
Attached Files
File Type: txt config.php.txt (9.3 KB, 546 views)
__________________
No God Only ALLLAh
Reply With Quote
  #8 (permalink)  
Old 06-17-03, 04:13 PM
vb2vb vb2vb is offline
Newbie Coder
 
Join Date: Jun 2003
Location: yeme
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
in.php
Attached Files
File Type: txt in.php.txt (7.1 KB, 510 views)
__________________
No God Only ALLLAh
Reply With Quote
  #9 (permalink)  
Old 06-17-03, 04:16 PM
msu msu is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
try it
Attached Files
File Type: zip config.zip (2.9 KB, 207 views)
__________________
not yet
Reply With Quote
  #10 (permalink)  
Old 06-17-03, 04:17 PM
vb2vb vb2vb is offline
Newbie Coder
 
Join Date: Jun 2003
Location: yeme
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
thnx i try it now
__________________
No God Only ALLLAh
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Formmail Script Fix - Cant display multiple list selections.. zamen PHP 3 05-02-04 09:59 AM
looking for a banned words list cath Script Requests 6 10-29-03 06:18 PM
file download problem ukyankee Perl 6 10-04-03 10:39 PM
help finding a mail list server mikestreb PHP 0 09-16-03 11:35 PM
jpGraph axis labeling problem Squeezer PHP 2 08-20-03 07:53 AM


All times are GMT -5. The time now is 06:03 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.