Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> 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
kszychu
post 9.03.2004, 09:47:48
Post #2





Grupa: Przyjaciele php.pl
Postów: 2 712
Pomógł: 23
Dołączył: 27.10.2003
Skąd: z kontowni

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


[php:1:289fe071a5]<?php
// linia 122 na listingu
$timeleftmin = date(i, ($nextvoteperip - $timespan));
// i 124
$timeleftsec = date(s, ($nextvoteperip - $timespan));
?>[/php:1:289fe071a5]
Co to za składnia?
Mnie w szkółce niedzielnej uczyli czegoś takiego:
[php:1:289fe071a5]<?php
$timeleftsec = date("s", ($nextvoteperip - $timespan));
$timeleftmin = date("i", ($nextvoteperip - $timespan));
?>[/php:1:289fe071a5]


--------------------
"Coś się kończy, coś się zaczyna." Andrzej Sapkowski
Go to the top of the page
+Quote Post
d12
post 9.03.2004, 20:04:57
Post #3





Grupa: Zarejestrowani
Postów: 100
Pomógł: 0
Dołączył: 25.08.2003
Skąd: Bielsko-Biała

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


Co to za sonda??


--------------------
Pozdro D12
GG: 5455157; Email: redakcja@motoweb.pl
Go to the top of the page
+Quote Post
Majcok12
post 9.03.2004, 21:33:46
Post #4





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

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


Z hotscripts, tyle ze ja pokazalem zawartosc tylko pliku pollfunctions.php bo do tego pliku odnosil sie blad. A plikow jest troche wiecej.
Go to the top of the page
+Quote Post

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: 27.06.2025 - 18:49