Zitat geschrieben von
she
Grundgerüst von JavaScript
<script language="JavaScript">
function showhide(submitbutton) {
if (submitbutton.style.display == "none") {
submitbutton.style.display = "block";
} else {
submitbutton.style.display = "none";
}
}
</script>
Danke für den Code aber um ehrlich zu sein habe es versucht aber bekomm es einfach net hin kann mir denn niemand weiterhelfen.
hier meine contents/vote.php
<?php
// Copyright by: Manuel Staechele
// Support: www.ilch.de
// Modified by Mairu -> Erweiterte Umfrage 1.5
// include/contents/vote.php
defined ('main') or die ('no direct access');
// -----------------------------------------------------------|
// #
// ##
// ###
// #### ins vote
$um = $menu->get(1);
if ($menu->getA(1) == 'W') {
$poll_id = escape ($menu->getE(1), 'integer');
$fraRow = db_fetch_object(db_query("SELECT * FROM prefix_poll WHERE poll_id = '" . $poll_id . "'"));
$vote = $fraRow->stat == 1 ? true : false;
if ($fraRow->answers <= 1) {
$radio = ' = ' . escape ($_POST['radio'], 'integer');
} else {
if ($fraRow->answers < count($_POST['radio'])) {
$vote = false;
$wdtext = 'Es sind maximal ' . $fraRow->answers . ' Antworten möglich<br />';
} else {
$radio = ' IN (';
foreach ($_POST['radio'] as $k => $v) {
$radio .= escape($_POST['radio'][$k], 'integer') . ',';
}
$radio = substr($radio, 0, - 1) . ')';
}
}
if ($vote) {
if (($fraRow->exptime != 0 and $fraRow->exptime < time()) or ($fraRow->maxvotes > 0 and $fraRow->votes >= $fraRow->maxvotes)) {
db_query("UPDATE `prefix_poll` SET stat = 0 WHERE poll_id = $poll_id");
$wdtext = 'Stimme wurde nicht gezählt, Umfrage wurde geschlossen.<br />';
} else {
$textAr = explode('#', $fraRow->text);
if ($fraRow->recht == 2) {
$inTextAr = $_SESSION['authid'];
} elseif ($fraRow->recht == 1) {
$inTextAr = getip();
}
if (!in_array ($inTextAr , $textAr)) {
$textAr[] = $inTextAr;
$textArString = implode('#', $textAr);
db_query('UPDATE `prefix_poll` SET votes = votes + 1, text = "' . $textArString . '" WHERE poll_id = "' . $poll_id . '"');
db_query('UPDATE `prefix_poll_res` SET res = res + 1 WHERE poll_id = "' . $poll_id . '" AND sort ' . $radio) or die (mysql_error());
$wdtext = 'Deine Stimme wurde gezählt.<br />';
} else {
$wdtext = 'Deine Stimme wurde nicht gezählt, du hast wohl schon abgestimmt.<br />';
}
}
} elseif (empty($wdtext)) {
$wdtext = 'Abstimmen nicht möglich.<br />';
}
$design = new design('', '');
$design->header();
wd('index.php?' . $_POST['wd'], $wdtext, 3);
$design->footer(1);
}
// #
// ##
// ###
// #### V o t e Ü b e r s i c h t
$title = $allgAr['title'] . ' :: ' . $lang['vote'];
$hmenu = $lang['vote'];
$design = new design ($title , $hmenu);
$design->header();
?>
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="border">
<tr class="Chead">
<td><b><?php $lang['vote']; ?></b></td>
</tr>
<?php
$breite = 200;
if ($_SESSION['authright'] <= - 1) {
$woR = '>= "1"';
} else {
$woR = '= "1"';
}
$limit = 5; // Limit
$zaehler = 0;
$page = ($menu->getA(1) == 'p' ? $menu->getE(1) : 1);
$MPL = db_make_sites ($page , '' , $limit , "?vote" , 'poll');
$anfang = ($page - 1) * $limit;
$class = '';
$erg = db_query('SELECT * FROM `prefix_poll` ORDER BY stat DESC, poll_id DESC LIMIT ' . $anfang . ',10000000');
while ($zaehler < $limit AND $fraRow = db_fetch_object($erg)) {
$maxRow = db_fetch_object(db_query('SELECT MAX(res) as res FROM `prefix_poll_res` WHERE poll_id = "' . $fraRow->poll_id . '"'));
$gesRow = db_fetch_object(db_query('SELECT SUM(res) as res FROM `prefix_poll_res` WHERE poll_id = "' . $fraRow->poll_id . '"'));
$max = $maxRow->res;
$ges = $gesRow->res;
$textAr = explode('#', $fraRow->text);
if ($fraRow->recht == 2) {
$inTextAr = $_SESSION['authid'];
} elseif ($fraRow->recht == 1) {
$inTextAr = getip();
}
if ($fraRow->user_rechte == '') $fraRow->user_rechte = '0123456789';
if (!empty($fraRow->groups)) {
$votegroups = explode('#', $fraRow->groups);
foreach ($_SESSION['authgrp'] as $id => $authgroup) if (in_array($id, $votegroups)) $abstimmen = true;
if (strpos($fraRow->user_rechte, '' . abs($_SESSION['authright'])) === false) $abstimmen = false;
} elseif (strpos($fraRow->user_rechte, '' . abs($_SESSION['authright'])) !== false) $abstimmen = true;
else $abstimmen = false;
if ((in_array ($inTextAr , $textAr) OR $fraRow->stat == 0) OR (!$abstimmen)) {
$imPollArrayDrin = true;
} elseif ($abstimmen) {
$imPollArrayDrin = false;
}
if (!$imPollArrayDrin OR $fraRow->view >= $_SESSION['authright']) {
$zaehler++;
echo '<tr><td class="Cdark"><b>' . $fraRow->frage . ($fraRow->answers > 1 ? " ($fraRow->answers Antworten möglich)" : '') . '</b>';
if ($fraRow->stat == 0) {
echo ' (geschlossen)';
} elseif ($fraRow->exptime > 0) {
echo '(bis ' . date('H.i \U\h\r - d.m.Y', $fraRow->exptime);
if ($fraRow->maxvotes > 0) {
echo ' oder bis ' . $fraRow->maxvotes . ' abgestimmt haben';
}
echo ')';
} elseif ($fraRow->maxvotes > 0) {
echo '(bis ' . $fraRow->maxvotes . ' abgestimmt haben)';
}
echo '</td></tr>';
if ($class == 'Cnorm') {
$class = 'Cmite';
} else {
$class = 'Cnorm';
}
echo '<tr><td class="' . $class . '">';
if ($imPollArrayDrin) {
echo '<table width="100%" cellpadding="0">';
} else {
echo '<form action="index.php?vote-W' . $fraRow->poll_id . '" method="post"><input type="hidden" name="wd" value="'.$menu->get_complete().'">';
}
$i = 0;
$pollErg = db_query('SELECT antw, res, sort FROM `prefix_poll_res` WHERE poll_id = "' . $fraRow->poll_id . '" ORDER BY sort');
while ($pollRow = db_fetch_object($pollErg)) {
if ($imPollArrayDrin) {
if (!empty($pollRow->res)) {
$weite = ($pollRow->res / $max) * 200;
$prozent = $pollRow->res * 100 / $ges;
$prozent = round($prozent, 0);
} else {
$weite = 0;
$prozent = 0;
}
$tbweite = $weite + 20;
echo '<tr><td width="30%">' . $pollRow->antw . '</td>';
echo '<td width="50%">';
/*
'<table width="'.$tbweite.'" border="0" cellpadding="0" cellspacing="0"></td>';
echo '<tr><td width="10" height="10"></td>';
echo '<td width="'.$weite.'" background="include/images/vote/voteMitte.jpg" alt=""></td>';
echo '<td width="10"><img src="include/images/vote/voteRight.jpg" alt=""></td>';
echo '</tr></table>';*/
echo '<div style="height: 10px; width: ' . $weite . 'px; background: #3776a5 url(include/images/vote/voteMitte.png) repeat-y top left;">' .
'</div>';
echo '<td width="10%">' . $prozent . '%</td>';
echo '<td width="20%" align="right">' . $pollRow->res . '</td></tr>';
} else {
$i++;
if ($fraRow->answers <= 1) {
echo '<input type="radio" id="vote' . $i . '" name="radio" value="' . $pollRow->sort . '"><label for="vote' . $i . '"> ' . $pollRow->antw . '</label><br>';
} else {
echo '<input type="checkbox" id="vote' . $i . '" name="radio[]" value="' . $pollRow->sort . '"><label for="vote' . $i . '"> ' . $pollRow->antw . '</label><br>';
}
}
}
if ($imPollArrayDrin) {
echo '<tr><td colspan="2" align="right">' . $lang['whole'] . ': ' . $ges . '</td></tr></table>';
} else {
echo '<p align="center"><input type="submit" value="' . $lang['tovote'] . '"></p></form>';
}
echo '</td></tr>';
}
} // end while
echo '<tr><td class="Cdark" align="center">' . $MPL . '</td></tr></table>';
$design->footer();
?>
Zuletzt modifiziert von Kazuya Suzuhara am 04.12.2010 - 11:13:40