问题描述
我为我在这里托管的免费二十一点游戏买了一个脚本http://bit.ly/1T608H9
当用户来到页面时,它会自动记录用户进入游戏并给予他们平衡。当余额结束时,它会加载带有链接的弹出窗口#我希望游戏在点击链接时重新加载余额。
你开始玩你有100个免费积分。当他们完成时,它会加载一条消息,告诉您您失去了平衡,并且它有一个添加余额的链接。由于它是免费的钱而不是真实的我希望游戏在点击链接时再次以新的免费资金余额重新开始。 (链接在一个java文件中,我可以改变它)
在java文件中我会链接到这样的东西重新加载游戏并重新开始。 URLtoGAME / GAME / index.php?refresh_balance
我需要的是修改索引php,这样如果有人完成可用的信用,他们会点击链接然后重新开始。我不需要安全性,所以你只需要一个index.php参数,索引php代码就在这条消息的底部。
我被告知我需要在索引页面中调整代码(消息底部的代码)做以下
- 如果它没有登录 - >创建一个用户 - 否则,如果它已登录&& $ _GET ['refresh_balance'] == 1 - >将他们的余额设置为1000美元
然后你链接到刷新余额到index.php?refresh_balance = 1
INDEX.PHP中的当前PHP代码
I bought a script for a free blackjack game I am hosting here http://bit.ly/1T608H9
When user comes to page, it automatically logs user in to the GAME and gives them a balance. When balance finishes it loads a popup with a link # I want the game to reload the balance when they click the link.
When you start playing you have 100 free credits. when they finish it loads a message to tell you that you are out of balance and it has a link to add balance. Since it is free money and not real I want the game to start again with new free money balance when they click the link. (the link is in a java file and I can change that)
in the java file I would link to something like this to reload the game and start over. URLtoGAME/GAME/index.php?refresh_balance
What I need is to modify the index php so that if someone finishes available credit, they click the link and they start over. I
don't need security, so you can just have a parameter to index.php and the index php code is at the bottom of this message.
I was informed what I need to do tweak code in index page (code at bottom of the message) to do the following
- if it's not logged in -> create a user- else if it's logged in && $_GET['refresh_balance'] == 1 -> set their balance to $1000
Then you make your link to "refresh balance" to "index.php?refresh_balance=1"
CURRENT PHP CODE IN INDEX.PHP
<?php
session_start();
include('includes/db.php');
include('includes/users.php');
include('includes/blackjack.php');
$userID = Users::LoggedUserID();
if (!$userID) {
DB::Execute("INSERT INTO blackjack_users (external_id, balance) VALUES ('" . DB::UniqueRandomID("blackjack_users", "external_id", "int") . "', 100)");
$userID = DB::InsertID();
$_SESSION['userID'] = $userID;
}
$userBalance = Users::GetUserBalance($userID);
$openGameState = null;
$openGameID = BlackJack::FindOpenGame($userID);
if ($openGameID) {
$openGameState = BlackJack::GetGameState($openGameID, true);
}
$windowID = rand();
?>
我的尝试:
尝试添加如果它已登录&& $ _GET ['refresh_balance'] == 1 - >在原始代码的不同部分将其余额设置为$ 1000。
What I have tried:
tried adding "else if it's logged in && $_GET['refresh_balance'] == 1 -> set their balance to $1000" in different parts of the original code.
推荐答案
<?php
session_start();
include('includes/db.php');
include('includes/users.php');
include('includes/blackjack.php');
这篇关于如何将此代码插入到现有的PHP代码中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!