poll

Dflex

Mitglied
und da bin ich wieder (natürlich mit einem problem)

ich hab hier ein pollscript
da nur einer vorgesehen war, ich aber 4 wollte hab ich den code einfach 4mal untereinander kopiert und die stellen fürs eintragen und ausgeben geändert. die tabellen in sql hab ich auch angelegt
als ich es jetzt getestet habe wurden die antworten aus dem 2ten poll dem ersten dazugerechnet
in poll 3 und 4 passiert überhaupt nichts - habe aber in allen 3 die selben sachen geändert
die sql-tabellen heißen votes, votes2, votes3 und votes4

kann mir mal einer sagen wieso das nicht klappt und wieso bei den 3 eine unterschiedliche reaktion auftritt? außerdem würde ich gerne wissen wie ich nach einer abgegebenen stimme auf eine seite komme auf der steht das die stimme registriert wurde (ich weiß - schon mal gepostet)
hier ist auf jedenfall schon mal das script
BITTE HELFT MIR
 

Anhänge

kopier das script mal in deinen beitrag, bin zu faul mir das zu ziehen, und ich vermute, ich bin nicht der einzige.

:-(
 
Das script ist etwas lang also erstelle ich mehrere beiträge
jeder teil ist ein poll (im ersten sind auch noch die infos die für alle gelten
hier teil 1/4
PHP:
<?
#  Configuration                                                                                                                    

// mySQL Stuff
$server="+++++++";		// Your Host, most cases localhost
$db_user="+++++++";		// Your mySql Username
$db_pass="++++++";		// Your mySql Password
$database="+++++++";		// Your phpVote-Database

// Size Stuff
$vote_width="150";
$votebar_width="80%";
$votebar_height="10";

// Language Stuff
$vote_question="Wie gefällt Ihnen meine Seite";
$vote_answer="Answer";		
$vote_vote="Vote";
$vote_button="Vote";

// Optical Stuff
$htmlheader="
  <title>Umfrage</title>                                                                                     
  <style type=text/css>
    body 		{ background:#000000; margin: 10px; font-family: Verdana; }                 
    a:link 		{ color:#FF9900; font-weight:lighter; text-decoration:underline; font-family: Verdana; }                  
    a:visited 		{ color:#00FF00; font-weight:bold; text-decoration:underline; font-family: Verdana; }               
    a:active 		{ color:#FF9900; font-weight:bold; text-decoration:underline; font-family: Verdana; }                
    a:hover 		{ color:#FF9900; font-weight:bolder; text-decoration:none; font-family: Verdana; }                      
    td.votebarout 	{ background: #EEEEEE; border:0px; }                                                    
    td.votebarin 	{ background: #FFCC00; border:0px; }                                                     
    td.votetext 	{ color:#FFFFFF; font-size:8pt; }                                                                               
    td.votequest 	{ color:#FF9900; font-size:10pt; font-weight:bold; text-align:center;}                                                                               
    td.votefooter	{ color:#FFFFFFF; font-size:8pt; text-align:center; }
    div.votespace	{ font-size:4pt; text-align:center; }
  </style>
";

// Some Stuff
$cookie_time=12;		// Vote Timeout in hours (set with Cookies)
$ver="V 1.10";
?>
<html>
<head>
<title>Umfrage</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">                                  
  <meta name="robots" content="index, nofollow">                                                              
  <meta name="revisit-after" content="20 days">
</head>

<body bgcolor="#000000" text="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
  <tr> 
    <td valign="top" colspan="4"> 
      <div align="center">
        <p><b><font color="#FF0000" size="+1" face="celticmd">Bitte beantworten 
          Sie Meine Fragen</font></b></p>
        <p>&nbsp;</p>
      </div>
    </td>
  </tr>
  <tr>
    <td width="241"></td>
    <td width="241"></td>
    <td width="241"></td>
    <td width="241"></td>
  </tr>
  <tr> 
    <td valign="top"> 
      <?
	  // Language Stuff
$vote_question="Wie gefällt Ihnen meine Seite?";
$vote_answer="Answer";		
$vote_vote="Vote";
$vote_button="Vote";

	if ($vote && !$HelloCheater) {                                                                                  
    mysql_connect($server,$db_user,$db_pass) or die("Database Connect Error");                              
    $query = mysql_db_query($database,"update votes set votes=votes+1 where name='$vote'") or die("Database Query Error");
    mysql_close();
    setcookie("HelloCheater", "1", time()+(3600*$cookie_time));
    header("Location: $PHP_SELF");                                                     
    exit;                                                                                                    
}
?>
 <?
echo $htmlheader;
echo"</head><div align=center>";	    

echo "<form action=\"$PHP_SELF\" method=\"POST\">";
    mysql_connect($server,$db_user,$db_pass) or die("Database Connect Error");
    $result=mysql_db_query($database,"select sum(votes) as sum from votes") or die("Database Query Error");;
    if($result) {
        $sum = (int) mysql_result($result,0,"sum");
        mysql_free_result($result);
    }

    $result=mysql_db_query($database,"select * from votes order by votes DESC") or die("Database Query Error");;
    echo "<table border=0 width=$vote_width><tr><td class=\"votequest\" colspan=\"3\">$vote_question<br><br></td></tr><tr><td class=\"votetext\">$vote_vote</td><td class=\"votetext\">$vote_answer</td><td class=\"votetext\">%</td></tr>\n";
    while($row=mysql_fetch_row($result)) {
	echo "<tr><td align=center><input type=radio name=vote value=\"$row[0]\"></td>";                   
    	echo "<td class=\"votetext\" colspan=\"2\">" .$row[0]."</td></tr><tr>
	<td class=\"votetext\" align=\"center\">".$row[1]."</td><td class=\"votetext\">";                                              

        if($sum && (int)$row[1]) {
    	    $per = (int)(100 * $row[1]/$sum);

	    echo "<table align=center border=0 cellspacing=0 cellpadding=1 width=\"$votebar_width\" height=\"$votebar_height\">\n"; 
            echo " <tr>\n";                                                                                                 
	    echo "  <td class=\"votebarout\">\n";                                                     
    	    echo "   <table align=left border=0 cellspacing=0 cellpadding=0 width=\"$per%\" height=\"100%\">\n";
    	    echo "    <tr>\n";                                                                                              
	    echo "     <td class=\"votebarin\">\n";                                                    
    	    echo "        <div class=\"votespace\">&nbsp;</div>\n";
	    echo "     </td>\n";                                                                                            
	    echo "    </tr>\n";                                                                                             
	    echo "   </table>\n";                                                                                           
	    echo "  </td>\n";                                                                                               
	    echo " </tr>\n";                                                                                                
    	    echo "</table>\n";                                                                                              
  	      
	    echo"</td><td class=\"votetext\">$per</td>";
      	    }
        echo "</tr>\n";
        }
    mysql_free_result($result);
    mysql_close();
echo "<tr><td class=\"votetext\" colspan=\"3\"><input type=submit value=\"$vote_button\"></form></td></tr>";
#  PLEASE DO NOT REMOVE OR EDIT THIS COPYRIGHT-NOTICE !!! THANKS !!! #########################################
echo"<tr><td class=\"votefooter\" colspan=\"3\">phpVote $ver<br>&copy 2001 by <a href=\"http://www.netone.at\" target=\"_blank\">NETonE</a></td></tr>";
##############################################################################################################
echo "</table>\n";
echo "</div>";
?>
 
Zuletzt bearbeitet:
teil 2/4
PHP:
   </td>
    <td valign="top"> 
      <?
	  // Language Stuff
$vote_question="Wie gefallen Ihnen meine Bilder?";
$vote_answer="Answer";		
$vote_vote="Vote";
$vote_button="Vote";

if ($vote && !$HelloCheater) {                                                                                  
    mysql_connect($server,$db_user,$db_pass) or die("Database Connect Error");                              
    $query = mysql_db_query($database,"update votes2 set votes=votes+1 where name='$vote'") or die("Database Query Error");
    mysql_close();
    setcookie("HelloCheater", "1", time()+(3600*$cookie_time));
    header("Location: $PHP_SELF");                                                     
    exit;                                                                                                    
}
?>
      <?
echo $htmlheader;
echo"</head><div align=center>";	    

echo "<form action=\"$PHP_SELF\" method=\"POST\">";
    mysql_connect($server,$db_user,$db_pass) or die("Database Connect Error");
    $result=mysql_db_query($database,"select sum(votes) as sum from votes2") or die("Database Query Error");;
    if($result) {
        $sum = (int) mysql_result($result,0,"sum");
        mysql_free_result($result);
    }

    $result=mysql_db_query($database,"select * from votes2 order by votes DESC") or die("Database Query Error");;
    echo "<table border=0 width=$vote_width><tr><td class=\"votequest\" colspan=\"3\">$vote_question<br><br></td></tr><tr><td class=\"votetext\">$vote_vote</td><td class=\"votetext\">$vote_answer</td><td class=\"votetext\">%</td></tr>\n";
    while($row=mysql_fetch_row($result)) {
	echo "<tr><td align=center><input type=radio name=vote value=\"$row[0]\"></td>";                   
    	echo "<td class=\"votetext\" colspan=\"2\">" .$row[0]."</td></tr><tr>
	<td class=\"votetext\" align=\"center\">".$row[1]."</td><td class=\"votetext\">";                                              

        if($sum && (int)$row[1]) {
    	    $per = (int)(100 * $row[1]/$sum);

	    echo "<table align=center border=0 cellspacing=0 cellpadding=1 width=\"$votebar_width\" height=\"$votebar_height\">\n"; 
            echo " <tr>\n";                                                                                                 
	    echo "  <td class=\"votebarout\">\n";                                                     
    	    echo "   <table align=left border=0 cellspacing=0 cellpadding=0 width=\"$per%\" height=\"100%\">\n";
    	    echo "    <tr>\n";                                                                                              
	    echo "     <td class=\"votebarin\">\n";                                                    
    	    echo "        <div class=\"votespace\">&nbsp;</div>\n";
	    echo "     </td>\n";                                                                                            
	    echo "    </tr>\n";                                                                                             
	    echo "   </table>\n";                                                                                           
	    echo "  </td>\n";                                                                                               
	    echo " </tr>\n";                                                                                                
    	    echo "</table>\n";                                                                                              
  	      
	    echo"</td><td class=\"votetext\">$per</td>";
      	    }
        echo "</tr>\n";
        }
    mysql_free_result($result);
    mysql_close();
echo "<tr><td class=\"votetext\" colspan=\"3\"><input type=submit value=\"$vote_button\"></form></td></tr>";
#  PLEASE DO NOT REMOVE OR EDIT THIS COPYRIGHT-NOTICE !!! THANKS !!! #########################################
echo"<tr><td class=\"votefooter\" colspan=\"3\">phpVote $ver<br>&copy 2001 by <a href=\"http://www.netone.at\" target=\"_blank\">NETonE</a></td></tr>";
##############################################################################################################
echo "</table>\n";
echo "</div>";
?>
 
Zuletzt bearbeitet:
teil 3/4
PHP:
   </td>
    <td valign="top"> 
      <?
	  // Language Stuff
$vote_question="Würden Sie solche Bilder kaufen?";
$vote_answer="Answer";		
$vote_vote="Vote";
$vote_button="Vote";

if ($vote && !$HelloCheater) {                                                                                  
    mysql_connect($server,$db_user,$db_pass) or die("Database Connect Error");                              
    $query = mysql_db_query($database,"update votes3 set votes=votes+1 where name='$vote'") or die("Database Query Error");
    mysql_close();
    setcookie("HelloCheater", "1", time()+(3600*$cookie_time));
    header("Location: $PHP_SELF");                                                     
    exit;                                                                                                    
}
?>
      <?
echo $htmlheader;
echo"</head><div align=center>";	    

echo "<form action=\"$PHP_SELF\" method=\"POST\">";
    mysql_connect($server,$db_user,$db_pass) or die("Database Connect Error");
    $result=mysql_db_query($database,"select sum(votes) as sum from votes3") or die("Database Query Error");;
    if($result) {
        $sum = (int) mysql_result($result,0,"sum");
        mysql_free_result($result);
    }

    $result=mysql_db_query($database,"select * from votes3 order by votes DESC") or die("Database Query Error");;
    echo "<table border=0 width=$vote_width><tr><td class=\"votequest\" colspan=\"3\">$vote_question<br><br></td></tr><tr><td class=\"votetext\">$vote_vote</td><td class=\"votetext\">$vote_answer</td><td class=\"votetext\">%</td></tr>\n";
    while($row=mysql_fetch_row($result)) {
	echo "<tr><td align=center><input type=radio name=vote value=\"$row[0]\"></td>";                   
    	echo "<td class=\"votetext\" colspan=\"2\">" .$row[0]."</td></tr><tr>
	<td class=\"votetext\" align=\"center\">".$row[1]."</td><td class=\"votetext\">";                                              

        if($sum && (int)$row[1]) {
    	    $per = (int)(100 * $row[1]/$sum);

	    echo "<table align=center border=0 cellspacing=0 cellpadding=1 width=\"$votebar_width\" height=\"$votebar_height\">\n"; 
            echo " <tr>\n";                                                                                                 
	    echo "  <td class=\"votebarout\">\n";                                                     
    	    echo "   <table align=left border=0 cellspacing=0 cellpadding=0 width=\"$per%\" height=\"100%\">\n";
    	    echo "    <tr>\n";                                                                                              
	    echo "     <td class=\"votebarin\">\n";                                                    
    	    echo "        <div class=\"votespace\">&nbsp;</div>\n";
	    echo "     </td>\n";                                                                                            
	    echo "    </tr>\n";                                                                                             
	    echo "   </table>\n";                                                                                           
	    echo "  </td>\n";                                                                                               
	    echo " </tr>\n";                                                                                                
    	    echo "</table>\n";                                                                                              
  	      
	    echo"</td><td class=\"votetext\">$per</td>";
      	    }
        echo "</tr>\n";
        }
    mysql_free_result($result);
    mysql_close();
echo "<tr><td class=\"votetext\" colspan=\"3\"><input type=submit value=\"$vote_button\"></form></td></tr>";
#  PLEASE DO NOT REMOVE OR EDIT THIS COPYRIGHT-NOTICE !!! THANKS !!! #########################################
echo"<tr><td class=\"votefooter\" colspan=\"3\">phpVote $ver<br>&copy 2001 by <a href=\"http://www.netone.at\" target=\"_blank\">NETonE</a></td></tr>";
##############################################################################################################
echo "</table>\n";
echo "</div>";
?>
 
Zuletzt bearbeitet:
hab noch was vergessen
ich habe die 4 scripts in eine tabelle gesteckt und eine zeile für ne überschrift genommen
teil 4/4
PHP:
   </td>
    <td valign="top"> 
      <?
	  // Language Stuff
$vote_question="Wenn Ja, für wieviel Geld?";
$vote_answer="Answer";		
$vote_vote="Vote";
$vote_button="Vote";

if ($vote && !$HelloCheater) {                                                                                  
    mysql_connect($server,$db_user,$db_pass) or die("Database Connect Error");                              
    $query = mysql_db_query($database,"update votes4 set votes=votes+1 where name='$vote'") or die("Database Query Error");
    mysql_close();
    setcookie("HelloCheater", "1", time()+(3600*$cookie_time));
    header("Location: $PHP_SELF");                                                     
    exit;                                                                                                    
}
?>
      <?
echo $htmlheader;
echo"</head><div align=center>";	    

echo "<form action=\"$PHP_SELF\" method=\"POST\">";
    mysql_connect($server,$db_user,$db_pass) or die("Database Connect Error");
    $result=mysql_db_query($database,"select sum(votes) as sum from votes4") or die("Database Query Error");;
    if($result) {
        $sum = (int) mysql_result($result,0,"sum");
        mysql_free_result($result);
    }

    $result=mysql_db_query($database,"select * from votes4 order by votes DESC") or die("Database Query Error");;
    echo "<table border=0 width=$vote_width><tr><td class=\"votequest\" colspan=\"3\">$vote_question<br><br></td></tr><tr><td class=\"votetext\">$vote_vote</td><td class=\"votetext\">$vote_answer</td><td class=\"votetext\">%</td></tr>\n";
    while($row=mysql_fetch_row($result)) {
	echo "<tr><td align=center><input type=radio name=vote value=\"$row[0]\"></td>";                   
    	echo "<td class=\"votetext\" colspan=\"2\">" .$row[0]."</td></tr><tr>
	<td class=\"votetext\" align=\"center\">".$row[1]."</td><td class=\"votetext\">";                                              

        if($sum && (int)$row[1]) {
    	    $per = (int)(100 * $row[1]/$sum);

	    echo "<table align=center border=0 cellspacing=0 cellpadding=1 width=\"$votebar_width\" height=\"$votebar_height\">\n"; 
            echo " <tr>\n";                                                                                                 
	    echo "  <td class=\"votebarout\">\n";                                                     
    	    echo "   <table align=left border=0 cellspacing=0 cellpadding=0 width=\"$per%\" height=\"100%\">\n";
    	    echo "    <tr>\n";                                                                                              
	    echo "     <td class=\"votebarin\">\n";                                                    
    	    echo "        <div class=\"votespace\">&nbsp;</div>\n";
	    echo "     </td>\n";                                                                                            
	    echo "    </tr>\n";                                                                                             
	    echo "   </table>\n";                                                                                           
	    echo "  </td>\n";                                                                                               
	    echo " </tr>\n";                                                                                                
    	    echo "</table>\n";                                                                                              
  	      
	    echo"</td><td class=\"votetext\">$per</td>";
      	    }
        echo "</tr>\n";
        }
    mysql_free_result($result);
    mysql_close();
echo "<tr><td class=\"votetext\" colspan=\"3\"><input type=submit value=\"$vote_button\"></form></td></tr>";
#  PLEASE DO NOT REMOVE OR EDIT THIS COPYRIGHT-NOTICE !!! THANKS !!! #########################################
echo"<tr><td class=\"votefooter\" colspan=\"3\">phpVote $ver<br>&copy 2001 by <a href=\"http://www.netone.at\" target=\"_blank\">NETonE</a></td></tr>";
##############################################################################################################
echo "</table>\n";
echo "</div>";
?>
    </td>
  </tr>
</table>
</body>
</html>
 
Zuletzt bearbeitet:
Zurück