Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Sonda
Majcok12
post 8.03.2004, 23:22:19
Post #1





Grupa: Zarejestrowani
Postów: 54
Pomógł: 0
Dołączył: 20.02.2004

Ostrzeżenie: (0%)
-----


Mam problem ze skryptem sondy. Sonda dziala, ale za kazdym razem pojawia sie blad

Kod
Warning: date(): Windows does not support dates prior to midnight (00:00:00), January 1, 1970 in c:usrkrasnalwwwmajcok12pollvotepollvoteincpollfunctions.php on line 130



Warning: date(): Windows does not support dates prior to midnight (00:00:00), January 1, 1970 in c:usrkrasnalwwwmajcok12pollvotepollvoteincpollfunctions.php on line 132


a ten plik pollfunctions.php wyglada nastepujaco

[php:1:4c602db244]
<?php
include ("inc/textfileio.php");

function getIp() {
$remoteip = $_SERVER["REMOTE_ADDR"];
return $remoteip;
}


//votes aus $pollname.".tmp" auswerten...
function readPoll($pollname){
GLOBAL $items;
GLOBAL $ips;
GLOBAL $timestamps;
$votes = csv2array($pollname.".tmp");
for ($i = 0; $i < count($votes); $i++) {
$item = explode(";", $votes[$i]);
if ($item != "")
{$items[$i] = $item[0];
$ips[$i] = $item[1];
$timestamps[$i] = $item[2];
}
}
}


//Stimmen Zählen
//$items-Einträge mit $pollitems[$i] vergleichen
function countItems(){
GLOBAL $items;
GLOBAL $pollitems;
$pollitemsvalues = array();
$pollitemsvalues = $pollitems;
for ($i = 0; $i < count($pollitems); $i++) {
if (is_string($pollitemsvalues[$i])){
$pollitemsvalues[$i] = 0;
}
for ($j = 0; $j < count($items); $j++) {
if ($items[$j] == $pollitems[$i]){
$pollitemsvalues[$i] = $pollitemsvalues[$i] + 1;
}
}
}
return $pollitemsvalues;
}


// Quoten berechnen
function getPercent(){
GLOBAL $pollitemsvalues;
$total = 0;
$pollitemspercent = array();
$pollitemspercent = $pollitemsvalues;
for ($i = 0; $i < count($pollitemsvalues); $i++) {
$total = $total + $pollitemsvalues[$i];
}

for ($i = 0; $i < count($pollitemsvalues); $i++) {
if ($total == 0){
$total = 1;}
$pollitemspercent[$i] = round((100 * $pollitemsvalues[$i])/$total);
}
return $pollitemspercent;
}

//Check the limits
//duration of the poll in days: $duration = 365;
// checkDuration() --> TRUE FALSE
function checkDuration(){
GLOBAL $timestamps;
GLOBAL $duration;
GLOBAL $finished_by_duration;
$starttime = $timestamps[0];
if ($starttime == ""){
return TRUE;}
$thistime = time();
// 1 Tag in Sekunden = 86400;
$durationinsec = $duration * 86400;
$timespan = $thistime - $starttime;
if ($timespan < $durationinsec){
return TRUE;}
else {
echo "<center><font class="maxReachedMessage">".$finished_by_duration."</font></center><BR>";
return FALSE;}
}



// checkMaxPerItem() --> TRUE FALSE
function checkMaxPerItem(){
GLOBAL $maxperitem;
GLOBAL $finished_by_maxperitem;
$pollitemsvalues = array();
$pollitemsvalues = countItems();
for ($i = 0; $i <= count($pollitemsvalues); $i++){
if ($pollitemsvalues[$i] >= $maxperitem){
echo "<center><font class="maxReachedMessage">".$finished_by_maxperitem."</font></center><BR>";
return FALSE;
}
}
return TRUE;
}

//timeout untill next possible vote per IP in sec: $nextvoteperip = 60;
// checkNextVotePerIp() --> TRUE FALSE
function checkNextVotePerIp(){
GLOBAL $nextvoteperip;
GLOBAL $ips;
GLOBAL $timestamps;
GLOBAL $finished_by_voteperip;
$thisip = getIp();
$thistime = time();
for ($i = count($ips); $i >= 0; $i--){
if ($thisip == $ips[$i]){
$ipstime = $timestamps[$i];
$i = -1;
}
}
if (isset($ipstime)){
$timespan = $thistime - $ipstime;
$timelefthour = round((($nextvoteperip - $timespan)/60)/60);
$timeleftmin = date(i, ($nextvoteperip - $timespan));
$timelefthour = round(((($nextvoteperip - $timespan)/60) - $timeleftmin)/60);
$timeleftsec = date(s, ($nextvoteperip - $timespan));
if ($timespan <= $nextvoteperip){
echo "<center><font class="maxReachedMessage">".$finished_by_voteperip.$timelefthour.":".$timeleftmin.":".$timeleftsec."</font></center><BR>";
return FALSE;}
}
return TRUE;
}



//tmp-Datei in Array einlesen
function csv2array($csvfile)
{
$csvstring = readTextFile($csvfile);
// String in Array überführen
$csvdata = explode("n", $csvstring);
// Aufbau des Array
$stack = array ();
//Array Satz für Satz ausgeben
$length = count($csvdata);
for ($i = 0; $i < $length; $i++) {
if ($csvdata[$i] != ""){
$stack[$i] = $csvdata[$i];
}
}
return $stack;
}

?>
?>[/php:1:4c602db244]
No i teraz nie wiem gdzie jest jakis blad lub cokolwiek co powoduje generowanie bledu.

Pozdrawiam
Go to the top of the page
+Quote Post

Posty w temacie
- Majcok12   Sonda   8.03.2004, 23:22:19
- - kszychu   <?php // linia 122 na listingu $timeleftmin = d...   9.03.2004, 09:47:48
- - d12   Co to za sonda??   9.03.2004, 20:04:57
- - Majcok12   Z hotscripts, tyle ze ja pokazalem zawartosc tylko...   9.03.2004, 21:33:46


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 6.07.2025 - 10:26