SELFPHP: Version 5.8.2 Befehlsreferenz - Tutorial – Kochbuch – Forum für PHP Einsteiger und professionelle Entwickler

SELFPHP


Professional CronJob-Service

Suche



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



:: Buchempfehlung ::

Das Zend Framework

Das Zend Framework zur Buchempfehlung
 

:: Anbieterverzeichnis ::

Globale Branchen

Informieren Sie sich über ausgewählte Unternehmen im Anbieterverzeichnis von SELFPHP  

 

:: Newsletter ::

Abonnieren Sie hier den kostenlosen SELFPHP Newsletter!

Vorname: 
Name:
E-Mail:
 
 

Zurück   PHP Forum > SELFPHP > PHP Grundlagen
Hilfe Community Kalender Heutige Beiträge Suchen

PHP Grundlagen Hier kann über grundlegende Probleme oder Anfängerschwierigkeiten diskutiert werden

Antwort
 
Themen-Optionen Ansicht
  #1  
Alt 06.02.2003, 16:52:02
xStream xStream ist offline
Anfänger
 
Registriert seit: Mar 2002
Ort: Neumünster (das liegt so bei Hamburg)
Alter: 36
Beiträge: 82
xStream eine Nachricht über ICQ schicken
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
Mit Zitat antworten
  #2  
Alt 06.02.2003, 19:47:28
Ben20
Guest
 
Beiträge: n/a
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!
Mit Zitat antworten
  #3  
Alt 06.02.2003, 21:32:44
xStream xStream ist offline
Anfänger
 
Registriert seit: Mar 2002
Ort: Neumünster (das liegt so bei Hamburg)
Alter: 36
Beiträge: 82
xStream eine Nachricht über ICQ schicken
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*
Mit Zitat antworten
  #4  
Alt 06.02.2003, 21:35:41
Ben20
Guest
 
Beiträge: n/a
Eigentlich nicht - könnte es sein, dass der Browser keine Cookies aktzeptiert, oder schon irgendwas anderes an ihn geschickt worden ist?
Mit Zitat antworten
  #5  
Alt 06.02.2003, 21:39:40
xStream xStream ist offline
Anfänger
 
Registriert seit: Mar 2002
Ort: Neumünster (das liegt so bei Hamburg)
Alter: 36
Beiträge: 82
xStream eine Nachricht über ICQ schicken
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">&nbsp;</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">&nbsp;</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'>&nbsp;
          </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'>&nbsp;
          </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'>&nbsp;
          </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'>&nbsp;
          </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'>&nbsp;
          </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'>&nbsp;
          </td>
          <td width='$gfxr6'><img border='0' src='../img/if/umfrage_box/balken_rechts.jpg'></td>
        </tr>
      </table></td>
  </tr>
";
}
			  ?>
			  </table>
            
&nbsp;</td>
          
<td width="35" background="../img/if/umfrage_box/rvc.jpg">&nbsp;</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>
&nbsp;fenster schlie&szlig;en</a></font></div></td>
  </tr>
</table>
<p>&nbsp;</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)
Mit Zitat antworten
  #6  
Alt 06.02.2003, 21:43:23
Ben20
Guest
 
Beiträge: n/a
Also, das Cookie geht bei mir! Seltsam Seltsam! Evtl. mal die letzen zwei Attribute weglassen, obwohl es daran, ja eigentlich nicht liegen dürfte!
Mit Zitat antworten
  #7  
Alt 06.02.2003, 21:44:46
xStream xStream ist offline
Anfänger
 
Registriert seit: Mar 2002
Ort: Neumünster (das liegt so bei Hamburg)
Alter: 36
Beiträge: 82
xStream eine Nachricht über ICQ schicken
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 :(
Mit Zitat antworten
Antwort


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.

BB-Code ist an.
Smileys sind aus.
[IMG] Code ist aus.
HTML-Code ist aus.

Gehe zu


Alle Zeitangaben in WEZ +2. Es ist jetzt 12:45:26 Uhr.


Powered by vBulletin® Version 3.8.3 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.


© 2001-2024 E-Mail SELFPHP OHG, info@selfphp.deImpressumKontakt