Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Have you purchased a mod and are struggling to install it? Cronwerks now installs mods for only $3/$2.50. Message Cronus to discuss the details or purchase.


This forum is now closed and has moved to a new location! Click here to find out why.

AuthorTopic: [V2 DRUGS FARM] and crons_day  (Read 944 times)

Gori

  • Basic Member
  • *
  • Reputation Power: 5
  • Gori has no influence.
  • Offline Offline
  • Posts: 10
    • View Profile
[V2 DRUGS FARM] and crons_day
« on: December 12, 2009, 08:32:18 PM »
i now have


Parse error: syntax error, unexpected T_VARIABLE in /home/mafia/public_html/cron_day.php on line 149

in
cron_day

Code: [Select]
<?php
include "config.php";
global 
$_CONFIG;
if(
$_GET['code'] != $_CONFIG['code']) { die(""); }
define("MONO_ON"1);
require 
"class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
 
$_CONFIG['username'],
 
$_CONFIG['password'],
 
$_CONFIG['database'],
 
$_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
$db->query("UPDATE fedjail set fed_days=fed_days-1");
$q=$db->query("SELECT * FROM fedjail WHERE fed_days=0");
$ids=array();
while(
$r=$db->fetch_row($q))
{
$ids[]=$r['fed_userid'];
}
if(
count($ids) > 0)
{
$db->query("UPDATE users SET fedjail=0 WHERE userid IN(".implode(","

$ids).")");
}
$db->query("DELETE FROM fedjail WHERE fed_days=0");
$db->query("UPDATE users SET daysingang=daysingang+1 WHERE gang > 

0"
);
$db->query("UPDATE users SET daysold=daysold+1, boxes_opened=0");
$db->query("UPDATE users SET mailban=mailban-1 WHERE mailban > 0");
$db->query("UPDATE users SET donatordays=donatordays-1 WHERE 

donatordays > 0"
);
$db->query("UPDATE users SET cdays=cdays-1 WHERE course > 0");
$db->query("UPDATE users SET bankmoney=bankmoney+(bankmoney/50) where 

bankmoney>0"
);
$db->query("UPDATE users SET cybermoney=cybermoney+(cybermoney/100*7) 

where cybermoney>0"
);
$q=$db->query("SELECT * FROM users WHERE cdays=0 AND course > 0");
while(
$r=$db->fetch_row($q))
{
$cd=$db->query("SELECT * FROM courses WHERE crID={$r['course']}");
$coud=$db->fetch_row($cd);
$userid=$r['userid'];
$db->query("INSERT INTO coursesdone VALUES({$r['userid']},{$r

['course']})"
);
$upd="";
$ev="";
if(
$coud['crSTR'] > 0)
{
$upd.=",us.strength=us.strength+{$coud['crSTR']}";
$ev.=", {$coud['crSTR']} strength";
}
if(
$coud['crGUARD'] > 0)
{
$upd.=",us.guard=us.guard+{$coud['crGUARD']}";
$ev.=", {$coud['crGUARD']} guard";
}
if(
$coud['crLABOUR'] > 0)
{
$upd.=",us.labour=us.labour+{$coud['crLABOUR']}";
$ev.=", {$coud['crLABOUR']} labour";
}
if(
$coud['crAGIL'] > 0)
{
$upd.=",us.agility=us.agility+{$coud['crAGIL']}";
$ev.=", {$coud['crAGIL']} agility";
}
if(
$coud['crIQ'] > 0)
{
$upd.=",us.IQ=us.IQ+{$coud['crIQ']}";
$ev.=", {$coud['crIQ']} IQ";
}
$ev=substr($ev,1);
if (
$upd) {
$db->query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid SET us.userid=us.userid $upd WHERE u.userid=$userid");
}
$db->query("INSERT INTO events VALUES('',$userid,unix_timestamp
(),0,'Congratulations, you completed the {$coud['crNAME']} and gained 
$ev!')"
);
}
$db->query("UPDATE users SET course=0 WHERE cdays=0");
$db->query("TRUNCATE TABLE votes;");
$stocks mysql_query("SELECT stockID FROM `stock_stocks`");
while(
$soc mysql_fetch_assoc($stocks))    {
    
$rand mt_rand(1,2);
    if(
$rand == 2)    {
        
$mr mt_rand(10,250);
        
mysql_query("UPDATE `stock_stocks` SET `stockUD` = 2, 
`stockCHANGE` = "
.$mr.", `stockNPRICE` = (`stockNPRICE` - ".$mr.") WHERE `stockID` = ".$soc['stockID']);
    }
    else    {
        
$mr mt_rand(10,250);
        
mysql_query("UPDATE `stock_stocks` SET `stockUD` = 1, 
`stockCHANGE` = "
.$mr.", `stockNPRICE` = (`stockNPRICE` + ".$mr.") WHERE `stockID` = ".$soc['stockID']);
    }
}
include_once(
'global_func.php');
$sel mysql_query("SELECT stockID,stockNAME FROM `stock_stocks` WHERE `stockNPRICE` < 0");
while(
$soc mysql_fetch_assoc($sel))    {
    if(
mysql_num_rows(mysql_query("SELECT holdingID FROM `stock_holdings` WHERE `holdingSTOCK` = ".$soc['stockID'])))    {
        
$user mysql_query("SELECT holdingUSER FROM `stock_holdings` WHERE `holdingSTOCK` = ".$soc['stockID']);
        
$user mysql_fetch_assoc($user);
        
event_add($user['holdingUSER'], 'Stock '.$soc['stockNAME'].' crashed, you lost all your shares.');
    }
    
mysql_query("DELETE FROM `stock_holdings` WHERE `holdingSTOCK` = ".$soc['stockID']);
    
mysql_query("UPDATE `stock_stocks` SET `stockUD` = 1,`stockCHANGE` = 0,`stockNPRICE` = `stockOPRICE` WHERE `stockID` = ".$soc['stockID']);
}
//DRUGS MARKET
mysql_query("UPDATE `drugsmarket` SET `dm_daysleft` = `dm_daysleft` - '1'",$c);
mysql_query("DELETE FROM `drugsmarket` WHERE `dm_daysleft` = '0'",$c);
//Drug Farm itself
mysql_query("UPDATE `drug_collection` SET `dc_age` = `dc_age` + '1'",$c);
mysql_query("UPDATE `drug_farm` SET `df_daysleft` = `df_daysleft` - '1'",$c);
$f=mysql_query("SELECT * FROM `drug_farm` WHERE `df_daysleft` = '0'",$c);
while(
$r=mysql_fetch_array($f))
{
mysql_query("INSERT INTO `drug_collection` (`dc_id`, `dc_drug`,`dc_user`, `dc_holding`, `dc_age`) VALUES ('NULL', '$r[df_drug]', '$r[df_user]', '0', 

'0');"
,$c);
}
mysql_query("DELETE * FROM `drug_farm` WHERE `df_daysleft` = '0'",$c);
$cityl=$db->query("SELECT * FROM `cities` WHERE `cityowneron` = '1'");
while(
$r=$db->fetch_row($cityl))
{
if(
$r['citytaxon'] == 1)
{
$db->query("UPDATE users SET money=money-$r[citytax] WHERE location=$r[cityid] AND money>$r[citytaxprice]");

$qq=$db->query("SELECT * FROM `users` WHERE `money` < $r[citytax] AND `location` = $r[cityid]");
while(
$rr=$db->fetch_row($qq))
{
event_add($r['cityowner'],"<a href='viewuser.php?u=$rr[userid]'>$rr
[username]</a> has insufficient cash to pay for the tax today.<br />
<a href='cityadmin.php?action=kick&ID=$rr[id]'>Kick them out here</a><br />"
,$c);
}
$db->query("SELECT * FROM `users` WHERE `location`='$r[cityid]'");
$pricepay=$db->num_rows($q)*$r['citytaxprice'];
$db->query("UPDATE users SET money=money+$pricepay WHERE userid=$r
[cityowner]"
);
}
$newcq=$db->query("SELECT * FROM`cities`");
while(
$newr=$db->fetch_row($newcq))
{
$db->query("SELECT * FROM `users` WHERE `location` = "$newr[cityid]");
if($db->num_rows($daf) > $newr['citymost'])
{
$rowstoupdate=$db->num_rows($daf);
$db->query("
UPDATE cities SET citymost=$rowstoupdate WHERE cityid=$r[cityid]");
}
}
$db->query("
UPDATE cities SET citydays=citydays+1");
}
?>

does anyone know what the problem is because otherwise they can't grow drugs. is there a way when u grow drugs that it tells you how much days are left e.t.c?
« Last Edit: December 13, 2009, 10:35:58 AM by Gori »
Logged

Danny696

  • Senior Member
  • ****
  • Reputation Power: 317
  • Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.
  • Offline Offline
  • Posts: 540
    • View Profile
    • WWW
Re: v2 Drug Farm
« Reply #1 on: December 13, 2009, 04:59:42 AM »
below every function, add this: global $db;
Logged
Project Choosen - 10%
Daniel - Hanson . Com

Gori

  • Basic Member
  • *
  • Reputation Power: 5
  • Gori has no influence.
  • Offline Offline
  • Posts: 10
    • View Profile
Re: v2 Drug Farm
« Reply #2 on: December 13, 2009, 06:23:09 AM »
how do i do it?

could u post the fixed code here?
Logged

Danny696

  • Senior Member
  • ****
  • Reputation Power: 317
  • Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.
  • Offline Offline
  • Posts: 540
    • View Profile
    • WWW
Re: v2 Drug Farm
« Reply #3 on: December 13, 2009, 07:36:18 AM »
how do i do it?

By using your keyboard/mouse
Logged
Project Choosen - 10%
Daniel - Hanson . Com

Gori

  • Basic Member
  • *
  • Reputation Power: 5
  • Gori has no influence.
  • Offline Offline
  • Posts: 10
    • View Profile
Re: v2 Drug Farm
« Reply #4 on: December 13, 2009, 07:52:07 AM »
how i use my keyboard and mouse?
Logged

dominion

  • Active Member
  • **
  • Reputation Power: 89
  • dominion barely matters.dominion barely matters.
  • Offline Offline
  • Posts: 129
    • View Profile
    • Email
Re: v2 Drug Farm
« Reply #5 on: December 13, 2009, 08:00:13 AM »
this should work fine

***note*** note secured in any way

Code: [Select]
<?php
/*-----------------------------------------------------
-- Advanced Drugs Mod v2
-- Coded by Oxidati0n
-- Copyright 2007 NickMedia
-- Nicholas - oxidati0n.info Productions
-----------------------------------------------------*/
include "globals.php";
function 
drug_dropdown($connection,$ddname="drug",$selected=-1)
{
$ret="<select name='$ddname' type='dropdown'>";
$q=mysql_query("SELECT * FROM drugs ORDER BY drug_name ");
if(
$selected == -1) { $first=0; } else { $first=1; }
while(
$r=mysql_fetch_array($q))
{
$ret.="\n<option value='{$r['drug_id']}'";
if (
$selected == $r['drug_id'] || $first == 0) { $ret.=

selected='selected'"
;$first=1; } 
$ret.=">{$r['drug_name']}</option>";
}
$ret.="\n</select>";
return 
$ret;
}
function 
drug2_dropdown($connection,$ddname="drug",$selected=-1)
{
$ret="<select name='$ddname' type='dropdown'>";
$q=mysql_query("SELECT FROM drugs WHERE drug_available=1 ORDER BY 

drug_name "
);
if(
$selected == -1) { $first=0; } else { $first=1
}
while(
$r=mysql_fetch_array($q))
{
$ret.="\n<option value='{$r['drug_id']}'";
if (
$selected == $r['drug_id'] || $first == 0) { $ret.=

selected='selected'"
;$first=1; } 
$ret.=">{$r['drug_name']}</option>";
}
$ret.="\n</select>";
return 
$ret;
}
print 
"<h3>Drug Farm</h3><br />";
if(!
$_GET['action'])
{
print 
"<br />
<b>Welcome to the Drug Farm</b><br />
What would you like to do today?<br />"
;
if(
$ir['own_farm'] == 0)
{
print 
"<a href='drugfarm.php?action=buy'>Buy a part of the 

farm</a><br /><br />"
;
}
print 
"<a href='drugfarm.php?action=grow'>Grow a drug</a> | <a 

href='drugfarm.php?action=premade'>Buy a Premade Drug</a><br />"
;
} elseif(
$_GET['action'] == "grow") {
$q=mysql_query("SELECT * FROM `drug_farm` WHERE `df_user` = 

'$userid'"
,$c);
if(
mysql_num_rows($q) > and $ir['own_farm'] == 1)
{
print 
"You already have 7 drugs on the farm, Thats the maximum you 

can grow on your own.<br />
<a href='drugfarm.php'>Back</a><br />"
;
} elseif(
mysql_num_rows($q) > and $ir['own_farm'] == 0)
{
print 
"You already have 2 drugs on the farm, Thats the maximum you 

can grow on your own.<br />
To grow 7 drugs you need to purchase a part of the farm, Click <a 

href='drugfarm.php?action=buy'>here</a> to purchase one<br />
<a href='drugfarm.php'>Back</a><br />"
;
} elseif(
$_POST['drug'])
{
if(
$ir['own_farm'] == and $ir['money'] < 500)
{
print 
"You do not have enough money to rent a part of the field for 

drugs<br />
You need <b>\$500</b> per drug<br />
Or you can buy a part of the farm permanently <a href='drugfarm.php?

action=buy'>here</a><br />
<a href='drugfarm.php'>Back</a><br />"
;
} else {
$q2=mysql_query("SELECT * FROM `drugs` WHERE `drug_id` = '$_POST

[drug]'"
,$c);
$r2=mysql_fetch_array($q2);
mysql_query("INSERT INTO `drug_farm` (`df_id`, `df_user`, `df_drug`, 

`df_dayleft`) VALUES ('NULL', '$userid', '$_POST[drug]', '$r

[drug_growdays]');"
,$c);
if(
$ir['own_farm'] == 0)
{
mysql_query("UPDATE `users` SET `money` = `money` - '500' WHERE 

`userid` = '$userid'"
,$c);
}
print 
"You have started to plant the <b>$r2[drug_name]</b> drug<br />
This drug will take <b>$r2[drug_growdays]</b> days to grow<br />
<a href='drugfarm.php'>Back</a><br />"
;
}
} else {
if(
$ir['own_farm'] == 1) { $s="do own part of the farm so you don't 

have to pay a fee."
; } else { $s="do <b>not</b> own a part of the 

farm so you will have to pay a \$500 fee"
; }
print 
"<b>Grow a drug</b><br />
You currently "
.$s."<br />
Do you want to grow a drug?<br />
<br />"
;
if(
$ir['level'] >= 3)
{
print 
"<form action='drugfarm.php?action=grow' method='post'>
Drug to Grow: "
.drug2_dropdown($c)."<br />
<input type='submit' value='Grow Drug'><br /></form>"
;
} else {
print 
"<b><i>You must be at least level three to grow a 

drug</i></b><br />"
;
}

}

} else if(
$_GET['action'] == "buy")
{
if(
$_GET['conf'] == "Y")
{
if(
$ir['money'] < 100000)
{
print 
"You don't have enough money to buy part of the land<br />
<a href='drugfarm.php'>Back</a><br />"
;
} else {
mysql_query("UPDATE `users` SET `money` = `money` - '100000', 

`own_farm` = '1' WHERE `userid` = '$userid'"
,$c);
print 
"You have successfully brought a part of the farm<br />
<a href='drugfarm.php'>Back</a><br />"
;
}
} else {
print 
"<b>Purchase Part of the farm</b><br />
Do you want part of the farm<br />
You are paying <b>\$100,000</b> and you can plant <b>7</b> drugs at 

once.<br />
<a href='drugfarm.php?action=buy&conf=Y'>Purchase Part of land!

</a><br />"
;
}
} elseif(
$_GET['action'] == "premade")
{
$q=mysql_query("SELECT * FROM `drugs` WHERE `drug_available` = 

'1'"
,$c);
print 
"<b>Purchase Pre-made products</b><br />
<br />
<table width=90% border=1><tr><th>Drug 

Name</th><th>Type</th><th>Price</th><th>Description</th><th>Buy</th><

/tr>"
;
if(
mysql_num_rows($q) == 0)
{
print 
"We have no drugs for sale at this time.<br/>";
}
while(
$r=mysql_fetch_array($q))
{
print 
"<tr><td>".$r['drug_name']."</td><td>".$r

['drug_type']."</td><td>\$".number_format($r

['drug_premadeprice'])."</td><td>".$r

['drug_description']."</td><td><a href='drugfarm.php?

action=buydrug&ID={$r['drug_id']}'>Purchase</a></td></tr>"
;
}
print 
"</table>";
} elseif(
$_GET['action'] == "buydrug" and $_GET['ID'])
{
$_GET['ID']=abs(strip_tags((int) $_GET['ID']));
$q=mysql_query("SELECT * FROM `drugs` WHERE `drug_id` = '$_GET[ID]' 

AND `drug_available` = '1'"
,$c);
if(
mysql_num_rows($q) == 0)
{
print 
"Theres no drug available with that ID!";
} else {
$r=mysql_fetch_array($q);
if(
$r['drug_premadeprice'] > $ir['money'])
{
print 
"You don't have enough money to purchase this drug<br />
<a href='drugfarm.php?action=premade'>Back</a><br />"
;
} else {
mysql_query("INSERT INTO `drug_collection` (`dc_id`, `dc_drug`, 

`dc_user`, `dc_holding`, `dc_age`) VALUES ('NULL', '$_GET[ID]', 

'$userid', '0', '0');"
,$c);
mysql_query("UPDATE `users` SET `money` = `money` - '$r

[drug_premadeprice]' WHERE `userid` = '$userid'"
,$c);
print 
"You have successfully brought the <b>$r[drug_name]</b> drug!

<br />
<a href='drugfarm.php?action=mydrugs'>Your Drugs</a><br />"
;
} } 
} elseif(
$_GET['action'] == "mydrugs")
{
$q=mysql_query("SELECT * FROM `drug_collection` WHERE `dc_user` = 

'$userid'"
,$c);
if(
mysql_num_rows($q) == 0)
{
print 
"<b>You have no drugs</b><br /><a href='index.php'>Back</a><br 

/>"
;
} else {
print 
"<font size=+1>My Drugs</font><br />
To use a drug, you must first hold it to use it.<br />"
;

$q2=mysql_query("SELECT dc.*,d.* FROM drug_collection dc LEFT JOIN 

drugs d ON dc.dc_drug=d.drug_id WHERE dc.dc_user='$userid' AND 

dc.dc_holding='1'"
,$c);
print 
"<table width=95% 

border=1><tr><th>Drug</th><th>Type</th><th>Drug 

Status</th><th>Holding</th><th>Links</th></tr>"
;
if(
mysql_num_rows($q2) == 0) { print "<tr><td colspan=5>You are not 

holding any drugs</td></tr>"
; }
while(
$r=mysql_fetch_array($q2))
{
if(
$r['dc_age'] > 15) { $status="<font 

color=darkred>Outdated</font>"
; } elseif($r['dc_age'] > 6) { 

$status="<font color=orange>Edible</font>"; } else { $status="<font 

color=darkred>Fresh</font>"
; }
if(
$r['dc_holding'] == 1) { $hold="<font color=darkgreen>Yes</font>"

} else { 
$hold="<font color=darkred>No</font>"; }
print 
"<tr><td>".$r['drug_name']."</td><td>".$r

['drug_type']."</td><td>$status</td><td>$hold</td><td><a 

href='drugfarm.php?action=throw&ID={$r['dc_id']}'>[Throw Away]</a> 
<a href='drugfarm.php?action=unhold&ID={$r['dc_id']}'>[Unhold]</a> <a 

href='drugfarm.php?action=marketadd&ID={$r['dc_id']}'>[Add to 

Market]</a> <a href='drugfarm.php?action=usedrug&ID={$r['dc_id']}'>

[Use]</a> </td></tr>"
;
}
print 
"<tr><td colspan=5><hr /></td></tr>";

$q3=mysql_query("SELECT dc.*,d.* FROM drug_collection dc LEFT JOIN 

drugs d ON dc.dc_drug=d.drug_id WHERE dc.dc_user='$userid' AND 

dc.dc_holding='0'"
,$c);
if(
mysql_num_rows($q3) == 0) { print "<tr><td colspan=5>You don't have 

any drugs stashed.</td></tr>"
; }
while(
$r=mysql_fetch_array($q3))
{
if(
$r['dc_age'] > 15) { $status="<font 

color=darkred>Outdated</font>"
; } elseif($r['dc_age'] > 6) { 

$status="<font color=orange>Edible</font>"; } else { $status="<font 

color=darkgreen>Fresh</font>"
; }
if(
$r['dc_holding'] == 1) { $hold="<font color=darkgreen>Yes</font>"

} else { 
$hold="<font color=darkred>No</font>"; }
print 
"<tr><td>".$r['drug_name']."</td><td>".$r

['drug_type']."</td><td>$status</td><td>$hold</td><td><a 

href='drugfarm.php?action=throw&ID={$r['dc_id']}'>[Throw Away]</a> 
<a href='drugfarm.php?action=hold&ID={$r['dc_id']}'>[Hold]</a> <a 

href='drugfarm.php?action=marketadd&ID={$r['dc_id']}'>[Add to 

Market]</a></td></tr>"
;
}

print 
"</table>";
}
} elseif(
$_GET['action'] == "unhold" and $_GET['ID'])
{
mysql_query("UPDATE `drug_collection` SET `dc_holding` = '0' WHERE 

`dc_user` = '$userid' AND `dc_id` = '$_GET[ID]'"
,$c);
print 
"You have unholded the drug!<br /><a 

href='javascript:history.back();'>Back</a><br />"
;
} elseif(
$_GET['action'] == "hold" and $_GET['ID'])
{
mysql_query("UPDATE `drug_collection` SET `dc_holding` = '1' WHERE 

`dc_user` = '$userid' AND `dc_id` = '$_GET[ID]'"
,$c);
print 
"You have holded the drug!<br /><a 

href='javascript:history.back();'>Back</a><br />"
;
} elseif(
$_GET['action'] == "throw" and $_GET['ID'])
{
mysql_query("DELETE FROM `drug_collection` WHERE `dc_user` = '$userid' 

AND `dc_id` = '$_GET[ID]'"
,$c);
print 
"You have thrown away the drug!<br /><a 

href='javascript:history.back();'>Back</a><br />"
;
} elseif(
$_GET['action'] == "usedrug" and $_GET['ID'])
{
$q=mysql_query("SELECT dc.*,d.*,u.* FROM drug_collection dc LEFT JOIN 

drugs d ON dc.dc_drug=d.drug_id LEFT JOIN users u ON 

dc.dc_user=u.userid WHERE u.userid='{$userid}' AND dc.dc_holding='1' 

AND dc.dc_id='$_GET[ID]'"
,$c);
if(
mysql_num_rows($q) == 0)
{
print 
"Invalid Drug";
} else {
$r=mysql_fetch_array($q);
$time=rand(1,$r['drug_rand']);
$hosptime=$r['drug_hospital']+$time/2;
if(
eregi('A'$r['drug_type']))
{
$randa[4]=rand(3,30);
if(
$randa[4] > 25)
{
$hospital=+300;
}
} elseif(
eregi('B'$r['drug_type']))
{
$randa[5]=rand(3,30);
if(
$randa[5] > 25)
{
$hospital=+150;
}
} else {
$randa[6]=rand(3,30);
if(
$randa[6] > 25)
{
$hospital=+70;
}
}
if(
$r['dc_age'] > 30)
{
$hosptime=+rand(40,80);
$sx="Poisoned";
}
if(
$time $r['drug_rand']/2)
{
$sx="overdosed";
$hosptime=0;
}
$hosptime=str_replace("-"""$hosptime);
$row=$r['drug_affect'];
$do=$r['drug_act'];
$result=$r['drug_amount'];
if(
$hosptime 0)
{
event_add($ir['userid'],"Your drug $sx you so you are in hospital for 

$hosptime minutes."
,$c);
mysql_query("UPDATE `users` SET `hospital` = `hospital` + '$hosptime', 

`hospreason` = '$sx by the $r[drug_name] drug' WHERE `userid` = 

'$userid'"
,$c);
}
mysql_query("UPDATE `users` SET `$row` = `$row` $do '$result' WHERE 

`userid` = '$userid'"
,$c);
print 
"You have taken the <b>$r[drug_name]</b> drug, You don't know 

what happens now.<br />
<a href='index.php'>Back</a><br />"
;
}
} elseif(
$_GET['action'] == "marketadd" and $_GET['ID'])
{
$q=mysql_query("SELECT dc.*,d.*,u.* FROM drug_collection dc LEFT JOIN 

drugs d ON dc.dc_drug=d.drug_id LEFT JOIN users u ON 

dc.dc_user=u.userid WHERE u.userid='{$userid}' AND dc.dc_id='$_GET

[ID]'"
,$c);
if(
mysql_num_rows($q) == 0)
{
print 
"Invalid Drug";
} else {
$r=mysql_fetch_array($q);
if((int) 
$_POST['price'] > 0)
{
if(
$_POST['price'] > 50000000)
{
print 
"The maximum you can post it as is \$50,000,000<br /><a 

href='javascript:history.back();'>Back</a><br />"
;
} else {
$time=time();
$drug=$r['drug_id'];
$price=$_POST['price'];
if(
$r['dc_age'] > 15) { $status="<font 

color=darkred>Outdated</font>"
; } elseif($r['dc_age'] > 6) { 

$status="<font color=orange>Edible</font>"; } else { $status="<font 

color=green>Fresh</font>"
; }
mysql_query("INSERT INTO `drugsmarket` (`dm_id`, `dm_from`, `dm_time`, 

`dm_drug`, `dm_price`,`dm_type`, `dm_daysleft`) VALUES ('NULL', 

'$userid', '$time', '$drug', '$price', '$status', '5');"
,$c);
mysql_query("DELETE FROM `drug_collection` WHERE `dc_id` = '$_GET

[ID]'"
,$c);
print 
"Your drug has been added!<br />
<a href='drugmarket.php'>Back</a><br />
"
;
}
} else {
print 
"<b>Add your drug to the market</b><br />
<font color=maroon>WARNING: Once you stick your item onto the market, 

You can<b>not</b> remove it, After 5 days it will be 

deleted</font><br />
<form action='drugfarm.php?action=marketadd&ID={$_GET['ID']}' 

method='post'>
Price: \$<input type='text' name='price' value=''><br />
<input type='submit' value='Add to Market'>
</form>"
;
}
}
}
$h->endpage();
?>
Logged

Danny696

  • Senior Member
  • ****
  • Reputation Power: 317
  • Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.
  • Offline Offline
  • Posts: 540
    • View Profile
    • WWW
Re: v2 Drug Farm
« Reply #6 on: December 13, 2009, 08:37:25 AM »
Why not use db. its a very simple fix.
Logged
Project Choosen - 10%
Daniel - Hanson . Com

dominion

  • Active Member
  • **
  • Reputation Power: 89
  • dominion barely matters.dominion barely matters.
  • Offline Offline
  • Posts: 129
    • View Profile
    • Email
Re: v2 Drug Farm
« Reply #7 on: December 13, 2009, 08:44:15 AM »
Why not use db. its a very simple fix.

i know but if he dont want to take the time to do i am taking the quicker way out for him
Logged

Danny696

  • Senior Member
  • ****
  • Reputation Power: 317
  • Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.
  • Offline Offline
  • Posts: 540
    • View Profile
    • WWW
Re: v2 Drug Farm
« Reply #8 on: December 13, 2009, 10:02:22 AM »
well it would have been quicker to do global $db; right ;)
Logged
Project Choosen - 10%
Daniel - Hanson . Com

