burka Posted January 5, 2013 Report Share Posted January 5, 2013 Sveicināti. Griežos pie jums, lai varētu atrisināt savu problēmu ar funkciju. Tātad, lieta sekojoša. Centos izveidot funkciju, kas par katru kliku uz bannera iedod 1 ipunktu (izmantoju IPB 2.3.6 foruma versiju). Protams, uzspiest uz linka būtu iespējams tikai 1x 24h laikā. Pats esmu iesācējs un īsti nezinu, kur varētu būt problēma, jo kad ievietoju kodu, daļa manas lapas pazūd. Funkcija: function ipunkti($id = "0") { $userid = (int)$id == 0 ? (int)$_COOKIE['id']:(int)$userid; $res = mysql_query("SELECT points FROM ibf_members WHERE id = $id"); $row = mysql_fetch_array($res); } function addipunkti($id){ if(islogin()){ $click = "<a href='http://wos.lv/d.php?14724' onclick=\"'$update'\">" $click2 = "<a href='http://top.unreal.lv/c.php?id=227' onclick=\"'$update'\">" $click3 = "<a href='http://top.ieej.lv/in/684/''>http://top.ieej.lv/in/684/' onclick=\"'$update'\">" $click4 = "<a href='http://wtop.lv/buttons/p.php?p=117' onclick=\"'$update'\">" $click5 = "<a href='http://www.gamesites100.net/in.php?site=24757''>http://www.gamesites100.net/in.php?site=24757' onclick=\"'$update'\">" $click6 = "<a href='http://www.8d.lv/b.php?id=271' onclick=\"'$update'\">" $update = mysql_query("UPDATE ibf_members SET points = points + 1 WHERE id = $id") or die(mysql_error()); } } function alreadyVoted(){ if(islogin()){ $voted = new DateTime($time); $daylater = date('Y-m-d H:i:s', strtotime('+1 day', $voted->format('U'))); $canvote = new DateTime($daylater); $now = new DateTime(date("Y-m-d H:i:s")); $diff = $canvote->format('U') - $now->format('U'); if ( $diff > 0 && $diff < 86400 ) { $left = gmdate("H:i:s", $diff); echo $left . ' palicis, lai vari balsot atkal.'; } else { echo 'Balso!' ; } } Un pats PHP: <?php include_once 'function.php';?> <? if (addipunkti($id)){ echo' <script src=http://wos.lv/d.php?14724></script> <script src=http://top.unreal.lv/c.php?id=227></script> <a href="http://top.ieej.lv/in/684/" target="_blank"> <img src="http://top.ieej.lv/button2/684/" border="0" alt="Nobalso!"> </a> <script src="http://wtop.lv/buttons/p.php?p=117"></script> <a href="http://www.gamesites100.net/in.php?site=24757" title="Counter Strike Top 100" target="_blank"><img src="http://www.Gamesites100.net/images/votebutton.jpg" border="0" alt="Counter Strike Top 100"/></a><!-- End gamesites100 voting code --> <script src="http://www.8d.lv/b.php?id=271"></script>'; } elseif (alreadyVoted()){ echo'Jau balsoji!'; } ?> Un islogin funkcija: function islogin(){ if(isset($_COOKIE['member_id']) && isset($_COOKIE['pass_hash'])){ $hash = smart($_COOKIE['pass_hash']); $id = smart($_COOKIE['member_id']); $dont_hack = mysql_query("SELECT member_login_key FROM ibf_members WHERE member_login_key = '$hash' AND id = '$id' LIMIT 1") or die(mysql_error()); $dons = mysql_num_rows($dont_hack) == 1? true : false; }else{ $dons = false; } return $dons; } Ceru, ka palīdzēsiet. :) Quote Link to comment Share on other sites More sharing options...
F3llony Posted January 5, 2013 Report Share Posted January 5, 2013 Rindām 46-51 beigās trūkst semikols, un 72 trūkst aizverošā konturiekava. http://php.net/manual/en/function.error-reporting.php Quote Link to comment Share on other sites More sharing options...
burka Posted January 6, 2013 Author Report Share Posted January 6, 2013 Tā vai tā nestrādā. Varbūt ir kļuda balso.php failā? Quote Link to comment Share on other sites More sharing options...
F3llony Posted January 6, 2013 Report Share Posted January 6, 2013 Ieslēdz kļūdu izvadi un pārbaudi...? Quote Link to comment Share on other sites More sharing options...
burka Posted January 6, 2013 Author Report Share Posted January 6, 2013 Viss jau tika izdarīts un funkcijas failam jau no paša sākuma bija kļudu izvade ieslēgta, bet kā nav, tā nav. Pat neuzrāda neko. Quote Link to comment Share on other sites More sharing options...
rpr Posted January 7, 2013 Report Share Posted January 7, 2013 tas arī būtu dīvaini, ja kaut ko uzrādīti reālā lapā. ja tā ir izstrades vide, tad uzliec, lai rāda errorus, ja nav reālā, tad meklē error logus. phpinfo() tev vajadzētu palīdzēt ar to kāda ir tava konfigurācija. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.