I am only giving the currency script, as I assume that you know how to use databases.
Currency Getter
Shop system
Currency Getter
Code:
<?php
include('conn.php');
session_start();
$sql=mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'");
$row=mysql_fetch_array($sql);
echo "You have <b>" . $row['money'] . "</b> cash!";
?>
Shop system
Code:
<?php
include('conn.php');
session_start();
$sql=mysql_query("SELECT * FROM users WHERE username = '$_SESSION[username]'");
$row=mysql_fetch_array($sql);
if(isset($_POST['submit'])){
if($row['money'] >= $_POST['price']){
mysql_query("UPDATE users SET money = money-$_POST['price'] WHERE username = '$_SESSION[username]'");
}
else{
echo "You lack sufficient funds";
}
?>