Here something from me. I used MySQL Improved (mysqli) for all query.
payment/beers.php
<?php
$link = mysqli_connect("hostname", "username", "password", "database");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$time = date_timestamp_get(date_create());
$pid = $_GET['player'];
if(isset($pid))
{
$uid = mysqli_real_escape_string($link,$pid);
$row = mysqli_fetch_array(mysqli_query($link,"SELECT user_name, next_breset, mushroom, ssid FROM user_data WHERE user_id='". $uid ."' LIMIT 1"));
$username = mysqli_real_escape_string($link,$row['user_name']);
$next = mysqli_real_escape_string($link,$row['next_breset']);
$shrooms = mysqli_real_escape_string($link,$row['mushroom']);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="de" dir="ltr">
<title>Beers Reset</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="expires" content="0">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta name="robots" content="noindex,nofollow,noarchive">
<link rel="stylesheet" href="css.css" type="text/css"/>
</head>
<body>
<center>
<table align="center" width="570px" style="font-family: Arial; color: #FFFFFF;">
<tbody>
<tr>
<td style="padding: 0; margin:0">
<div style="overflow: auto; height: 360px; padding: 10px">
<br><br><br>
<?php
if(!isset($_POST["doit"]))
{
if($next <= $time || $next == "0")
{
?>
<center>
<h1>Hello <b><?=$username?></b>!</h1>
Reset your beers so u can continue your adventure!<br>
Tavern owner needs <?=$shrooms;?>/50 to reset you!<br>
If you don't have them you will not be reseted!<br>
<br>
<form action="<?=$_SERVER["PHP_SELF"] ?>" method="post" enctype="multipart/form-data" target="_self">
<input type="password" name="password" size="10" value=""><br><br>
<input type="submit" value="Ok!" name="button">
<input type="hidden" name="doit" value="yes">
<input type="hidden" name="uid" value="<?=$uid?>">
</form>
</center>
<?php
}
else
{
?>
<center>
<h2>I'm sorry <b><?=$username?></b>!</h2>
<p>Your next reset will be available at: <?echo date('d.m.Y H:i:s', $next); /*Convert timestamp to GMT*/?></p>
</center>
<?php
}
}
if(isset($_POST["doit"]))
{
$userid = $_POST["uid"];
$pass = $_POST["password"];
$row = mysqli_fetch_array(mysqli_query($link,"SELECT password,next_breset FROM user_data WHERE user_id='". $userid ."' LIMIT 1"));
if($row["password"] == md5($pass))
{
$next = $time+21600;
mysqli_query($link,"UPDATE user_data
SET next_breset = '" . $next . "', beers = '0', mushroom = mushroom-50 WHERE user_id = '" . $userid . "' LIMIT 1");
echo '<script>window.close();</script><META HTTP-EQUIV="REFRESH" CONTENT="0; URL=../">';
}
else
{
echo '<script>window.close();</script><META HTTP-EQUIV="REFRESH" CONTENT="0; URL=../">';
}
}
?>
</div>
</td>
</tr>
</tbody>
</table>
</center>
</body>
</html>
and css.css
body {
background:url(../res/background.jpg);
background-repeat:no-repeat;
background-position:top center;
background-color:#000000;
font-family: Tahoma, Arial, Helvetica, sans-serif;
color: #FFFFFF;
margin: 188px auto auto 0;
}
a:link { text-decoration:none; color:#ffd9aa; }
a:visited { text-decoration:none; color:#ffd9aa; }
a:hover { text-decoration:underline; color:#ffd9aa; }
a:active { text-decoration:none; color:#ffd9aa; }
a:focus { text-decoration:none; color:#ffd9aa; }
h1{
font-size: 1.2em;
font-weight: bold;
padding:0;
margin:0;
margin-bottom: 0.5em;
}
.imprint2 {
margin-top: 130px;
color: #000000;
}
.imprint2 a {
color: #000000;
text-decoration: underline;
}
input[type=text], textarea, input[type=password] {
border: 1px solid #929292;
color: #929292;
padding: 10px;
vertical-align: text-top;
width: 300px;
-webkit-box-shadow: #e3e3e3 0.1em 0.1em 0.2em;
box-shadow: #e3e3e3 0.1em 0.1em 0.2em;
-moz-box-shadow: #e3e3e3 0.1em 0.1em 0.2em;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-border-radius: 5px;
-khtml-border-radius: 5px;
background: -webkit-gradient(linear, left top, left 25, from(#FFFFFF), color-stop(4%, #EEEEEE), to(#FFFFFF));
background: -moz-linear-gradient(top, #FFFFFF, #EEEEEE 1px, #FFFFFF 25px);
}
input[type=submit] {
border: 1px solid #929292;
color: #000;
font-weight: bold;
padding: 10px;
vertical-align: text-top;
width: auto;
-webkit-box-shadow: #e3e3e3 0.1em 0.1em 0.2em;
box-shadow: #e3e3e3 0.1em 0.1em 0.2em;
-moz-box-shadow: #e3e3e3 0.1em 0.1em 0.2em;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-border-radius: 5px;
-khtml-border-radius: 5px;
background: -webkit-gradient(linear, left top, left 25, from(#FFFFFF), color-stop(4%, #EEEEEE), to(#FFFFFF));
background: -moz-linear-gradient(top, #FFFFFF, #EEEEEE 1px, #FFFFFF 25px);
}
in papaya_cfg.php
link button 9 text Reset Beers
link button 9 hint Reset Beers. It will cost you 50 mushrooms!
link button 9 request
link button 9 link http://<$serverdomain>/payment/beers.php?player=<$playerid>
link button 9 function
Also if anyone needs it improvement for arena. It doesn't allow to attack players with range below/above 10 levels from you.
Find
// check times in request.php and after
Code:
else {
$time += 600;
}
add these lines
Code:
if ($op ['lvl'] < $p1 ['lvl']-10 || $op ['lvl'] > $p1 ['lvl']+10) {
$ret = array (
$ERR_FIGHT_PLAYER
);
break;
}
Also find
Code:
$ERR_DEALER_AKTION = "175";
and below add
Code:
$ERR_FIGHT_PLAYER = "E310";
it will return "Nothing happens."
Forgot to mention that beers reset script is based on Crasim dungeon reset script so 90% of credits go to him.