Mikijs Posted February 14, 2008 Report Share Posted February 14, 2008 (edited) Sveiki! veidoju balsosanas sistemu bet aizkeros ar viena jautajum Kuru vairantu labāk izmantot? * Kookie * Jeb MySQL variants? - Gribu lai pec pl: 23:59 lietotajam atkal ir pieeja balsot - Tip nobalso un ieraksta balsi un ieraksta cilveka IP adresi un nobalsoto ID (Balsosana ir par 1 cilveku 1x diena) šobrīd man ir kkas līdzīgs šim. if ($_GET['balsot']){ $id=$_GET['balsot']; $cepums="ID_balsosana_".$id; if(isset($_COOKIE[$cepums])){ $myip=$_SERVER['REMOTE_ADDR']; // Balsot $sql_balsot=dbquery("SELECT balsis FROM ".PREF."lietotaji WHERE id=".$id); $sql_balsis=dbarray($sql_balsot); $balsis=$sql_balsis['balsis']+1; dbquery("UPDATE ".PREF."lietotaji SET balsis='$balsis' WHERE id=".$id); // Uzstadam 24 stundu liegumu balsot! $dienakts = 3600 * 12; $liegums = time() + $dienakts; setcookie($cepums, $my_ip, $liegums); redirect("index.php?nobalsots=".$id); }else{ echo "<div align='center' class='info'>tu jau esi nobalsojis/usi, rītā atkal varēsi balsot!</div>"; } } Edited February 14, 2008 by Mikijs Link to comment Share on other sites More sharing options...
IM24LV Posted February 14, 2008 Report Share Posted February 14, 2008 Nū, atkarībā kādām vajadzībām... :) Link to comment Share on other sites More sharing options...
Mikijs Posted February 14, 2008 Author Report Share Posted February 14, 2008 balsot par jebko par ko var balsot :D bet 1x diena Teiksim es ievietoju jaunumus, bet par tiem var balsot 1x diena, tatad par 1 jaunumiem 1x diena.. es nobalsoju par jaunumiem "Bla bla bla" 1x un gaidu ritdienu, talak es nobalsoju par "Bla Ble Blu" 1x un turpinu gaidit ritdienu.. Link to comment Share on other sites More sharing options...
Aleksejs Posted February 14, 2008 Report Share Posted February 14, 2008 DB. Jo cookie cilvēks var izdzēst. Ja nav reģistrācija, tad godīgai balsošanai ierobežojums - viena balss no vienas IP. Link to comment Share on other sites More sharing options...
Mikijs Posted February 14, 2008 Author Report Share Posted February 14, 2008 ka to labak izveidot uz sql? ka ievada laiku kad balsojis un ip piem $datums=date(YYmmdd); $ip=$_SERVER['REMOTE_ADDR']; dbquery("UPDATE INTO ".PREF."lietotaji datums='$datums' ip='$ip' WHERE id = ".$_GET['id']); ? Link to comment Share on other sites More sharing options...
Mikijs Posted February 14, 2008 Author Report Share Posted February 14, 2008 (edited) un $sql_pb=dbquery("SELECT balsosanas_datums FROM ".PREF."lietotaji WHERE id = ".$_GET['id']); $sql_parbaude=dbarray($sql_pb); if(!$sql_parbaude['balsosanas_datums']==date("YYmmdd")){ $datums=date(YYmmdd); $ip=$_SERVER['REMOTE_ADDR']; dbquery("UPDATE ".PREF."lietotaji SET balsosanas_datums='$datums', ip='$ip' WHERE id = ".$_GET['id']); echo "Paldies par balsojumu!"; }else{ echo "Sodien jus jau esat nobalsojis par so rakstu"; } Edited February 14, 2008 by Mikijs Link to comment Share on other sites More sharing options...
werd Posted February 14, 2008 Report Share Posted February 14, 2008 kad nobalso ieks DB ieraksti IP | date | id ja megina balsot velreiz tad ceko vai attiecigajai IP date = pasreizejo date, ja ir tad nelaujam ja atskiras tad +1 balss Link to comment Share on other sites More sharing options...
marcis Posted February 15, 2008 Report Share Posted February 15, 2008 Nu es gan nezinu vai ir jēga tā iespringt, protams, ja tev tur viss ļoti strikti. Bet nu parastām balsošanām neko vairāk par cepumiem neizmantoju. Link to comment Share on other sites More sharing options...
Recommended Posts