Gori

  • Basic Member
  • *
  • Reputation Power: 5
  • Gori has no influence.
  • Offline Offline
  • Posts: 10
    • View Profile
Re: v2 Drug Farm
« Reply #9 on: December 13, 2009, 10:11:44 AM »
it don't work i found the right way it's

Code: [Select]
<?php
/*-----------------------------------------------------
-- Advanced Drugs Mod v2
-- Coded by Oxidati0n
-- Copyright 2007 NickMedia
-- Nicholas - oxidati0n.info Productions
-----------------------------------------------------*/
include "globals.php";
function 
drug_dropdown($connection,$ddname="drug",$selected=-1)
{
$ret="<select name='$ddname' type='dropdown'>";
$q=mysql_query("SELECT * FROM drugs ORDER BY drug_name 

ASC"
,$connection);
if(
$selected == -1) { $first=0; } else { $first=1; }
while(
$r=mysql_fetch_array($q))
{
$ret.="\n<option value='{$r['drug_id']}'";
if (
$selected == $r['drug_id'] || $first == 0) { $ret.=

selected='selected'"
;$first=1; } 
$ret.=">{$r['drug_name']}</option>";
}
$ret.="\n</select>";
return 
$ret;
}
function 
drugt_dropdown($connection,$ddname="drug",$selected=-1)
{
$ret="<select name='$ddname' type='dropdown'>";
$q=mysql_query("SELECT * FROM drugs WHERE drug_available=1 ORDER BY 

drug_name ASC"
,$connection);
if(
$selected == -1) { $first=0; } else { $first=1; }
while(
$r=mysql_fetch_array($q))
{
$ret.="\n<option value='{$r['drug_id']}'";
if (
$selected == $r['drug_id'] || $first == 0) { $ret.=

selected='selected'"
;$first=1; } 
$ret.=">{$r['drug_name']}</option>";
}
$ret.="\n</select>";
return 
$ret;
}
print 
"<h3>Drug Farm</h3><br />";
if(!
$_GET['action'])
{
print 
"<br />
<b>Welcome to the Drug Farm</b><br />
What would you like to do today?<br />"
;
if(
$ir['own_farm'] == 0)
{
print 
"<a href='drugfarm.php?action=buy'>Buy a part of the 

farm</a><br /><br />"
;
}
print 
"<a href='drugfarm.php?action=grow'>Grow a drug</a> | <a 

href='drugfarm.php?action=premade'>Buy a Premade Drug</a><br />"
;
} elseif(
$_GET['action'] == "grow") {
$q=mysql_query("SELECT * FROM `drug_farm` WHERE `df_user` = 

'$userid'"
,$c);
if(
mysql_num_rows($q) > and $ir['own_farm'] == 1)
{
print 
"You already have 7 drugs on the farm, Thats the maximum you 

can grow on your own.<br />
<a href='drugfarm.php'>Back</a><br />"
;
} elseif(
mysql_num_rows($q) > and $ir['own_farm'] == 0)
{
print 
"You already have 2 drugs on the farm, Thats the maximum you 

can grow on your own.<br />
To grow 7 drugs you need to purchase a part of the farm, Click <a 

href='drugfarm.php?action=buy'>here</a> to purchase one<br />
<a href='drugfarm.php'>Back</a><br />"
;
} elseif(
$_POST['drug'])
{
if(
$ir['own_farm'] == and $ir['money'] < 500)
{
print 
"You do not have enough money to rent a part of the field for 

drugs<br />
You need <b>\$500</b> per drug<br />
Or you can buy a part of the farm permanently <a href='drugfarm.php?

action=buy'>here</a><br />
<a href='drugfarm.php'>Back</a><br />"
;
} else {
$q2=mysql_query("SELECT * FROM `drugs` WHERE `drug_id` = '$_POST

[drug]'"
,$c);
$r2=mysql_fetch_array($q2);
mysql_query("INSERT INTO `drug_farm` (`df_id`, `df_user`, `df_drug`, 

`df_dayleft`) VALUES ('NULL', '$userid', '$_POST[drug]', '$r

[drug_growdays]');"
,$c);
if(
$ir['own_farm'] == 0)
{
mysql_query("UPDATE `users` SET `money` = `money` - '500' WHERE 

`userid` = '$userid'"
,$c);
}
print 
"You have started to plant the <b>$r2[drug_name]</b> drug<br />
This drug will take <b>$r2[drug_growdays]</b> days to grow<br />
<a href='drugfarm.php'>Back</a><br />"
;
}
} else {
if(
$ir['own_farm'] == 1) { $s="do own part of the farm so you don't 

have to pay a fee."
; } else { $s="do <b>not</b> own a part of the 

farm so you will have to pay a \$500 fee"
; }
print 
"<b>Grow a drug</b><br />
You currently "
.$s."<br />
Do you want to grow a drug?<br />
<br />"
;
if(
$ir['level'] >= 3)
{
print 
"<form action='drugfarm.php?action=grow' method='post'>
Drug to Grow: "
.drugt_dropdown($c)."<br />
<input type='submit' value='Grow Drug'><br /></form>"
;
} else {
print 
"<b><i>You must be at least level three to grow a 

drug</i></b><br />"
;
}

}

} else if(
$_GET['action'] == "buy")
{
if(
$_GET['conf'] == "Y")
{
if(
$ir['money'] < 100000)
{
print 
"You don't have enough money to buy part of the land<br />
<a href='drugfarm.php'>Back</a><br />"
;
} else {
mysql_query("UPDATE `users` SET `money` = `money` - '100000', 

`own_farm` = '1' WHERE `userid` = '$userid'"
,$c);
print 
"You have successfully brought a part of the farm<br />
<a href='drugfarm.php'>Back</a><br />"
;
}
} else {
print 
"<b>Purchase Part of the farm</b><br />
Do you want part of the farm<br />
You are paying <b>\$100,000</b> and you can plant <b>7</b> drugs at 

once.<br />
<a href='drugfarm.php?action=buy&conf=Y'>Purchase Part of land!

</a><br />"
;
}
} elseif(
$_GET['action'] == "premade")
{
$q=mysql_query("SELECT * FROM `drugs` WHERE `drug_available` = 

'1'"
,$c);
print 
"<b>Purchase Pre-made products</b><br />
<br />
<table width=90% border=1><tr><th>Drug 

Name</th><th>Type</th><th>Price</th><th>Description</th><th>Buy</th><

/tr>"
;
if(
mysql_num_rows($q) == 0)
{
print 
"We have no drugs for sale at this time.<br/>";
}
while(
$r=mysql_fetch_array($q))
{
print 
"<tr><td>".$r['drug_name']."</td><td>".$r

['drug_type']."</td><td>\$".number_format($r

['drug_premadeprice'])."</td><td>".$r

['drug_description']."</td><td><a href='drugfarm.php?

action=buydrug&ID={$r['drug_id']}'>Purchase</a></td></tr>"
;
}
print 
"</table>";
} elseif(
$_GET['action'] == "buydrug" and $_GET['ID'])
{
$_GET['ID']=abs(strip_tags((int) $_GET['ID']));
$q=mysql_query("SELECT * FROM `drugs` WHERE `drug_id` = '$_GET[ID]' 

AND `drug_available` = '1'"
,$c);
if(
mysql_num_rows($q) == 0)
{
print 
"Theres no drug available with that ID!";
} else {
$r=mysql_fetch_array($q);
if(
$r['drug_premadeprice'] > $ir['money'])
{
print 
"You don't have enough money to purchase this drug<br />
<a href='drugfarm.php?action=premade'>Back</a><br />"
;
} else {
mysql_query("INSERT INTO `drug_collection` (`dc_id`, `dc_drug`, 

`dc_user`, `dc_holding`, `dc_age`) VALUES ('NULL', '$_GET[ID]', 

'$userid', '0', '0');"
,$c);
mysql_query("UPDATE `users` SET `money` = `money` - '$r

[drug_premadeprice]' WHERE `userid` = '$userid'"
,$c);
print 
"You have successfully brought the <b>$r[drug_name]</b> drug!

<br />
<a href='drugfarm.php?action=mydrugs'>Your Drugs</a><br />"
;
} } 
} elseif(
$_GET['action'] == "mydrugs")
{
$q=mysql_query("SELECT * FROM `drug_collection` WHERE `dc_user` = 

'$userid'"
,$c);
if(
mysql_num_rows($q) == 0)
{
print 
"<b>You have no drugs</b><br /><a href='index.php'>Back</a><br 

/>"
;
} else {
print 
"<font size=+1>My Drugs</font><br />
To use a drug, you must first hold it to use it.<br />"
;

$q2=mysql_query("SELECT dc.*,d.* FROM drug_collection dc LEFT JOIN 

drugs d ON dc.dc_drug=d.drug_id WHERE dc.dc_user='$userid' AND 

dc.dc_holding='1'"
,$c);
print 
"<table width=95% 

border=1><tr><th>Drug</th><th>Type</th><th>Drug 

Status</th><th>Holding</th><th>Links</th></tr>"
;
if(
mysql_num_rows($q2) == 0) { print "<tr><td colspan=5>You are not 

holding any drugs</td></tr>"
; }
while(
$r=mysql_fetch_array($q2))
{
if(
$r['dc_age'] > 15) { $status="<font 

color=darkred>Outdated</font>"
; } elseif($r['dc_age'] > 6) { 

$status="<font color=orange>Edible</font>"; } else { $status="<font 

color=darkred>Fresh</font>"
; }
if(
$r['dc_holding'] == 1) { $hold="<font color=darkgreen>Yes</font>"

} else { 
$hold="<font color=darkred>No</font>"; }
print 
"<tr><td>".$r['drug_name']."</td><td>".$r

['drug_type']."</td><td>$status</td><td>$hold</td><td><a 

href='drugfarm.php?action=throw&ID={$r['dc_id']}'>[Throw Away]</a> 
<a href='drugfarm.php?action=unhold&ID={$r['dc_id']}'>[Unhold]</a> <a 

href='drugfarm.php?action=marketadd&ID={$r['dc_id']}'>[Add to 

Market]</a> <a href='drugfarm.php?action=usedrug&ID={$r['dc_id']}'>

[Use]</a> </td></tr>"
;
}
print 
"<tr><td colspan=5><hr /></td></tr>";

$q3=mysql_query("SELECT dc.*,d.* FROM drug_collection dc LEFT JOIN 

drugs d ON dc.dc_drug=d.drug_id WHERE dc.dc_user='$userid' AND 

dc.dc_holding='0'"
,$c);
if(
mysql_num_rows($q3) == 0) { print "<tr><td colspan=5>You don't 

have any drugs stashed.</td></tr>"
; }
while(
$r=mysql_fetch_array($q3))
{
if(
$r['dc_age'] > 15) { $status="<font 

color=darkred>Outdated</font>"
; } elseif($r['dc_age'] > 6) { 

$status="<font color=orange>Edible</font>"; } else { $status="<font 

color=darkgreen>Fresh</font>"
; }
if(
$r['dc_holding'] == 1) { $hold="<font color=darkgreen>Yes</font>"

} else { 
$hold="<font color=darkred>No</font>"; }
print 
"<tr><td>".$r['drug_name']."</td><td>".$r

['drug_type']."</td><td>$status</td><td>$hold</td><td><a 

href='drugfarm.php?action=throw&ID={$r['dc_id']}'>[Throw Away]</a> 
<a href='drugfarm.php?action=hold&ID={$r['dc_id']}'>[Hold]</a> <a 

href='drugfarm.php?action=marketadd&ID={$r['dc_id']}'>[Add to 

Market]</a></td></tr>"
;
}

print 
"</table>";
}
} elseif(
$_GET['action'] == "unhold" and $_GET['ID'])
{
mysql_query("UPDATE `drug_collection` SET `dc_holding` = '0' WHERE 

`dc_user` = '$userid' AND `dc_id` = '$_GET[ID]'"
,$c);
print 
"You have unholded the drug!<br /><a 

href='javascript:history.back();'>Back</a><br />"
;
} elseif(
$_GET['action'] == "hold" and $_GET['ID'])
{
mysql_query("UPDATE `drug_collection` SET `dc_holding` = '1' WHERE 

`dc_user` = '$userid' AND `dc_id` = '$_GET[ID]'"
,$c);
print 
"You have holded the drug!<br /><a 

href='javascript:history.back();'>Back</a><br />"
;
} elseif(
$_GET['action'] == "throw" and $_GET['ID'])
{
mysql_query("DELETE FROM `drug_collection` WHERE `dc_user` = 

'$userid' AND `dc_id` = '$_GET[ID]'"
,$c);
print 
"You have thrown away the drug!<br /><a 

href='javascript:history.back();'>Back</a><br />"
;
} elseif(
$_GET['action'] == "usedrug" and $_GET['ID'])
{
$q=mysql_query("SELECT dc.*,d.*,u.* FROM drug_collection dc LEFT JOIN 

drugs d ON dc.dc_drug=d.drug_id LEFT JOIN users u ON 

dc.dc_user=u.userid WHERE u.userid='{$userid}' AND dc.dc_holding='1' 

AND dc.dc_id='$_GET[ID]'"
,$c);
if(
mysql_num_rows($q) == 0)
{
print 
"Invalid Drug";
} else {
$r=mysql_fetch_array($q);
$time=rand(1,$r['drug_rand']);
$hosptime=$r['drug_hospital']+$time/2;
if(
eregi('A'$r['drug_type']))
{
$randa[4]=rand(3,30);
if(
$randa[4] > 25)
{
$hospital=+300;
}
} elseif(
eregi('B'$r['drug_type']))
{
$randa[5]=rand(3,30);
if(
$randa[5] > 25)
{
$hospital=+150;
}
} else {
$randa[6]=rand(3,30);
if(
$randa[6] > 25)
{
$hospital=+70;
}
}
if(
$r['dc_age'] > 30)
{
$hosptime=+rand(40,80);
$sx="Poisoned";
}
if(
$time $r['drug_rand']/2)
{
$sx="overdosed";
$hosptime=0;
}
$hosptime=str_replace("-"""$hosptime);
$row=$r['drug_affect'];
$do=$r['drug_act'];
$result=$r['drug_amount'];
if(
$hosptime 0)
{
event_add($ir['userid'],"Your drug $sx you so you are in hospital for 

$hosptime minutes."
,$c);
mysql_query("UPDATE `users` SET `hospital` = `hospital` + 

'$hosptime', `hospreason` = '$sx by the $r[drug_name] drug' WHERE 

`userid` = '$userid'"
,$c);
}
mysql_query("UPDATE `users` SET `$row` = `$row` $do '$result' WHERE 

`userid` = '$userid'"
,$c);
print 
"You have taken the <b>$r[drug_name]</b> drug, You don't know 

what happens now.<br />
<a href='index.php'>Back</a><br />"
;
}
} elseif(
$_GET['action'] == "marketadd" and $_GET['ID'])
{
$q=mysql_query("SELECT dc.*,d.*,u.* FROM drug_collection dc LEFT JOIN 

drugs d ON dc.dc_drug=d.drug_id LEFT JOIN users u ON 

dc.dc_user=u.userid WHERE u.userid='{$userid}' AND dc.dc_id='$_GET

[ID]'"
,$c);
if(
mysql_num_rows($q) == 0)
{
print 
"Invalid Drug";
} else {
$r=mysql_fetch_array($q);
if((int) 
$_POST['price'] > 0)
{
if(
$_POST['price'] > 50000000)
{
print 
"The maximum you can post it as is \$50,000,000<br /><a 

href='javascript:history.back();'>Back</a><br />"
;
} else {
$time=time();
$drug=$r['drug_id'];
$price=$_POST['price'];
if(
$r['dc_age'] > 15) { $status="<font 

color=darkred>Outdated</font>"
; } elseif($r['dc_age'] > 6) { 

$status="<font color=orange>Edible</font>"; } else { $status="<font 

color=green>Fresh</font>"
; }
mysql_query("INSERT INTO `drugsmarket` (`dm_id`, `dm_from`, 

`dm_time`, `dm_drug`, `dm_price`,`dm_type`, `dm_daysleft`) VALUES 

('NULL', '$userid', '$time', '$drug', '$price', '$status', 

'5');"
,$c);
mysql_query("DELETE FROM `drug_collection` WHERE `dc_id` = '$_GET

[ID]'"
,$c);
print 
"Your drug has been added!<br />
<a href='drugmarket.php'>Back</a><br />
"
;
}
} else {
print 
"<b>Add your drug to the market</b><br />
<font color=maroon>WARNING: Once you stick your item onto the market, 

You can<b>not</b> remove it, After 5 days it will be 

deleted</font><br />
<form action='drugfarm.php?action=marketadd&ID={$_GET['ID']}' 

method='post'>
Price: \$<input type='text' name='price' value=''><br />
<input type='submit' value='Add to Market'>
</form>"
;
}
}
}
$h->endpage();
?>

