Nighthawk33
Komplett-PC-Aufrüster(in)
Also, ein paar Kumpels und ich haben eine Webseite gebastelt !!
Nun wollen wir, da wir dabei sind einige Flashgames darauf zu machen, zwei Dinge tun:
1. Ein Rating-System, damit man die Spiele mit Sternen von 1-5 bewerten kann.
2. Ein wirklich sehr kleines PHP-Script, welches lediglich die Klicks auf die Spiele zählt, also wie oft das jeweilige Spiel gespielt wurde.
1. Wir haben uns auch bereits einen Code dafür runtergeladen, allerdings sind wir wirklich richtige PHP-Anfänger und wissen nicth so recht was wir damit machen sollen, also das wäre mal der Code, den Pfad zu den Grafiken habe ich bereits eingefügt:
Allerdings, wenn ich jetzt mal auf eine html-Seite einfach einen Link setze auf eine .php Seite wo ich diesen Codeabshcnitt eingefügt habe (natürlich alles samt Grafiken hochgeladen) passiert nichts???
Was muss ich noch machen??
Das komplette Paket sah so aus:
2. Das Zweite ist wohl wesintlich einfacher und bezieht sich im Prinzip auch auf das erste, sobald ich weiß was ich beim einfügen flashc mache, dürfte dieses Problem auch gelöst sein....
DANKE
Nun wollen wir, da wir dabei sind einige Flashgames darauf zu machen, zwei Dinge tun:
1. Ein Rating-System, damit man die Spiele mit Sternen von 1-5 bewerten kann.
2. Ein wirklich sehr kleines PHP-Script, welches lediglich die Klicks auf die Spiele zählt, also wie oft das jeweilige Spiel gespielt wurde.
1. Wir haben uns auch bereits einen Code dafür runtergeladen, allerdings sind wir wirklich richtige PHP-Anfänger und wissen nicth so recht was wir damit machen sollen, also das wäre mal der Code, den Pfad zu den Grafiken habe ich bereits eingefügt:
PHP:
} else {
$nouveau_compteur=fopen($ficdest, "w");
$remoteAddress = $_SERVER['REMOTE_ADDR'];
fputs($nouveau_compteur, "1|||$remoteAddress|");
fclose($nouveau_compteur);
}
if (!empty($_POST['submitted'])) {
$vote=fopen($ficdest, "r");
$old_stats=file($ficdest);
$stats=explode("|", $old_stats[0]);
fclose($vote);
$nbr_votes=$stats[1];
$moy_votes=$stats[2];
if ($stats[4] != $_SERVER['REMOTE_ADDR']) {
$nbr_votes +=1;
$moy_votes=((($stats[1]*$stats[2])+$note)/$nbr_votes);
} else {
echo '<font face="Verdana" size="2" color="red">Sie haben schon abgestimmt</font>';
}
$ip_vote=$_SERVER['REMOTE_ADDR'];
$vote=fopen($ficdest, "w");
$new_stats=fputs($vote, "$new_count|$nbr_votes|$moy_votes|$stats[3]|$ip_vote");
fclose($vote);
}
if($_GET['action'] != "overview") {
print ("<form method=post>");
}
$old_stats=file($ficdest);
$stats=explode("|", $old_stats[0]);
if ($stats[2]>=5)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/5star.gif" ;
}
if ($stats[2]<=4.5)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/45star.gif" ;
}
if ($stats[2]<=4)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/4star.gif" ;
}
if ($stats[2]<=3.5)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/35star.gif" ;
}
if ($stats[2]<=3)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/3star.gif" ;
}
if ($stats[2]<=2.5)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/25star.gif" ;
}
if ($stats[2]<=2)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/2star.gif" ;
}
if ($stats[2]<=1.5)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/15star.gif" ;
}
if ($stats[2]<=1)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/1star.gif" ;
}
if ($stats[2]<=0.5)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/05star.gif" ;
}
if ($stats[2]<=0)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/00star.gif" ;
}
Allerdings, wenn ich jetzt mal auf eine html-Seite einfach einen Link setze auf eine .php Seite wo ich diesen Codeabshcnitt eingefügt habe (natürlich alles samt Grafiken hochgeladen) passiert nichts???
Was muss ich noch machen??
Das komplette Paket sah so aus:
PHP:
<?
/********* PHP RATING SYSTEM v1.7 ************
Copyright 2002, Cgixp.netfirms.com
You have to leave the copyright.
If you have any problem just let us know.
E-mail: alipf@myecom.net
Website: http://www.cgixp.netfirms.com
Deutsche Übersetzung: Sebastian Baumann
Webseite: http://www.scriptworker.com
Last change: 27.09.2008
**********************************************/
// Pfad zum Script (ohne Slash am Ende)
$path= "/01_baumedia/scriptworker/scripte/php/php_rating_system/php_rating_system";
$ficdest=explode(".",basename($_SERVER['PHP_SELF']));
$ficdest=$ficdest[0].".dat";
// Wenn dat Datei vorhanden
if(file_exists($ficdest)) {
$compteur=fopen($ficdest, "r");
$old_stats=file($ficdest);
$stats=explode("|", $old_stats[0]);
fclose($compteur);
$new_count=$stats[0];
if ($stats[3] != $_SERVER['REMOTE_ADDR']) {
$new_count +=1;
}
$ip_hit=$_SERVER['REMOTE_ADDR'];
$compteur=fopen($ficdest, "w");
fputs($compteur, "$new_count|$stats[1]|$stats[2]|$ip_hit|$stats[4]");
fclose($compteur);
// Ansonsten anlegen
} else {
$nouveau_compteur=fopen($ficdest, "w");
$remoteAddress = $_SERVER['REMOTE_ADDR'];
fputs($nouveau_compteur, "1|||$remoteAddress|");
fclose($nouveau_compteur);
}
if (!empty($_POST['submitted'])) {
$vote=fopen($ficdest, "r");
$old_stats=file($ficdest);
$stats=explode("|", $old_stats[0]);
fclose($vote);
$nbr_votes=$stats[1];
$moy_votes=$stats[2];
if ($stats[4] != $_SERVER['REMOTE_ADDR']) {
$nbr_votes +=1;
$moy_votes=((($stats[1]*$stats[2])+$note)/$nbr_votes);
} else {
echo '<font face="Verdana" size="2" color="red">Sie haben schon abgestimmt</font>';
}
$ip_vote=$_SERVER['REMOTE_ADDR'];
$vote=fopen($ficdest, "w");
$new_stats=fputs($vote, "$new_count|$nbr_votes|$moy_votes|$stats[3]|$ip_vote");
fclose($vote);
}
if($_GET['action'] != "overview") {
print ("<form method=post>");
}
$old_stats=file($ficdest);
$stats=explode("|", $old_stats[0]);
if ($stats[2]>=5)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/5star.gif" ;
}
if ($stats[2]<=4.5)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/45star.gif" ;
}
if ($stats[2]<=4)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/4star.gif" ;
}
if ($stats[2]<=3.5)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/35star.gif" ;
}
if ($stats[2]<=3)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/3star.gif" ;
}
if ($stats[2]<=2.5)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/25star.gif" ;
}
if ($stats[2]<=2)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/2star.gif" ;
}
if ($stats[2]<=1.5)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/15star.gif" ;
}
if ($stats[2]<=1)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/1star.gif" ;
}
if ($stats[2]<=0.5)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/05star.gif" ;
}
if ($stats[2]<=0)
{
$star = "$C:/Users/Andy/Desktop/Rating-System/images/00star.gif" ;
}
// Wenn keine Bewertung bislang
if($stats[2] == 0){
echo '<font size="1" face="Verdana" color="#999999">Bewertung: <img src="'.$star.'" alt="Noch nicht bewertet" title="Noch nicht bewertet"></font>';
}else{
// stats runden
$counting = round($stats[2],2);
$counting = number_format($counting, 2);
// Ergebnis ausgeben
echo '<font size="1" face="Verdana" color="#999999">Bewertung: <img src="'.$star.'" alt="Durchschnittliche Bewertung: '.$counting.'" title="Durchschnittliche Bewertung: '.$counting.'"> '.$stats[1].' Bewertung(en)</font>';
}
if($_GET['action'] != "overview") {
echo ' <select name="note">';
for ($i=1; $i<=5; $i++) {
echo '<option value='.$i.'>'.$i;
}
echo ' </select> <input type="hidden" name="submitted" value="1"><input type=submit value="bewerten">';
echo '</form></font>';
}
?>
2. Das Zweite ist wohl wesintlich einfacher und bezieht sich im Prinzip auch auf das erste, sobald ich weiß was ich beim einfügen flashc mache, dürfte dieses Problem auch gelöst sein....
DANKE