CronJob-Service
bei SELFPHP mit ...
|
+ minütlichen Aufrufen
+ eigenem Crontab Eintrag
+ unbegrenzten CronJobs
+ Statistiken
+ Beispielaufrufen
+ Control-Bereich
Führen Sie mit den CronJobs von
SELFPHP zeitgesteuert Programme
auf Ihrem Server
aus. Weitere Infos
|
:: Anbieterverzeichnis ::
Globale Branchen
Informieren Sie sich über ausgewählte Unternehmen im Anbieterverzeichnis von SELFPHP
:: Newsletter ::
Abonnieren Sie hier den kostenlosen
SELFPHP Newsletter!
|
PHP Grundlagen Hier kann über grundlegende Probleme oder Anfängerschwierigkeiten diskutiert werden |
06.02.2003, 16:52:02
|
Anfänger
|
|
Registriert seit: Mar 2002
Ort: Neumünster (das liegt so bei Hamburg)
Alter: 36
Beiträge: 82
|
|
Cookie in Popup setzen?
Hallo!
Ich hab nen ziemlich dummes Problem...
Ich setze in einem Popup- Fenster, dass durch klicken auf ein Formularelement eine PHP- Datei öffnet ein Cookie.
Dieses möchte in in der "Hauptdatei" wieder auslesen...
leider klappt das nicht - es wird kein Cookie gesetzt :(
Code in der Popup- Datei:
Code:
setcookie("iksvote", "$id", time()+1000, "", "iks.neumuenster.de");
Code in der Hauptdatei:
Code:
$umfrage_cookie = $_COOKIE['iksvote'];
if ($umfrage_cookie != $voteid) {
//Code
}
Warum geht das nicht?
Die Site ist hier
Es geht um die Umfrage...
Danke
xStream
|
06.02.2003, 19:47:28
|
|
Um auf das Cookie zugreifen zu können mußt Du die Hauptseite neu laden. Ansonsten: vor dem setCookie - Befehl, darf nix stehen (keine Ausgabe an den Browser). Laß mal das letzte Attribut weg - da hängst oft!
|
06.02.2003, 21:32:44
|
Anfänger
|
|
Registriert seit: Mar 2002
Ort: Neumünster (das liegt so bei Hamburg)
Alter: 36
Beiträge: 82
|
|
Erstmal danke!
Hab das jetzt alles ausporbiert - aber es hilft nicht :(
In einer Testdatei ist das kein Problem.... hab die selben Befehle genommen - ich weiss das ist eigentlich unmöglich - kann es evt. am Javascript für das neue Fenster liegen? Ich weiss das ist unrealistisch aber sonst kann das echt nicht sein *verzweifel*
|
06.02.2003, 21:35:41
|
|
Eigentlich nicht - könnte es sein, dass der Browser keine Cookies aktzeptiert, oder schon irgendwas anderes an ihn geschickt worden ist?
|
06.02.2003, 21:39:40
|
Anfänger
|
|
Registriert seit: Mar 2002
Ort: Neumünster (das liegt so bei Hamburg)
Alter: 36
Beiträge: 82
|
|
da ich einfach nicht weiter weiss hier mein doch sehr unsauber Programmierter Code für das Pop- Up- Fenster - habe ich vor langer Zeit mal geschrieben, ich weiss das er ja soo unübersichtlich ist, aber wichtig ist ja eigentlich nur die erste Zeile !?
Code:
<?PHP
setcookie("iksvote", "$id", time()+100, "", "iks.neumuenster.de");
include("../sql.php");
//Vote suchen...
$vote_d_suchen = mysql_query("SELECT * FROM iks_umfrage WHERE id = '$id'");
while ($vote_d = mysql_fetch_object($vote_d_suchen)) {
//Auslesen der vorhandenen Stimen...
$an1 = $vote_d->v1;
$an2 = $vote_d->v2;
$an3 = $vote_d->v3;
$an4 = $vote_d->v4;
$an5 = $vote_d->v5;
$an6 = $vote_d->v6;
$ip_old = $vote_d->ip;
$my_ip = $REMOTE_ADDR;
if ($ip_old != $my_ip) {
mysql_query ("UPDATE iks_umfrage SET ip = '$my_ip' WHERE id = '$id'");
//Ändern der Werte...
if ($vote == "a1") { $an1++; mysql_query ("UPDATE iks_umfrage SET v1 = '$an1' WHERE id = '$id'"); }
if ($vote == "a2") { $an2++; mysql_query ("UPDATE iks_umfrage SET v2 = '$an2' WHERE id = '$id'"); }
if ($vote == "a3") { $an3++; mysql_query ("UPDATE iks_umfrage SET v3 = '$an3' WHERE id = '$id'"); }
if ($vote == "a4") { $an4++; mysql_query ("UPDATE iks_umfrage SET v4 = '$an4' WHERE id = '$id'"); }
if ($vote == "a5") { $an5++; mysql_query ("UPDATE iks_umfrage SET v5 = '$an5' WHERE id = '$id'"); }
if ($vote == "a6") { $an6++; mysql_query ("UPDATE iks_umfrage SET v6 = '$an6' WHERE id = '$id'"); }
}
$v_gesamt = $an1 + $an2 + $an3 + $an4 + $an5 + $an6;
$pro1 = $an1 * 100 / $v_gesamt; $pro1 = round($pro1, 2);
$pro2 = $an2 * 100 / $v_gesamt; $pro2 = round($pro2, 2);
$pro3 = $an3 * 100 / $v_gesamt; $pro3 = round($pro3, 2);
$pro4 = $an4 * 100 / $v_gesamt; $pro4 = round($pro4, 2);
$pro5 = $an5 * 100 / $v_gesamt; $pro5 = round($pro5, 2);
$pro6 = $an6 * 100 / $v_gesamt; $pro6 = round($pro6, 2);
$gfx_fakt = 1;
$gfx_breite = 60;
$gfx_links = 2;
$gfx1 = $pro1 * $gfx_fakt;
$gfxr1 = $gfx_breite - $gfx1 - $gfx_links;
$gfx2 = $pro2 * $gfx_fakt;
$gfxr2 = $gfx_breite - $gfx2 - $gfx_links;
$gfx3 = $pro3 * $gfx_fakt;
$gfxr3 = $gfx_breite - $gfx3 - $gfx_links;
$gfx4 = $pro4 * $gfx_fakt;
$gfxr4 = $gfx_breite - $gfx4 - $gfx_links;
$gfx5 = $pro5 * $gfx_fakt;
$gfxr5 = $gfx_breite - $gfx5 - $gfx_links;
$gfx6 = $pro6 * $gfx_fakt;
$gfxr6 = $gfx_breite - $gfx6 - $gfx_links;
?>
<title>::Voting [Ergebnisse]</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../iks_main.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0">
<table width="300" height="400" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="28" rowspan="3"><img src="../img/if/umfrage_box/oben_links.jpg"></td>
<td colspan="2"><img src="../img/if/umfrage_box/oben_mitte.jpg" ></td>
</tr>
<tr>
<td width="237" height="49" align="center" valign="middle" background="../img/if/umfrage_box/frage_back.jpg">
<b><?PHP echo $vote_d->frage; ?></b></td>
<td width="35" background="../img/if/umfrage_box/rvh.jpg"> </td>
</tr>
<tr>
<td colspan="2"><img src="../img/if/umfrage_box/uvfrage.jpg"><img src="../img/if/umfrage_box/oben_rechts.jpg"></td>
</tr>
</table></td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="28" background="../img/if/umfrage_box/lvc.jpg"> </td>
<td width="237" height="235" valign="top" background="../img/if/umfrage_box/content_back.jpg">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="52%">
<?PHP
$spacer = "";
$height = " height='25' ";
echo"
<tr $heigt>
<td width='90' $heigt>$vote_d->a1</td>
<td width='32'>$vote_d->v1</td>
<td width='32'>$pro1</td>
<td width='95'>
<table border='0' width='$gfx_breite' cellspacing='0' cellpadding='0'>
<tr>
<td width='$gfx_links'><img border='0' src='../img/if/umfrage_box/balken_links.jpg'></td>
<td width='$gfx1' background='../img/if/umfrage_box/balken_mitte.jpg'>
</td>
<td width='$gfxr1'><img border='0' src='../img/if/umfrage_box/balken_rechts.jpg'></td>
</tr>
</table>$spacer</td>
</tr>
";
echo"
<tr $heigt>
<td width='90' $heigt>$vote_d->a2</td>
<td width='32'>$vote_d->v2</td>
<td width='32'>$pro2</td>
<td width='95'>
<table border='0' width='$gfx_breite' cellspacing='0' cellpadding='0'>
<tr>
<td width='$gfx_links'><img border='0' src='../img/if/umfrage_box/balken_links.jpg'></td>
<td width='$gfx2' background='../img/if/umfrage_box/balken_mitte.jpg'>
</td>
<td width='$gfxr2'><img border='0' src='../img/if/umfrage_box/balken_rechts.jpg'></td>
</tr>
</table>$spacer</td>
</tr>
";
if($vote_d->a3 != "") {
echo"
<tr $heigt>
<td width='90' $heigt>$vote_d->a3</td>
<td width='32'>$vote_d->v3</td>
<td width='32'>$pro3</td>
<td width='95'>
<table border='0' width='$gfx_breite' cellspacing='0' cellpadding='0'>
<tr>
<td width='$gfx_links'><img border='0' src='../img/if/umfrage_box/balken_links.jpg'></td>
<td width='$gfx3' background='../img/if/umfrage_box/balken_mitte.jpg'>
</td>
<td width='$gfxr3'><img border='0' src='../img/if/umfrage_box/balken_rechts.jpg'></td>
</tr>
</table>$spacer</td>
</tr>
";
}
if($vote_d->a4 != "") {
echo"
<tr $heigt>
<td width='90' $heigt>$vote_d->a4</td>
<td width='32'>$vote_d->v4</td>
<td width='32'>$pro4</td>
<td width='95'>
<table border='0' width='$gfx_breite' cellspacing='0' cellpadding='0'>
<tr>
<td width='$gfx_links'><img border='0' src='../img/if/umfrage_box/balken_links.jpg'></td>
<td width='$gfx4' background='../img/if/umfrage_box/balken_mitte.jpg'>
</td>
<td width='$gfxr4'><img border='0' src='../img/if/umfrage_box/balken_rechts.jpg'></td>
</tr>
</table>$spacer</td>
</tr>
";
}
if($vote_d->a5 != "") {
echo"
<tr $heigt>
<td width='90' $heigt>$vote_d->a5</td>
<td width='32'>$vote_d->v5</td>
<td width='32'>$pro5</td>
<td width='95'>
<table border='0' width='$gfx_breite' cellspacing='0' cellpadding='0'>
<tr>
<td width='$gfx_links'><img border='0' src='../img/if/umfrage_box/balken_links.jpg'></td>
<td width='$gfx5' background='../img/if/umfrage_box/balken_mitte.jpg'>
</td>
<td width='$gfxr5'><img border='0' src='../img/if/umfrage_box/balken_rechts.jpg'></td>
</tr>
</table>$spacer</td>
</tr>
";
}
if($vote_d->a6 != "") {
echo"
<tr $heigt>
<td width='90' $heigt>$vote_d->a6</td>
<td width='32'>$vote_d->v6</td>
<td width='32'>$pro6</td>
<td width='95'>
<table border='0' width='$gfx_breite' cellspacing='0' cellpadding='0'>
<tr>
<td width='$gfx_links'><img border='0' src='../img/if/umfrage_box/balken_links.jpg'></td>
<td width='$gfx6' background='../img/if/umfrage_box/balken_mitte.jpg'>
</td>
<td width='$gfxr6'><img border='0' src='../img/if/umfrage_box/balken_rechts.jpg'></td>
</tr>
</table></td>
</tr>
";
}
?>
</table>
</td>
<td width="35" background="../img/if/umfrage_box/rvc.jpg"> </td>
</tr>
</table></td>
</tr>
<tr>
<td width="300" height="69" background="../img/if/umfrage_box/unten.jpg">
<div align="center"> <font color="#E1E1E1" size="2"><a href="javascript:close();"> <br>
<br>
fenster schließen</a></font></div></td>
</tr>
</table>
<p> </p></body>
<?PHP }
?>
</html>
Zum Testen habe ich mal eine datei test.php esrtellt. Zum Ausgeben des Cookies test.php?show=1 an die url anhängen... Dort geht es...
hier der Code:
Code:
<?PHP
if ($show == 1) {
$cookie = $_COOKIE['iksvote'];
echo "Inhalt des Cookies: $cookie";
}
else {
$id = "Test3";
setcookie("iksvote", "$id", time()+100, "", "iks.neumuenster.de");
echo "Cookie gesetzt";
}
?>
Danke für die Mühen
Philipp
Geändert von xStream (06.02.2003 um 21:42:06 Uhr)
|
06.02.2003, 21:43:23
|
|
Also, das Cookie geht bei mir! Seltsam Seltsam! Evtl. mal die letzen zwei Attribute weglassen, obwohl es daran, ja eigentlich nicht liegen dürfte!
|
06.02.2003, 21:44:46
|
Anfänger
|
|
Registriert seit: Mar 2002
Ort: Neumünster (das liegt so bei Hamburg)
Alter: 36
Beiträge: 82
|
|
Zitat:
Original geschrieben von Ben20
Also, das Cookie geht bei mir! Seltsam Seltsam! Evtl. mal die letzen zwei Attribute weglassen, obwohl es daran, ja eigentlich nicht liegen dürfte!
|
ja habe ich auch schon ausprobiert :(
|
Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
|
|
Forumregeln
|
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.
HTML-Code ist aus.
|
|
|
Alle Zeitangaben in WEZ +2. Es ist jetzt 12:45:26 Uhr.
|