how can i secure it?
Logged

dominion

  • Active Member
  • **
  • Reputation Power: 89
  • dominion barely matters.dominion barely matters.
  • Offline Offline
  • Posts: 129
    • View Profile
    • Email
Re: v2 Drug Farm
« Reply #10 on: December 13, 2009, 10:18:59 AM »
no danny i just click replace all much quicker on my end  ;)
and is that file not what i just posted
Logged

Gori

  • Basic Member
  • *
  • Reputation Power: 5
  • Gori has no influence.
  • Offline Offline
  • Posts: 10
    • View Profile
Re: v2 Drug Farm
« Reply #11 on: December 13, 2009, 10:34:03 AM »
no ur one didn't work

also does anyone know what's wrong with my crons??

Code: [Select]
<?php
include "config.php";
global 
$_CONFIG;
if(
$_GET['code'] != $_CONFIG['code']) { die(""); }
define("MONO_ON"1);
require 
"class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
 
$_CONFIG['username'],
 
$_CONFIG['password'],
 
$_CONFIG['database'],
 
$_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
$db->query("UPDATE fedjail set fed_days=fed_days-1");
$q=$db->query("SELECT * FROM fedjail WHERE fed_days=0");
$ids=array();
while(
$r=$db->fetch_row($q))
{
$ids[]=$r['fed_userid'];
}
if(
count($ids) > 0)
{
$db->query("UPDATE users SET fedjail=0 WHERE userid IN(".implode(","

$ids).")");
}
$db->query("DELETE FROM fedjail WHERE fed_days=0");
$db->query("UPDATE users SET daysingang=daysingang+1 WHERE gang > 

0"
);
$db->query("UPDATE users SET daysold=daysold+1, boxes_opened=0");
$db->query("UPDATE users SET mailban=mailban-1 WHERE mailban > 0");
$db->query("UPDATE users SET donatordays=donatordays-1 WHERE 

donatordays > 0"
);
$db->query("UPDATE users SET cdays=cdays-1 WHERE course > 0");
$db->query("UPDATE users SET bankmoney=bankmoney+(bankmoney/50) where 

bankmoney>0"
);
$db->query("UPDATE users SET cybermoney=cybermoney+(cybermoney/100*7) 

where cybermoney>0"
);
$q=$db->query("SELECT * FROM users WHERE cdays=0 AND course > 0");
while(
$r=$db->fetch_row($q))
{
$cd=$db->query("SELECT * FROM courses WHERE crID={$r['course']}");
$coud=$db->fetch_row($cd);
$userid=$r['userid'];
$db->query("INSERT INTO coursesdone VALUES({$r['userid']},{$r

['course']})"
);
$upd="";
$ev="";
if(
$coud['crSTR'] > 0)
{
$upd.=",us.strength=us.strength+{$coud['crSTR']}";
$ev.=", {$coud['crSTR']} strength";
}
if(
$coud['crGUARD'] > 0)
{
$upd.=",us.guard=us.guard+{$coud['crGUARD']}";
$ev.=", {$coud['crGUARD']} guard";
}
if(
$coud['crLABOUR'] > 0)
{
$upd.=",us.labour=us.labour+{$coud['crLABOUR']}";
$ev.=", {$coud['crLABOUR']} labour";
}
if(
$coud['crAGIL'] > 0)
{
$upd.=",us.agility=us.agility+{$coud['crAGIL']}";
$ev.=", {$coud['crAGIL']} agility";
}
if(
$coud['crIQ'] > 0)
{
$upd.=",us.IQ=us.IQ+{$coud['crIQ']}";
$ev.=", {$coud['crIQ']} IQ";
}
$ev=substr($ev,1);
if (
$upd) {
$db->query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid SET us.userid=us.userid $upd WHERE u.userid=$userid");
}
$db->query("INSERT INTO events VALUES('',$userid,unix_timestamp
(),0,'Congratulations, you completed the {$coud['crNAME']} and gained 
$ev!')"
);
}
$db->query("UPDATE users SET course=0 WHERE cdays=0");
$db->query("TRUNCATE TABLE votes;");
$stocks mysql_query("SELECT stockID FROM `stock_stocks`");
while(
$soc mysql_fetch_assoc($stocks))    {
    
$rand mt_rand(1,2);
    if(
$rand == 2)    {
        
$mr mt_rand(10,250);
        
mysql_query("UPDATE `stock_stocks` SET `stockUD` = 2, 
`stockCHANGE` = "
.$mr.", `stockNPRICE` = (`stockNPRICE` - ".$mr.") WHERE `stockID` = ".$soc['stockID']);
    }
    else    {
        
$mr mt_rand(10,250);
        
mysql_query("UPDATE `stock_stocks` SET `stockUD` = 1, 
`stockCHANGE` = "
.$mr.", `stockNPRICE` = (`stockNPRICE` + ".$mr.") WHERE `stockID` = ".$soc['stockID']);
    }
}
include_once(
'global_func.php');
$sel mysql_query("SELECT stockID,stockNAME FROM `stock_stocks` WHERE `stockNPRICE` < 0");
while(
$soc mysql_fetch_assoc($sel))    {
    if(
mysql_num_rows(mysql_query("SELECT holdingID FROM `stock_holdings` WHERE `holdingSTOCK` = ".$soc['stockID'])))    {
        
$user mysql_query("SELECT holdingUSER FROM `stock_holdings` WHERE `holdingSTOCK` = ".$soc['stockID']);
        
$user mysql_fetch_assoc($user);
        
event_add($user['holdingUSER'], 'Stock '.$soc['stockNAME'].' crashed, you lost all your shares.');
    }
    
mysql_query("DELETE FROM `stock_holdings` WHERE `holdingSTOCK` = ".$soc['stockID']);
    
mysql_query("UPDATE `stock_stocks` SET `stockUD` = 1,`stockCHANGE` = 0,`stockNPRICE` = `stockOPRICE` WHERE `stockID` = ".$soc['stockID']);
}
//DRUGS MARKET
mysql_query("UPDATE `drugsmarket` SET `dm_daysleft` = `dm_daysleft` - '1'",$c);
mysql_query("DELETE FROM `drugsmarket` WHERE `dm_daysleft` = '0'",$c);
//Drug Farm itself
mysql_query("UPDATE `drug_collection` SET `dc_age` = `dc_age` + '1'",$c);
mysql_query("UPDATE `drug_farm` SET `df_daysleft` = `df_daysleft` - '1'",$c);
$f=mysql_query("SELECT * FROM `drug_farm` WHERE `df_daysleft` = '0'",$c);
while(
$r=mysql_fetch_array($f))
{
mysql_query("INSERT INTO `drug_collection` (`dc_id`, `dc_drug`,`dc_user`, `dc_holding`, `dc_age`) VALUES ('NULL', '$r[df_drug]', '$r[df_user]', '0', '0');",$c);
}
mysql_query("DELETE * FROM `drug_farm` WHERE `df_daysleft` = '0'",$c);
$cityl=$db->query("SELECT * FROM `cities` WHERE `cityowneron` = '1'");
while(
$r=$db->fetch_row($cityl))
{
if(
$r['citytaxon'] == 1)
{
$db->query("UPDATE users SET money=money-$r[citytax] WHERE location=$r[cityid] AND money>$r[citytaxprice]");

$qq=$db->query("SELECT * FROM `users` WHERE `money` < $r[citytax] AND `location` = $r[cityid]");
while(
$rr=$db->fetch_row($qq))
{
event_add($r['cityowner'],"<a href='viewuser.php?u=$rr[userid]'>$rr
[username]</a> has insufficient cash to pay for the tax today.<br />
<a href='cityadmin.php?action=kick&ID=$rr[id]'>Kick them out here</a><br />"
,$c);
}
$db->query("SELECT * FROM `users` WHERE `location`='$r[cityid]'");
$pricepay=$db->num_rows($q)*$r['citytaxprice'];
$db->query("UPDATE users SET money=money+$pricepay WHERE userid=$r
[cityowner]"
);
}
$newcq=$db->query("SELECT * FROM`cities`");
while(
$newr=$db->fetch_row($newcq))
{
$daf=$db->query("SELECT * FROM `users` WHERE `location` = "$newr[cityid]");
if($db->num_rows($daf) > $newr['citymost'])
{
$rowstoupdate=$db->num_rows($daf);
$db->query("
UPDATE cities SET citymost=$rowstoupdate WHERE cityid=$r[cityid]");
}
}
$db->query("
UPDATE cities SET citydays=citydays+1");
}
?>

i keep getting:


Parse error: syntax error, unexpected T_VARIABLE in /home/mafia/public_html/cron_day.php on line 149
Logged

Danny696

  • Senior Member
  • ****
  • Reputation Power: 317
  • Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.
  • Offline Offline
  • Posts: 540
    • View Profile
    • WWW
Re: [V2 DRUGS FARM] and crons_day
« Reply #12 on: December 13, 2009, 12:42:52 PM »
LOL, thats quite a bad query. this is what it should be: $daf=$db->query("SELECT * FROM `users` WHERE `location` = ".$newr['cityid']);
Logged
Project Choosen - 10%
Daniel - Hanson . Com

JoshuaDams

  • Active Member
  • **
  • Reputation Power: 129
  • JoshuaDams is working their way up.JoshuaDams is working their way up.JoshuaDams is working their way up.
  • Offline Offline
  • Posts: 240
    • MSN Messenger - immortalthug4ever@hotmail.com
    • View Profile
    • WWW
Re: [V2 DRUGS FARM] and crons_day
« Reply #13 on: December 13, 2009, 01:01:15 PM »
--How do I secure it--

By reading a PHP manual ;)
 


This forum is now closed and has moved to a new location! Click here to find out why.