我的functions.php 中有这个函数 我有一个名为crisions 的php 页面,我将如何在crisions.php 中调用这个函数。
function jailMe($script, $reason, $unbustable = false){
global $fetch;
if($unbustable == false){ $unbustable = "0"; }else{ $unbustable = "1"; }
if($script == 'Crime'){
$chanceToJail = rand(1,5);
if($chanceToJail == 2){
$jailTime = time() + (rand(60,90));
mysql_query("INSERT INTO `jail` (`name`, `release`, `reason`, `bustable`) VALUES ('{$fetch['name']}','$jailTime','$reason','$unbustable')");
return "<br /><br /><h1>You have been thrown into jail!</h1>";
}
犯罪.php
session_start();
include_once("../src/connect.php");
include_once("../src/functions.php");
if($_POST['DoCrime']){
$Crime = (int)makesafe($_POST['DoCrime']);
if($Crime == '1'){
$NewRankXP = rand(1,15);
$NewMoney = rand(30,100);
$CrimeTime = (time()+ 60*1);
mysql_query("UPDATE `Users` SET `RankXP` = `RankXP` + '$NewRankXP' WHERE `id` = '{$fetchChar['id']}'");
mysql_query("UPDATE `Users` SET `Money` = `Money` + '$NewMoney' WHERE `id` = '{$fetchChar['id']}'");
mysql_query("UPDATE `Users` SET `last_crime` = '$CrimeTime' WHERE `id` = '{$fetchChar['id']}'");
echo "<font color='lime'>Success You got away with $NewRankXP XP and $$NewMoney!</font>";
}
}