|
From: <fr...@us...> - 2004-01-02 19:29:01
|
Update of /cvsroot/devil-linux/web/polls In directory sc8-pr-cvs1:/tmp/cvs-serv3988 Modified Files: results.php Log Message: remove all CR Index: results.php =================================================================== RCS file: /cvsroot/devil-linux/web/polls/results.php,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- results.php 2 Jan 2004 18:24:26 -0000 1.4 +++ results.php 2 Jan 2004 19:28:57 -0000 1.5 @@ -1,75 +1,75 @@ -<?php -/////////////////////////////////////////////////// -// Advanced Poll 1.6 (PHP/MySQL) // -// Copyright (c)2001 Chi Kien Uong // -// URL: http://www.proxy2.de // -/////////////////////////////////////////////////// - -require ("./include/config.inc.php"); -require ("./include/$poll_db"); -$db_connect = new db_sql; -$db_connect->connect($sql_hostname, $sql_username, $sql_password, $dbName); -$varresult = $db_connect->query("SELECT * FROM $sql_config"); -$vars = $db_connect->fetch_array($varresult); -while(list($var,$value) = each($vars)) { - $$var=$value; -} -$db_connect->free_result($varresult); - -$img_length = 80; - -?> -<table width="96%" border="0" align="center" cellspacing="1" cellpadding="1"> - <tr> - <td height="55" valign="middle" align="center"> <b><u><font size="2" face="<?php echo $font_face; ?>">POLL RESULTS</font></u><br> - </b></td> - </tr> - <tr> - <td valign="top" align="center"> -<?php -$poll_result = $db_connect->query("SELECT * FROM $sql_index order by timestamp desc"); -while ($row = $db_connect->fetch_array($poll_result)) { - if ($row['status']==2) { - continue; - } - $question = stripslashes($row['question']); - $question = htmlspecialchars($question); - $poll_id = $row['poll_id']; -?> - <table border="0" cellspacing="0" cellpadding="1" bgcolor="#006699" width="400"> - <tr> - <td> - <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center" bgcolor="#FFFFFF"> - <tr bgcolor="#006699"> - <td colspan="3"><font size="1" face="<?php echo $font_face; ?>" color="#FFFFFF"><b><?php echo $question; ?></b></font></td> - </tr> -<?php -$i=0; -$poll_total = $db_connect->query("SELECT SUM(votes) AS total FROM $sql_data WHERE (poll_id = '$poll_id')"); -$poll_sum = $db_connect->fetch_array($poll_total); -$db_connect->free_result($poll_total); -$data_result = $db_connect->query("SELECT * FROM $sql_data WHERE (poll_id = '$poll_id') order by votes desc"); -$votes_total = ($poll_sum["total"]==0) ? 1 : $poll_sum["total"]; -while ($data = $db_connect->fetch_array($data_result)) { - if ($i == 0) { - $maxvote = ($data["votes"]==0) ? 1 : $data["votes"]; - $i++; - } - $img_width = (int) ($data["votes"]*$img_length/$maxvote); - $vote_val = sprintf("%.1f",($data['votes']*100/$votes_total))."%"; - echo " <tr> - <td><font face=\"$font_face\" color=\"$font_color\" size=\"1\">$data[option_text]</font></td> - <td><font face=\"$font_face\" color=\"$font_color\" size=\"1\">$data[votes]</font></td> - <td><font face=\"$font_face\" color=\"$font_color\" size=\"1\"><img src=\"$base_gif/$data[color].gif\" width=\"$img_width\" height=\"$img_height\" alt=\"bar\"> $vote_val</font></td> - </tr>\n"; -} -?> - <tr> - <td><font face="<?php echo $font_face; ?>" color="<?php echo $font_color; ?>" size="1">Total votes:</font></td> - <td><font face="<?php echo $font_face; ?>" size="1" color="#CC0000"><?php echo $poll_sum['total']; ?></font></td> - <td><font size="1">Created <?php echo date("j-M-Y",$row['timestamp']); ?></font></td> - </tr> - </table> +<?php +/////////////////////////////////////////////////// +// Advanced Poll 1.6 (PHP/MySQL) // +// Copyright (c)2001 Chi Kien Uong // +// URL: http://www.proxy2.de // +/////////////////////////////////////////////////// + +require ("./include/config.inc.php"); +require ("./include/$poll_db"); +$db_connect = new db_sql; +$db_connect->connect($sql_hostname, $sql_username, $sql_password, $dbName); +$varresult = $db_connect->query("SELECT * FROM $sql_config"); +$vars = $db_connect->fetch_array($varresult); +while(list($var,$value) = each($vars)) { + $$var=$value; +} +$db_connect->free_result($varresult); + +$img_length = 80; + +?> +<table width="96%" border="0" align="center" cellspacing="1" cellpadding="1"> + <tr> + <td height="55" valign="middle" align="center"> <b><u><font size="2" face="<?php echo $font_face; ?>">POLL RESULTS</font></u><br> + </b></td> + </tr> + <tr> + <td valign="top" align="center"> +<?php +$poll_result = $db_connect->query("SELECT * FROM $sql_index order by timestamp desc"); +while ($row = $db_connect->fetch_array($poll_result)) { + if ($row['status']==2) { + continue; + } + $question = stripslashes($row['question']); + $question = htmlspecialchars($question); + $poll_id = $row['poll_id']; +?> + <table border="0" cellspacing="0" cellpadding="1" bgcolor="#006699" width="400"> + <tr> + <td> + <table border="0" cellpadding="4" cellspacing="0" width="100%" align="center" bgcolor="#FFFFFF"> + <tr bgcolor="#006699"> + <td colspan="3"><font size="1" face="<?php echo $font_face; ?>" color="#FFFFFF"><b><?php echo $question; ?></b></font></td> + </tr> +<?php +$i=0; +$poll_total = $db_connect->query("SELECT SUM(votes) AS total FROM $sql_data WHERE (poll_id = '$poll_id')"); +$poll_sum = $db_connect->fetch_array($poll_total); +$db_connect->free_result($poll_total); +$data_result = $db_connect->query("SELECT * FROM $sql_data WHERE (poll_id = '$poll_id') order by votes desc"); +$votes_total = ($poll_sum["total"]==0) ? 1 : $poll_sum["total"]; +while ($data = $db_connect->fetch_array($data_result)) { + if ($i == 0) { + $maxvote = ($data["votes"]==0) ? 1 : $data["votes"]; + $i++; + } + $img_width = (int) ($data["votes"]*$img_length/$maxvote); + $vote_val = sprintf("%.1f",($data['votes']*100/$votes_total))."%"; + echo " <tr> + <td><font face=\"$font_face\" color=\"$font_color\" size=\"1\">$data[option_text]</font></td> + <td><font face=\"$font_face\" color=\"$font_color\" size=\"1\">$data[votes]</font></td> + <td><font face=\"$font_face\" color=\"$font_color\" size=\"1\"><img src=\"$base_gif/$data[color].gif\" width=\"$img_width\" height=\"$img_height\" alt=\"bar\"> $vote_val</font></td> + </tr>\n"; +} +?> + <tr> + <td><font face="<?php echo $font_face; ?>" color="<?php echo $font_color; ?>" size="1">Total votes:</font></td> + <td><font face="<?php echo $font_face; ?>" size="1" color="#CC0000"><?php echo $poll_sum['total']; ?></font></td> + <td><font size="1">Created <?php echo date("j-M-Y",$row['timestamp']); ?></font></td> + </tr> + </table> </td></tr> <tr bgcolor="#FFFFFF"><td><br><br></td></tr> </table> |