moynul Posted July 25, 2013 Share Posted July 25, 2013 (edited) The error I'm getting: Fatal error: Call to undefined function get_mine() in /home/lostcit2/public_html/mine.php on line 6 mine.php <?php require "globals.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); get_mine(); switch($_GET['action']) { case 'mine': mine_1(); break; case 'minesub': mine_1_sub(); break; case 'mine2': mine_2(); break; case 'mine2sub': mine_2_sub(); break; case 'mine3': mine_3(); break; case 'mine3sub': mine_3_sub(); break; case 'mine4': mine_4(); break; case 'mine4sub': mine_4_sub(); break; case 'mine5': mine_5(); break; case 'mine5sub': mine_6_sub(); break; case 'mine6': mine_6(); break; case 'mine6sub': mine_6_sub(); break; default: mine_index(); break; } /** ** Calls the cases so mine.php?mine **/ function mine_index() { global $ir,$c,$userid; print "<center>Welcome to the mine shaft. There are 3 spots to go mining but thay are restricted depending on your mine level. Your mining level is {$ir['mine_level']} and you have {$ir['mine_exp']}/{$ir['mine_needed']} mining experience </center>"; print "<center> <u>Crystal Mines</u> [<a href='mine.php?action=mine'>Level 1 mine</a>] [<a href='mine.php?action=mine2'>Level 20 mine</a>] [<a href='mine.php?action=mine3'>Level 40 mine</a>] <u>Money Mines</u> [<a href='mine.php?action=mine4'>Level 10 mine</a>] [<a href='mine.php?action=mine5'>Level 30 mine</a>] [<a href='mine.php?action=mine6'>Level 40 mine</a>] </center>"; } /** ** This is the main part you see when you come into the php page **/ if ($ir['jailtime'] > 0){ print "<center>The mine is closed to jail birds come back when thay release you</center>"; exit; } if ($ir['hospital'] > 0){ print "<center>You cant go mining while in hospital</center>"; exit; } /** ** That makes sure you are not in jail or hospital ** Shouldnt need to change that enless you making it a jail mine **/ function mine_1() { global $ir,$c,$userid; if($ir['energy'] < 10){ print "You need 10 power to mine here your have {$ir['energy']}"; exit; } mysql_query("UPDATE users SET energy=energy-10 WHERE userid=$userid",$c); $rand_gems = rand(1,5); $rand_exp = rand(1,100); echo "<center>You begin mining in the level 1 mine and found $rand_gems crystal(s).</center> "; mysql_query("UPDATE users SET crystals=crystals+'$rand_gems',mine_exp=mine_exp+' $rand_exp' WHERE userid=$userid",$c); print "<center>[<a href='mine.php?action=mine'>Mine again</a>]</center> "; print "<center>[<a href='mine.php'>Back</a>]</center> "; } function mine_2() { global $ir,$c,$userid; if($ir['energy'] < 15){ print "<center>You need 15 power to mine here your have {$ir['energy']}</center>"; exit; } if($ir['mine_level'] < 20){ print "<center>You need to be mining level 20 to mine here you are mining level {$ir['mine_level']}</center>"; exit; } mysql_query("UPDATE users SET energy=energy-15 WHERE userid=$userid",$c); $rand_gems = rand(1,20); $rand_exp = rand(1,300); echo "<center>You begin mining in the level 20 mine and found $rand_gems crystal(s).</center> "; mysql_query("UPDATE users SET crystals=crystals+'$rand_gems',mine_exp+'$rand_exp ' WHERE userid=$userid",$c); print "<center>[<a href='mine.php?action=mine2'>Mine again</a>]</center> "; print "<center>[<a href='mine.php'>Back</a>]</center> "; } function mine_3() { global $ir,$c,$userid; if($ir['energy'] < 25){ print "<center>You need 25 power to mine here your have {$ir['energy']}</center>"; exit; } if($ir['mine_level'] < 40){ print "<center>You need to be mining level 40 to mine here you are mining level {$ir['mine_level']}</center>"; exit; } mysql_query("UPDATE users SET energy=energy-25 WHERE userid=$userid",$c); $rand_gems = rand(1,40); $rand_exp = rand(1,600); echo "<center>You begin mining in the level 40 mine and found $rand_gems crystal(s).</center> "; mysql_query("UPDATE users SET crystals=crystals+'$rand_gems',mine_exp+'$rand_exp ' WHERE userid=$userid",$c); print "<center>[<a href='mine.php?action=mine3'>Mine again</a>]</center> "; print "<center>[<a href='mine.php'>Back</a>]</center> "; } function mine_4() { global $ir,$c,$userid; if($ir['energy'] < 10){ print "You need 10 power to mine here your have {$ir['energy']}"; exit; } if($ir['mine_level'] < 10){ print "<center>You need to be mining level 10 to mine here you are mining level {$ir['mine_level']}</center>"; exit; } mysql_query("UPDATE users SET energy=energy-10 WHERE userid=$userid",$c); $rand_money = rand(1,1000); $rand_exp = rand(1,100); echo "<center>You begin mining in the level 10 mine and found $$rand_money .</center> "; mysql_query("UPDATE users SET money=money+'$rand_money',mine_exp=mine_exp+'$rand _exp' WHERE userid=$userid",$c); print "<center>[<a href='mine.php?action=mine4'>Mine again</a>]</center> "; print "<center>[<a href='mine.php'>Back</a>]</center> "; } function mine_5() { global $ir,$c,$userid; if($ir['energy'] < 15){ print "<center>You need 15 power to mine here your have {$ir['energy']}</center>"; exit; } if($ir['mine_level'] < 30){ print "<center>You need to be mining level 30 to mine here you are mining level {$ir['mine_level']}</center>"; exit; } mysql_query("UPDATE users SET energy=energy-15 WHERE userid=$userid",$c); $rand_money = rand(1,3000); $rand_exp = rand(1,300); echo "<center>You begin mining in the level 30 mine and found $$rand_money .</center> "; mysql_query("UPDATE users SET money=money+'$rand_money',mine_exp+'$rand_exp' WHERE userid=$userid",$c); print "<center>[<a href='mine.php?action=mine5'>Mine again</a>]</center> "; print "<center>[<a href='mine.php'>Back</a>]</center> "; } function mine_6() { global $ir,$c,$userid; if($ir['energy'] < 25){ print "<center>You need 25 Energy to mine here your have {$ir['energy']}</center>"; exit; } if($ir['mine_level'] < 40){ print "<center>You need to be mining level 40 to mine here you are mining level {$ir['mine_level']}</center>"; exit; } mysql_query("UPDATE users SET energy=energy-25 WHERE userid=$userid",$c); $rand_money = rand(1,8000); $rand_exp = rand(1,600); echo "<center>You begin mining in the level 40 mine and found $$rand_money .</center> "; mysql_query("UPDATE users SET money=money+'$rand_money',mine_exp+'$rand_exp' WHERE userid=$userid",$c); print "<center>[<a href='mine.php?action=mine6'>Mine again</a>]</center> "; print "<center>[<a href='mine.php'>Back</a>]</center> "; } /** ** This is all the stuff that makes the script/mod work ** You shouldnt need to change it enless you want to ** make something add or have different MYSQL Tables **/ ?> Edited July 25, 2013 by Dominion added code tags Quote Link to comment Share on other sites More sharing options...
Dominion Posted July 25, 2013 Share Posted July 25, 2013 Please use code tags when posting I added them in for you this time. The function get_mine() doesn't exist. Quote Link to comment Share on other sites More sharing options...
moynul Posted July 25, 2013 Author Share Posted July 25, 2013 Thanks for that :D And so what do I do with the function? Quote Link to comment Share on other sites More sharing options...
Script47 Posted July 25, 2013 Share Posted July 25, 2013 Thanks for that :D And so what do I do with the function? Either ditch it, or if it's needed code it. If it's in an external file then include it in to this file. Quote Link to comment Share on other sites More sharing options...
jcvenom Posted July 25, 2013 Share Posted July 25, 2013 go_mine() doesn't exit add this to your cases case 'go_mine': go_mine();break; then if you dont have a function add this function go_mine() { //add what ever you want here } Quote Link to comment Share on other sites More sharing options...
moynul Posted July 25, 2013 Author Share Posted July 25, 2013 Should I replace the go_mine()? Quote Link to comment Share on other sites More sharing options...
moynul Posted July 25, 2013 Author Share Posted July 25, 2013 Its fixed thank you! Quote Link to comment Share on other sites More sharing options...
jcvenom Posted July 25, 2013 Share Posted July 25, 2013 hey Its fixed thank you! did my way work Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted July 25, 2013 Share Posted July 25, 2013 well sure doing this will get rid of the error: function get_mine() {} But does that actually fix what wrong? The answer is no. And why? I doubt anyone would just create a function that isn't useful in the mod itself so here's how to fix it: A quick search of the forum I came across this 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.