PHP-Logo
Druckansicht von http://www.php-homepage.de/scripts/source_113.html

PHP-Logo
[ Main Menue ]
Homepage
Downloads
Artikel
Scripts
Forum
PHP-Manual
Links
News
Freelancer
Bücher
RuDolF
Suche
Misc
Über diese Seite
Kontakt
Wunschzettel
MyGuestbook
*
[ Suche ]
*
[ Partner ]


Domain Webhosting
*
[ Partner Sites ]
Dynamic-Webpages
PHP-Center
PHP-Welt
phpUG.de
Random Link
*
[ Autoren gesucht! ]
PHP-Homepage.de sucht laufend Autoren für News und Artikel
Interesse?
*

Follow on Twitter - @phphomepage

RSS Feed blogoscoop

[Start] [Suche] [Neue Einträge

disi-poll

<?php
//############################################
//# DiSi-Poll Version 1.0.0 #
//# simple PHP-Voting-Script #
//# #
//# you may use and modify this #
//# Script, as long as you include #
//# this Note #
//# #
//# Peter Petermann #
//# webmaster@cyberfly.net #
//############################################
//# to use this script, just configure #
//# and include it #
//############################################

//############################################
//# settings #
//############################################

$question = "How you like this Script?";
// Your question goes here =)

$answers = array(
// Posible Answers
"answer1" => "Great",
"answer2" => "Ok",
"answer3" => "Suxx"
);
$cookietime = time()+ 3600;
// Time how long user is not allowed to vote again
$cookiename = "disipoll";
// Name of the cookie

$answerprefix = "&nbsp;&nbsp;-&nbsp;";
//prefix for answers
$answersuffix = "<br />";
//suffix for answers
$questionprefix = "<font color=\"#FF0000\">";
//prefix for questions
$questionsuffix = "</font><br />";
//suffix for questions
$varprefix = "disipoll";
//prefix for answervar used in url
$storefile ="disipoll.txt";
//name of file where data is stored
$backfile = "index.php";
//file to jump to when vote is placed

//############################################
//# Configuration ends here, please #
//# do not modify code from here #
//# until you know what youre doing! #
//############################################
if(empty($$cookiename) && empty(${$varprefix ."answer"}))
{
echo $questionprefix . $question .$questionsuffix;
foreach($answers AS $id => $content)
{
echo "$answerprefix<a href=\"disipoll.php?" . $varprefix
."answer=$id\">$content</a>$answersuffix";
}
} elseif(empty($$cookiename) && !empty(${$varprefix ."answer"}))
{
if(file_exists($storefile))
{
$votes = unserialize(join('', file($storefile)));
}
$votes[${$varprefix ."answer"}]++;
$file = fopen($storefile, "w+");
fputs($file, serialize($votes));
fclose($file);
setcookie($cookiename, "1" , $cookietime);
echo "<html><head><meta http-equiv=\"refresh\" content=\"0;
URL=$backfile\"></head></html>
";
} else {
echo $questionprefix . $question .$questionsuffix;
$votes = unserialize(join('', file($storefile)));
foreach($answers AS $id => $content)
{
echo "$answerprefix ";
printf("%01.0f", $votes[$id]);
echo " $content $answersuffix";
}
}
?>
© Copyright 1999 - 2011 by Mark Kronsbein | Impressum | NutzungsbedingungenWeiterempfehlen | Seitenanfang
0.2827