We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Mini Poll Help
Topic Started: Jun 6 2005, 10:14 PM (360 Views)
commander-ZNS
Member
[ *  *  *  * ]
Hey guys I downloaded this mini poll script from this site http://www.mr-corner.com/LittlePoll/index.html . I don't know anything about php but the steps are so simple they I fully understand how to set it up. But the problem is that after I am done setting it up this is the error I get on my site http://k-gfx.ahost4free.com/ . Please soneone help.
Offline Profile Quote Post Goto Top
 
Das
Member Avatar
Smells of rich mahogany
[ *  *  *  *  *  *  * ]
Can you show us the file that corresponds to "/home/commande/public_html/lp_source.php" ?
Offline Profile Quote Post Goto Top
 
commander-ZNS
Member
[ *  *  *  * ]
I don't understand what you mean. But if you want to see the lp_source.php file, just download the minipoll script from the site and its in there.
Offline Profile Quote Post Goto Top
 
Das
Member Avatar
Smells of rich mahogany
[ *  *  *  *  *  *  * ]
Can you just show us the sorce? I cannot currently download.
Offline Profile Quote Post Goto Top
 
commander-ZNS
Member
[ *  *  *  * ]
Ok don't understand what you mean by show use the source but I can show you the text in lp_source.php. Its is the follwoing

Code:
 
<?php

include("lp_settings.inc"); //include file containing general settings
import_request_variables("p", "p_"); //import POST variables
import_request_variables("c", "c_"); //import cookie variables

if (!isset($c_votingstep)) {
$votingstep=1;
} else { $votingstep = $c_votingstep; }

function SumArray($arr) {
$h=count($arr); $in=0; $m=0;
while ($in<$h) { $m += $arr[$in]; $in++; }
return $m;
}

function getIP() {
if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");
else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR");
else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
else $ip = "UNKNOWN";
return $ip;
}

function write2log ($linetoadd) {
$rightnow=date("F j, Y, g:i a");
$fplog=fopen('lp_log.dat', "a");
fputs($fplog, getIP()."|".$rightnow."|".$linetoadd."\n");
fclose($fplog);
}

function ReadElements() {
global $filename;
$fp=fopen($filename, "r");
$file_contents=fread($fp,filesize($filename)-1);
fclose($fp);
$elements=explode(":",$file_contents);
$h=(count($elements)-1)/2;
$question=stripslashes($elements[0]);
$in=0;
while ($h>$in) {
 $item[$in]=$elements[(2*$in+1)];
 $itemvoted[$in]=$elements[(2*$in+2)];
 $in++;
}
return array ($item, $itemvoted, $question);
}

list ($item, $itemvoted, $question) = ReadElements();

if(isset($c_pollidcookie)) {
if ($question != stripslashes($c_pollidcookie)) {
$votingstep=1;
}
}
setcookie("pollidcookie", $question, time()+$time_between_votes);

if (isset($votingstep)) {
 function ShowTheStuff($item, $itemvoted, $graph_width, $graph_height) {
 $hector=count($itemvoted);$totalvotes=0;$in=0;$stepstr='';
 $totalvotes=SumArray($itemvoted);
 $in=0;
 if ($totalvotes==0) { $totalvotes=0.0001; }
 while ($in<$hector) {
  $stepstr=$stepstr.stripslashes($item[$in]).': '.(int)(($itemvoted[$in]/$totalvotes)*100).'%<br>';
  $timesred=(int)((($itemvoted[$in]/$totalvotes))*$graph_width);
  $stepstr=$stepstr.'<img height='.$graph_height.' width='.$timesred.' src="lp_1.gif"><img height='.$graph_height.' width='.($graph_width-$timesred).' src="lp_0.gif"><br><br>';
  $in++;
 }
 return $stepstr;
}
}

if (!isset($votingstep)) {
$votingstep=1;
}

if ($votingstep==2) {
if(!isset($p_radios)){
 $votingstep=1;
 write2log("Clicked vote button without choosing an item");
} // detect if someone has clicked the voting button without choosing an item
}

if ($votingstep==1) {
write2log("Enters Poll");
setcookie("votingstep","2",time()+$time_between_votes);
$mainstr=$message1;
$step1str='<form action="'.$callingfile.'" method="post" name="form1">';
$totalvotes=SumArray($itemvoted);
$in=0;
$datop=count($item);
while($in<$datop){
 $step1str=$step1str.'<input type="radio" name="radios" value="'.$in.'"> '.stripslashes($item[$in]).'<br>';
 $in++;
}
$step1str=$step1str.'<br><input style="'.$buttonstyle.'" type="Submit" value="'.$vote_str.'"></form>';
}

if ($votingstep==2) {
setcookie("votingstep","3",time()+$time_between_votes);
$mainstr=$message2;
$itemvoted[$p_radios]=$itemvoted[$p_radios]+1;
$totalvotes=SumArray($itemvoted);
$fp=fopen($filename, "w");
$hector=count($item);
$in=0;
$linetoadd=$question.':';
fputs($fp, $linetoadd);
while($in<$hector) {
 $linetoadd=$item[$in].':'.$itemvoted[$in].':';
 fputs($fp, $linetoadd);
 $in++;
}
fclose($fp);
write2log("Vote received on ".$item[$p_radios]);
$step2str=ShowTheStuff($item, $itemvoted, $graph_width, $graph_height);
}
if ($votingstep==3) {
$mainstr=$message3;
$totalvotes=SumArray($itemvoted);
write2log("Views results");
$step3str=ShowTheStuff($item, $itemvoted, $graph_width, $graph_height);
}

?>
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply