Jump to content
MakeWebGames

Will

Members
  • Posts

    215
  • Joined

  • Last visited

    Never

Everything posted by Will

  1. This is just a small bit of javascript so when users buy something from the shop it works out the total cost there to save the user working it out. Also when you click on the form it removes the default value and if they don't type anything puts it back when they remove focus. NOTE: The money format function isn't mine it was free from some site. Firstly put this (you must keep the ?> <? because it is not php): ?> <script language="Javascript" type="text/javascript"> //<![CDATA[ function moneyformat(num) { num = num.toString().replace(/\$|\,/g,''); if(isNaN(num)) num = "0"; sign = (num == (num = Math.abs(num))); num = Math.floor(num*100+0.50000000001); cents = num%100; num = Math.floor(num/100).toString(); if(cents<10) cents = "0" + cents; for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3)); return (((sign)?'':'-') + '$' + num); } function tot(id,a,b) { var c=a*Math.round(b); var d=moneyformat(c); document.getElementById("res" + id).innerHTML = d; } function clearText(thefield){ if (thefield.defaultValue==thefield.value) thefield.value = "" } function returnText(thefield){ if (thefield.value=='' || thefield.value==0) thefield.value = thefield.defaultValue } //]]> </script> <? Put it after: $qtwo=mysql_query("SELECT si.*,i.*,it.* FROM shopitems si LEFT JOIN items i ON si.sitemITEMID=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE si.sitemSHOP={$_GET['shop']} ORDER BY i.itmtype ASC, i.itmbuyprice ASC, i.itmname ASC",$c) or die(mysql_error()); $lt=""; Secondly, put: $buyprice=money_formatter($r['itmbuyprice']); $sellprice=money_formatter($r['itmsellprice']); ?><tr><td><?=$r['itmname']?></td><td><?=$r['itmdesc']?></td><td><?=$buyprice?></td><td><?=$sellprice?></td><td><form action='itembuy.php?ID=<?=$r['itmid']?>' name="shopbuy" method='post'> Qty: <input type='text' name='qty' value='1' onkeyup="tot(<?=$r['itmid']?>,<?=$r['itmbuyprice']?>,this.value);" onfocus="clearText(this);" onblur="returnText(this);" /><input type='submit' value='Buy' /></form><div id="res<?=$r['itmid']?>" align="center"><?=$buyprice?></div></td></tr> <? After: while($r=mysql_fetch_array($qtwo)) { if($lt!=$r['itmtypename']) { $lt=$r['itmtypename']; print"<tr style="background: gray;"><th colspan="5">{$lt}</th></tr>"; } Which replaces: print "\n<tr><td>{$r['itmname']}</td><td>{$r['itmdesc']}</td><td>\${$r['itmbuyprice']}</td><td>\${$r['itmsellprice']}</td><td><form action='itembuy.php?ID={$r['itmid']}' method='post'>Qty: <input type='text' name='qty' value='1' /><input type='submit' value='Buy' /></form></td></tr>"; It's tested and works so any problems are likly to be yours. You can see it in action on my site, Heres a screen shot:
  2. Just thought I'll share this with you because it took me ages to realize why it happened. I was using AJAX to do some form stuff when the use clicked a button, but it only worked the first time I spent ages thinking it was me but then I found an article on the Internet saying the IE caches the pages. To fix this just put this at the end of the URL you are calling in the javascript:   + "&ms=" + new Date().getTime(); I'm sure you can guess that this makes the URL different every time so IE can't cache it.
  3. Re: (v2 cron stop working) You just copy the url n the cron table remove the "curl " at the beginning and put it in you address bar.
  4. Re: (v2 cron stop working) I don't see any ?> at the end. Perhaps that is it.
  5. Re: PHP script to create email address and sub domains. :evil:. Why?
  6. Re: [mccode] Advanced Warning System errors? The <? ?> is so I can use dreamwevear to get my tables right. It works fine with them. This is tested and works on my site.
  7. Re: [mccode] Advanced Warning System I have added event notification, made sure everywhere has a back link, made so admins can remove and edit not just the owners and changed so every 6 warnings (6,12,18,24, etc) the user goes to fed for 100 days.   <?php /*----------------------------------------------------- -- Warning.php -----------------------------------------------------*/ session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); if($ir['user_level'] != 2 && $ir['user_level'] != 3) { echo"Staff Only!"; $h->endpage(); exit; } switch($_GET['action']) { case 'add': addwarning(); break; case 'addsub': addwarning2(); break; case 'del': deletewarning(); break; case 'edit': editwarning(); break; case 'edit2': editwarning2(); break; default: index(); break; } function index() { global $ir,$c,$userid; ?><h3>Viewing Warnings For ID: [url='viewuser.php?u=<? echo $_GET[']'><? echo $_GET['user']; ?>[/url]</h3> <? $q=mysql_query("SELECT w.*,u.* FROM warnings w LEFT JOIN users u ON w.warner=u.userid WHERE w.user={$_GET['user']} ORDER BY w.time DESC",$c); ?><center><font color="#FF0000"><h4>Total Warnings: <? echo mysql_num_rows($q); ?></h4></font> [[url='warnings.php?action=add&userid=<? echo $_GET[']&user=<? echo $_GET['user']; ?>'>Add Warning[/url]] <table width=90% border=1 align=center><tr><tr style='background: gray'><td>Warned By:</td><td width=40%>Reason</td><td>Date</td><td>Links</td></tr><? while($r=mysql_fetch_array($q)) { $warned=date('F j, Y, g:i:s a',$r['time']); ?><tr><td>[url='viewuser.php?u=<? echo $r[']'><? echo $r['username']; ?>[/url]</td><td><? echo $r['warnedfor']; ?></td><td><? echo $warned; ?></td><td><? if($ir['user_level'] == 2) { ?>[[url='warnings.php?action=del&ID=<? echo $r[']&user=<? echo $_GET['user']; ?>'>Remove[/url]] <? } if($ir['user_level'] == 2) { ?>[[url='warnings.php?action=edit&ID=<? echo $r[']&user=<? echo $_GET['user']; ?>'>Edit[/url]]<? } ?></td></tr><? } ?></table> [url="viewuser.php?u=<? echo $_GET['user']; ?>"][b]Back[/b][/url]</p> <? } function addwarning() { global $ir,$c,$userid; ?> <form action="warnings.php?action=addsub&user=<? echo $_GET['user']; ?>" method="post"> <input style="visibility: hidden" name="user" value="<? echo $_GET['userid']; ?>"> Reason: <textarea rows="7" cols="30" name="reason"></textarea> <input type="submit" value="Add warning"></form><? } function addwarning2() { global $ir,$c,$userid; $_POST['user']=($_POST['user']); $_POST['reason']=($_POST['reason']); mysql_query("INSERT INTO warnings VALUES ('','{$_POST['user']}','{$_POST['reason']}','$userid',unix_timestamp())",$c); event_add($_POST['user'],"You have been given a warning, <font color='red'>if you have 6 warnings you could find yourself in Fed</font>.", $c); $checkfed=mysql_query("SELECT * FROM warnings WHERE user='{$_POST['user']}'",$c); if((mysql_num_rows($checkfed) % 6)==0 && mysql_num_rows($checkfed) != 0) { mysql_query("UPDATE users SET fedjail=1 WHERE userid='{$_POST['user']}'",$c); mysql_query("INSERT INTO fedjail VALUES('','{$_POST['user']}','100','$userid','Reached 6 warnings in game. Account jailed.')",$c); ?> Fedded for having 6 warnings.</p><? } ?> Warning Added</p> [*][url='viewuser.php?u=<? echo $_POST[']'>Back to users profile[/url] [*][url='warnings.php?user=<? echo $_GET[']'>Back to warnings[/url] <? } function deletewarning() { global $ir,$c,$userid; if($ir['user_level'] != 2) { die("Owner Only");} mysql_query("DELETE FROM warnings WHERE id={$_GET['ID']}",$c); ?>Warning Deleted. [url="warnings.php?user=<? echo $_GET['user']; ?>"][b]Back[/b][/url]<? } function editwarning() { global $ir,$c,$userid; $target=$_GET['ID']; $edit=mysql_query("SELECT * FROM warnings WHERE id='$target'",$c); while($r=mysql_fetch_array($edit)) { if($r['warner'] != $userid || $ir['user_level'] != 2) { die("You never set this warning, therefore cannot edit it"); } ?><h3>Edit Warning</h3> <form action="warnings.php?action=edit2&user=<? echo $_GET['user']; ?>" method="post"> <input style='visibility: hidden;' name="id" value="<? echo $target; ?>"> <textarea rows="7" cols="30" name="reason"><? echo $r['warnedfor']; ?></textarea> <input type="submit" value='Edit Warning'></form><? } } function editwarning2() { global $ir,$c,$userid; mysql_query("UPDATE warnings SET warnedfor={$_POST['reason']} WHERE id={$_POST['id']}",$c); ?>Warning Updated. [*][url='warnings.php?user=<? echo $_GET[']'>[b]Back[/b][/url]<? } $h->endpage(); ?>
  8. Re: PHP script to create email address and sub domains. Yeah I have some script like that which I changed for cPanel 11. Someone somewhere on a site said about using Shell access. Because although I could use cpanel my intended use will make hundreds of sub domains and emails.
  9. As the title said, is there any script which can create a sub domain on your domain; e.g "sub.thecrimelife.net". Also is there anyway a script can create an email address on your domain. e.g. "[email protected]". The only way I can think of doing this is to make a script which can do it through the cpanel interface, I have made a working interface to make sub domains, but it seems a bit long winded. Any ideas? Any help would be appreciated.
  10. Re: [Free] [V1] Guess What Cup? (Casino Game) Here an upside down cup:
  11. Re: [Free] [V1] Guess What Cup? (Casino Game) Technically there not upside down. You can see the other side of the rim. Use one of there:
  12. Re: [Free] [V1] Guess What Cup? (Casino Game) Surly the cups would be upside down? :-D
  13. Re: Game in Different Languages. Hmm. The php file idea sounds good. I thought of the Database so I could have a panel for my translators to translate phrases without me doing it.
  14. I'm thinking of making the entire site into other languages, I have people who can translate it. I was thinking either copy all the files into a different folder with all the text a different language or have a database for languages and have a code for every text and every page it searches the database for that code. Which method do you people think is faster? I would prefer the second but I'm thinking it will be too slow.
  15. Re: [Free] Password reset code Did you change the link in the email to your site name? Did you upload all the files with the correct files names?
  16. Re: Game owners sending out referal link. Me as a user would be put off if you gave referal links to advertise your game, I always remove them.
  17. Re: Game owners sending out referal link. lol. Thats exactly what I mean. If you are the owner you don't neeed to work for crystals.   You could just change the database.
  18. I see a lot of people who own games giving out there links like this: /register.php?REF=1. Why would they need referrals to their own game. To claim the reward? You should just give the URL. It's just odd.
  19. Re: Code takes longer than 30 sec to run. Thanks I fixed by putting set_time_limit(1000); at the beginning.
  20. I'm making a lottery mod where users can buy tickets and there is a draw every week. The code which checks the numbers:: <?php /*##################################################### -LOTTO -COPYRIGHT William Hector -For use on The Crime Life only. ######################################################*/ require "mysql.php"; require "global_func.php"; global $c; // Password if ($_GET['pass'] != '#########################') { die("Go away"); } $lo=mysql_query("SELECT * FROM lotto WHERE numbers=''",$c) or die(mysql_error()); $l=mysql_fetch_array($lo); // Number generation $na=rand(1,40); $sa = "|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|"; $ga= "|" . $na . "|"; $fa = str_replace($ga, "|", $sa); $nb=rand(1,39); $d = explode("|", $fa); $anb=$d[$nb]; $gb= "|" . $anb . "|"; $fb = str_replace($gb, "|", $fa); $nc=rand(1,38); $d3 = explode("|", $fb); $anc=$d3[$nc]; $gc= "|" . $anc . "|"; $fc = str_replace($gc, "|", $fb); $nd=rand(1,37); $d4 = explode("|", $fc); $and=$d4[$nd]; $gd= "|" . $and . "|"; $fd = str_replace($gd, "|", $fc); $ne=rand(1,36); $d5 = explode("|", $fd); $ane=$d5[$ne]; $ge= "|" . $ane . "|"; $fe = str_replace($ge, "|", $fd); $nf=rand(1,35); $d6 = explode("|", $fe); $anf=$d6[$nf]; $number=$na . "|" . $anb . "|" . $anc . "|" . $and . "|" . $ane . "|" . $anf . "|"; // Ticket check: $week=$l['weekno']; echo "Week number:"; echo $week; $tic = mysql_query("SELECT * FROM lottotic WHERE weekno = {$week}",$c) or die(mysql_error()); if (mysql_num_rows($tic) == 0) { die("Oh noes!"); } while($ti=mysql_fetch_array($tic)) { $tn=$ti['numbers']; $t = explode("|", $tn); if ($na==$t[0] || $na==$t[1] || $na==$t[2] || $na==$t[3] || $na==$t[4] || $na==$t[5]) { $ck1=1; } else { $ck1=0; } if ($anb==$t[0] || $anb==$t[1] || $anb==$t[2] || $anb==$t[3] || $anb==$t[4] || $anb==$t[5]) { $ck2=1; } else { $ck2=0; } if ($anc==$t[0] || $anc==$t[1] || $anc==$t[2] || $anc==$t[3] || $anc==$t[4] || $anc==$t[5]) { $ck3=1; } else { $ck3=0; } if ($and==$t[0] || $and==$t[1] || $and==$t[2] || $and==$t[3] || $and==$t[4] || $and==$t[5]) { $ck4=1; } else { $ck4=0; } if ($ane==$t[0] || $ane==$t[1] || $ane==$t[2] || $ane==$t[3] || $ane==$t[4] || $ane==$t[5]) { $ck5=1; } else { $ck5=0; } if ($anf==$t[0] || $anf==$t[1] || $anf==$t[2] || $anf==$t[3] || $anf==$t[4] || $anf==$t[5]) { $ck6=1; } else { $ck6=0; } $nrt=$ck1+$ck2+$ck3+$ck4+$ck5+$ck6; if ($nrt>2) { $id=$ti['id']; $userid=$ti['userid']; mysql_query("INSERT INTO lottowin VALUES('', '{$week}', '{$userid}', '{$nrt}', '{$id}')",$c) or die(mysql_error()); } } } $lid=$l['id']; mysql_query("UPDATE lotto SET numbers='$number' WHERE id=$lid",$c) or die(mysql_error()); $nxtwk=$week+1; mysql_query("INSERT INTO lotto VALUES('', '{$nxtwk}', '0', '', '')",$c) or die(mysql_error()); //money $money=$l['jackpot']; $mth=($money/100); $sipt=($mth*60); $topt=($mth*20); $tept=($mth*10); //6 winners $siwin = mysql_query("SELECT * FROM lottowin WHERE week = {$week} AND nomatch=6",$c) or die(mysql_error()); { if (mysql_num_rows($siwin) == 0) { mysql_query("UPDATE lotto SET jackpot=jackpot+$sipt WHERE weekno=$nxtwk",$c) or die(mysql_error()); } else { $siners=mysql_num_rows($siwin); $each=$sipt/$siners; while($w=mysql_fetch_array($siwin)) { $usr = mysql_query("SELECT * FROM users WHERE userid={$w['userid']}",$c) or die(mysql_error()); $ur=mysql_fetch_array($usr); $userid=$w['userid']; $monn=money_formatter($each); mysql_query("UPDATE users SET money=money+{$each} WHERE userid=$userid",$c) or die(mysql_error()); // event_add($userid,"Congratualtions {$ur['username']}, you have won {$monn} on the lottery with 6 Balls right",$c); $an=mysql_query("SELECT * FROM lottoan WHERE userid=$userid AND week={$week}",$c) or die(mysql_error()); { if (mysql_num_rows($an)>0) { mysql_query("UPDATE lottoan SET six=six+1, sixmon=sixmon+$each WHERE userid=$userid",$c) or die(mysql_error()); } else { mysql_query("INSERT INTO lottoan VALUES('', '{$week}', '{$userid}', 1, '{$each}', 0, 0, 0, 0, 0, 0)",$c) or die(mysql_error()); } } } } } //5balls $towin = mysql_query("SELECT * FROM lottowin WHERE week = {$week} AND nomatch=5",$c) or die(mysql_error()); $toners=mysql_num_rows($towin); $each=$topt/$toners; while($w=mysql_fetch_array($towin)) { $usr = mysql_query("SELECT * FROM users WHERE userid={$w['userid']}",$c) or die(mysql_error()); $ur=mysql_fetch_array($usr); $userid=$w['userid']; $monn=money_formatter($each); mysql_query("UPDATE users SET money=money+{$each} WHERE userid=$userid",$c) or die(mysql_error()); // event_add($userid,"Congratualtions {$ur['username']}, you have won {$monn} on the lottery with 5 Balls right",$c); $an=mysql_query("SELECT * FROM lottoan WHERE userid=$userid AND week={$week}",$c) or die(mysql_error()); if (mysql_num_rows($an)>0) { mysql_query("UPDATE lottoan SET five=five+1, fivemon=fivemon+$each WHERE userid=$userid",$c) or die(mysql_error()); } else { mysql_query("INSERT INTO lottoan VALUES('', '{$week}', '{$userid}', 0, 0, 1, '{$each}', 0, 0, 0, 0)",$c) or die(mysql_error()); } } //4balls $fowin = mysql_query("SELECT * FROM lottowin WHERE week = {$week} AND nomatch=4",$c) or die(mysql_error()); $foners=mysql_num_rows($fowin); $each=$tept/$foners; while($w=mysql_fetch_array($fowin)) { $usr = mysql_query("SELECT * FROM users WHERE userid={$w['userid']}",$c) or die(mysql_error()); $ur=mysql_fetch_array($usr); $userid=$w['userid']; $monn=money_formatter($each); mysql_query("UPDATE users SET money=money+{$each} WHERE userid=$userid",$c) or die(mysql_error()); // event_add($userid,"Congratualtions {$ur['username']}, you have won {$monn} on the lottery with 4 Balls right",$c); $an=mysql_query("SELECT * FROM lottoan WHERE userid=$userid AND week={$week}",$c) or die(mysql_error()); if (mysql_num_rows($an)>0) { mysql_query("UPDATE lottoan SET four=four+1, fourmon=fourmon+$each WHERE userid=$userid",$c) or die(mysql_error()); } else { mysql_query("INSERT INTO lottoan VALUES('', '{$week}', '{$userid}', 0, 0, 0, 0, 1, '{$each}', 0, 0)",$c) or die(mysql_error()); } } //3 balls $thwin = mysql_query("SELECT * FROM lottowin WHERE week = {$week} AND nomatch=3",$c) or die(mysql_error()); while($w=mysql_fetch_array($thwin)) { $usr = mysql_query("SELECT * FROM users WHERE userid={$w['userid']}",$c) or die(mysql_error()); $ur=mysql_fetch_array($usr); mysql_query("UPDATE users SET money=money+100 WHERE userid=$userid",$c) or die(mysql_error()); // event_add($userid,"Congratualtions {$ur['username']}, you have won /$100 on the lottery with 3 Balls right",$c); $an=mysql_query("SELECT * FROM lottoan WHERE userid=$userid AND week={$week}",$c) or die(mysql_error()); if (mysql_num_rows($an)>0) { mysql_query("UPDATE lottoan SET three=three+1, threemon=threemon+10 WHERE userid=$userid",$c) or die(mysql_error()); } else { mysql_query("INSERT INTO lottoan VALUES('', '{$week}', '{$userid}', 0, 0, 0, 0, 0, 0, 1, 10)",$c) or die(mysql_error()); } } $anw = mysql_query("SELECT * FROM lottoan WHERE week = {$week}",$c) or die(mysql_error()); while($w=mysql_fetch_array($anw)) { $userid=$w['userid']; $usr = mysql_query("SELECT * FROM users WHERE userid={$w['userid']}",$c) or die(mysql_error()); $ur=mysql_fetch_array($usr); if ($w['six'] > 0) { $tic=$w['six']; $mon=$w['sixmon']; $monn=money_formatter($mon); event_add($userid,"Congratualtions {$ur['username']}, you have won {$monn} on the lottery by getting 6 balls right with $tic ticket(s)",$c); } if ($w['four'] > 0) { $tic=$w['four']; $mon=$w['fourmon']; $monn=money_formatter($mon); event_add($userid,"Congratualtions {$ur['username']}, you have won {$monn} on the lottery by getting 4 balls right with $tic ticket(s)",$c); } if ($w['five'] > 0) { $tic=$w['five']; $mon=$w['fivemon']; $monn=money_formatter($mon); event_add($userid,"Congratualtions {$ur['username']}, you have won {$monn} on the lottery by getting 5 balls right with $tic ticket(s)",$c); } if ($w['three'] > 0) { $tic=$w['three']; $mon=$w['threemon']; $monn=money_formatter($mon); event_add($userid,"Congratualtions {$ur['username']}, you have won {$monn} on the lottery by getting 3 balls right with $tic ticket(s)",$c); } } ?> Produced an out of memory problem when there where over 1 million tickets. To fix this I replaced it with:   <?php /*##################################################### -LOTTO -COPYRIGHT William Hector -For use on The Crime Life only. ######################################################*/ require "mysql.php"; require "global_func.php"; global $c; // Password if ($_GET['pass'] != '#########################') { die("Go away"); } $lo=mysql_query("SELECT * FROM lotto WHERE numbers=''",$c) or die(mysql_error()); $l=mysql_fetch_array($lo); // Number generation $na=rand(1,40); $sa = "|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|"; $ga= "|" . $na . "|"; $fa = str_replace($ga, "|", $sa); $nb=rand(1,39); $d = explode("|", $fa); $anb=$d[$nb]; $gb= "|" . $anb . "|"; $fb = str_replace($gb, "|", $fa); $nc=rand(1,38); $d3 = explode("|", $fb); $anc=$d3[$nc]; $gc= "|" . $anc . "|"; $fc = str_replace($gc, "|", $fb); $nd=rand(1,37); $d4 = explode("|", $fc); $and=$d4[$nd]; $gd= "|" . $and . "|"; $fd = str_replace($gd, "|", $fc); $ne=rand(1,36); $d5 = explode("|", $fd); $ane=$d5[$ne]; $ge= "|" . $ane . "|"; $fe = str_replace($ge, "|", $fd); $nf=rand(1,35); $d6 = explode("|", $fe); $anf=$d6[$nf]; $number=$na . "|" . $anb . "|" . $anc . "|" . $and . "|" . $ane . "|" . $anf . "|"; // Ticket check: $week=$l['weekno']; echo "Week number:"; echo $week; $ticyuy = mysql_query("SELECT COUNT(*) FROM lottotic WHERE weekno = {$week}",$c) or die(mysql_error()); $ticyu = mysql_fetch_array($ticyuy); $tot=$ticyu[0]; if ($ticyu[0] == 0) { die("Oh noes!"); } for ($y=0; $y<10; $y++) { $ticyuy = mysql_query("SELECT COUNT(*) FROM lottotic WHERE weekno = {$week}",$c) or die(mysql_error()); $ticyu = mysql_fetch_array($ticyuy); $tot=$ticyu[0]; $div=$tot/10; $start=$div*$y; $tic = mysql_query("SELECT * FROM lottotic WHERE weekno = {$week} LIMIT {$start},{$div}",$c) or die(mysql_error()); while($ti=mysql_fetch_array($tic)) { $tn=$ti['numbers']; $t = explode("|", $tn); if ($na==$t[0] || $na==$t[1] || $na==$t[2] || $na==$t[3] || $na==$t[4] || $na==$t[5]) { $ck1=1; } else { $ck1=0; } if ($anb==$t[0] || $anb==$t[1] || $anb==$t[2] || $anb==$t[3] || $anb==$t[4] || $anb==$t[5]) { $ck2=1; } else { $ck2=0; } if ($anc==$t[0] || $anc==$t[1] || $anc==$t[2] || $anc==$t[3] || $anc==$t[4] || $anc==$t[5]) { $ck3=1; } else { $ck3=0; } if ($and==$t[0] || $and==$t[1] || $and==$t[2] || $and==$t[3] || $and==$t[4] || $and==$t[5]) { $ck4=1; } else { $ck4=0; } if ($ane==$t[0] || $ane==$t[1] || $ane==$t[2] || $ane==$t[3] || $ane==$t[4] || $ane==$t[5]) { $ck5=1; } else { $ck5=0; } if ($anf==$t[0] || $anf==$t[1] || $anf==$t[2] || $anf==$t[3] || $anf==$t[4] || $anf==$t[5]) { $ck6=1; } else { $ck6=0; } $nrt=$ck1+$ck2+$ck3+$ck4+$ck5+$ck6; if ($nrt>2) { $id=$ti['id']; $userid=$ti['userid']; mysql_query("INSERT INTO lottowin VALUES('', '{$week}', '{$userid}', '{$nrt}', '{$id}')",$c) or die(mysql_error()); } } } $lid=$l['id']; mysql_query("UPDATE lotto SET numbers='$number' WHERE id=$lid",$c) or die(mysql_error()); $nxtwk=$week+1; mysql_query("INSERT INTO lotto VALUES('', '{$nxtwk}', '0', '', '')",$c) or die(mysql_error()); //money $money=$l['jackpot']; $mth=($money/100); $sipt=($mth*60); $topt=($mth*20); $tept=($mth*10); //6 winners $siwin = mysql_query("SELECT * FROM lottowin WHERE week = {$week} AND nomatch=6",$c) or die(mysql_error()); { if (mysql_num_rows($siwin) == 0) { mysql_query("UPDATE lotto SET jackpot=jackpot+$sipt WHERE weekno=$nxtwk",$c) or die(mysql_error()); } else { $siners=mysql_num_rows($siwin); $each=$sipt/$siners; while($w=mysql_fetch_array($siwin)) { $usr = mysql_query("SELECT * FROM users WHERE userid={$w['userid']}",$c) or die(mysql_error()); $ur=mysql_fetch_array($usr); $userid=$w['userid']; $monn=money_formatter($each); mysql_query("UPDATE users SET money=money+{$each} WHERE userid=$userid",$c) or die(mysql_error()); // event_add($userid,"Congratualtions {$ur['username']}, you have won {$monn} on the lottery with 6 Balls right",$c); $an=mysql_query("SELECT * FROM lottoan WHERE userid=$userid AND week={$week}",$c) or die(mysql_error()); { if (mysql_num_rows($an)>0) { mysql_query("UPDATE lottoan SET six=six+1, sixmon=sixmon+$each WHERE userid=$userid",$c) or die(mysql_error()); } else { mysql_query("INSERT INTO lottoan VALUES('', '{$week}', '{$userid}', 1, '{$each}', 0, 0, 0, 0, 0, 0)",$c) or die(mysql_error()); } } } } } //5balls $towin = mysql_query("SELECT * FROM lottowin WHERE week = {$week} AND nomatch=5",$c) or die(mysql_error()); $toners=mysql_num_rows($towin); $each=$topt/$toners; while($w=mysql_fetch_array($towin)) { $usr = mysql_query("SELECT * FROM users WHERE userid={$w['userid']}",$c) or die(mysql_error()); $ur=mysql_fetch_array($usr); $userid=$w['userid']; $monn=money_formatter($each); mysql_query("UPDATE users SET money=money+{$each} WHERE userid=$userid",$c) or die(mysql_error()); // event_add($userid,"Congratualtions {$ur['username']}, you have won {$monn} on the lottery with 5 Balls right",$c); $an=mysql_query("SELECT * FROM lottoan WHERE userid=$userid AND week={$week}",$c) or die(mysql_error()); if (mysql_num_rows($an)>0) { mysql_query("UPDATE lottoan SET five=five+1, fivemon=fivemon+$each WHERE userid=$userid",$c) or die(mysql_error()); } else { mysql_query("INSERT INTO lottoan VALUES('', '{$week}', '{$userid}', 0, 0, 1, '{$each}', 0, 0, 0, 0)",$c) or die(mysql_error()); } } //4balls $fowin = mysql_query("SELECT * FROM lottowin WHERE week = {$week} AND nomatch=4",$c) or die(mysql_error()); $foners=mysql_num_rows($fowin); $each=$tept/$foners; while($w=mysql_fetch_array($fowin)) { $usr = mysql_query("SELECT * FROM users WHERE userid={$w['userid']}",$c) or die(mysql_error()); $ur=mysql_fetch_array($usr); $userid=$w['userid']; $monn=money_formatter($each); mysql_query("UPDATE users SET money=money+{$each} WHERE userid=$userid",$c) or die(mysql_error()); // event_add($userid,"Congratualtions {$ur['username']}, you have won {$monn} on the lottery with 4 Balls right",$c); $an=mysql_query("SELECT * FROM lottoan WHERE userid=$userid AND week={$week}",$c) or die(mysql_error()); if (mysql_num_rows($an)>0) { mysql_query("UPDATE lottoan SET four=four+1, fourmon=fourmon+$each WHERE userid=$userid",$c) or die(mysql_error()); } else { mysql_query("INSERT INTO lottoan VALUES('', '{$week}', '{$userid}', 0, 0, 0, 0, 1, '{$each}', 0, 0)",$c) or die(mysql_error()); } } //3 balls $thwin = mysql_query("SELECT * FROM lottowin WHERE week = {$week} AND nomatch=3",$c) or die(mysql_error()); while($w=mysql_fetch_array($thwin)) { $usr = mysql_query("SELECT * FROM users WHERE userid={$w['userid']}",$c) or die(mysql_error()); $ur=mysql_fetch_array($usr); mysql_query("UPDATE users SET money=money+100 WHERE userid=$userid",$c) or die(mysql_error()); // event_add($userid,"Congratualtions {$ur['username']}, you have won /$100 on the lottery with 3 Balls right",$c); $an=mysql_query("SELECT * FROM lottoan WHERE userid=$userid AND week={$week}",$c) or die(mysql_error()); if (mysql_num_rows($an)>0) { mysql_query("UPDATE lottoan SET three=three+1, threemon=threemon+10 WHERE userid=$userid",$c) or die(mysql_error()); } else { mysql_query("INSERT INTO lottoan VALUES('', '{$week}', '{$userid}', 0, 0, 0, 0, 0, 0, 1, 10)",$c) or die(mysql_error()); } } $anw = mysql_query("SELECT * FROM lottoan WHERE week = {$week}",$c) or die(mysql_error()); while($w=mysql_fetch_array($anw)) { $userid=$w['userid']; $usr = mysql_query("SELECT * FROM users WHERE userid={$w['userid']}",$c) or die(mysql_error()); $ur=mysql_fetch_array($usr); if ($w['six'] > 0) { $tic=$w['six']; $mon=$w['sixmon']; $monn=money_formatter($mon); event_add($userid,"Congratualtions {$ur['username']}, you have won {$monn} on the lottery by getting 6 balls right with $tic ticket(s)",$c); } if ($w['four'] > 0) { $tic=$w['four']; $mon=$w['fourmon']; $monn=money_formatter($mon); event_add($userid,"Congratualtions {$ur['username']}, you have won {$monn} on the lottery by getting 4 balls right with $tic ticket(s)",$c); } if ($w['five'] > 0) { $tic=$w['five']; $mon=$w['fivemon']; $monn=money_formatter($mon); event_add($userid,"Congratualtions {$ur['username']}, you have won {$monn} on the lottery by getting 5 balls right with $tic ticket(s)",$c); } if ($w['three'] > 0) { $tic=$w['three']; $mon=$w['threemon']; $monn=money_formatter($mon); event_add($userid,"Congratualtions {$ur['username']}, you have won {$monn} on the lottery by getting 3 balls right with $tic ticket(s)",$c); } } ?> This one produces the error that the execution time has exceeded 30 seconds. Is there anyway to optimize this code so it runs faster? I have tried dividing it into two pages but the but which checks the tickets still takes longer than 30 seconds. Any help will be appreciated. Thanks in advance.
  21. Re: Im Making A Online Radio Station, HELP>>>>> It would never be free. I tried to do that and the licensing costs are huge. for standard (commercial) music it will cost you £50 per track per year.
  22. Re: [Free] Password reset code It works for me. You have to change he game name values to be specified to you and check that the rows exist. Also your host needs to allow email to be sent using php.
  23. Re: [Free] Password reset code Thanks.
  24. Will

    Optimize generation

    Re: Optimize generation Done. You are idle......
  25. Will

    Optimize generation

    Re: Optimize generation What I was doing before. A large encryption database.
×
×
  • Create New...