Welcome to the Browser-Base Game Zone forums!
users user_id (primary, auto_increment) user_name password
game user funds iron fuel warship tradeship last_tick ticks ticks_used
The good news is I heard that PHP is one of the easiest programming languages available ;o
<?/*This file and all others are protected bya GPL. Please read the licence beforeediting these files.-Voided Alliance, Copyright Auburnflame Games*/include('includes/functions.php');connectDB();$banLength = date('ymdH');$toG = date('i') + $_POST['length'];if ($toG < 10) {$banLength .= "0" . (date('i') + $_POST['length']);} else {$banLength .= (date('i') + $_POST['length']);}$query = "SELECT * FROM va_users";$result = mysql_query($query);$num1 = mysql_numrows($result);for ($i = 0; $i < $num1; $i++) {if (mysql_result($result,$i,"user") == $_COOKIE['va_users']) {$access = mysql_result($result,$i,"access");}}if ($access > 1) {$query2 = "SELECT * FROM va_users";$result2 = mysql_query($query2);$num2 = mysql_numrows($result2);for ($i = 0; $i < $num2; $i++) {if (strtolower(mysql_result($result2,$i,"user")) == strtolower($_POST['user'])) {$uID = mysql_result($result2,$i,"id");$found = true;}}if ($access == 2 and $_POST['length'] <= 10) {$good = true;}if ($access == 3 and $_POST['length'] <= 60) {$good = true;}if ($access > 3) {$good = true;}if ($found == true and $good == true) {$query = "INSERT INTO va_bans VALUES ('','" . $uID . "','" . $banLength . "')";mysql_query($query) or die("Unable to create ticket!");}header("Location: index.php?page=cp");}else{header("Location: index.php?page=cp");}?>?>
<?/*This file and all others are protected bya GPL. Please read the licence beforeediting these files.-Voided Alliance, Copyright Auburnflame Games*/include('includes/functions.php');$connected = connectDB();if ($connected == true) {$name = $_POST['bName'];$desc = $_POST['bDesc'];$author = $_POST['bAuthor'];$text = $_POST['bText'];$pass = md5($_POST['bPass']);$aPass = md5("123abc");if ($aPass == $pass) {$query = "INSERT INTO va_books VALUES ('','" . $name . "','" . $author . "','" . $desc . "','" . $text . "')";mysql_query($query) or die("Unable to create Mailbox.");header("Location: http://www.windmillent.com/game/index.php?page=game");die();}//END Write!} else {header("Location: index.php?page=game");die();}?>
<?/*This file and all others are protected bya GPL. Please read the licence beforeediting these files.-Voided Alliance, Copyright Auburnflame Games*/include('includes/functions.php');connectDB();//$que = "SELECT * FROM va_users WHERE user='" . $_POST['user'] . "' AND pass='" . md5($_POST['pass']) . "'";$query = "SELECT * FROM va_users";$result = mysql_query($query);$num1 = mysql_numrows($result);$query2 = "SELECT * FROM va_ticket";$result2 = mysql_query($query2);$num2 = mysql_numrows($result2);$name = $_COOKIE['va_users'];$amount = $_POST['bounty'];for ($i = 0; $i < $num1; $i++) {if (strtolower(mysql_result($result,$i,"user")) == strtolower($_POST['recieve'])) {$userID = mysql_result($result,$i,"id");$found = true;}if (strtolower(mysql_result($result,$i,"user")) == strtolower($name)) {$user2ID = mysql_result($result,$i,"id");$credits = mysql_result($result,$i,"currency");}}if ($credits >= $amount and $amount > 0 and $found == true) {$NC = $credits - $amount;$query = "UPDATE va_users SET currency='" . $NC . "' WHERE id='" . $user2ID . "'";mysql_query($query) or die("Unable to edit currency.");$query = "INSERT INTO va_bounty VALUES ('','" . $user2ID . "','" . $userID . "','" . $amount . "')";mysql_query($query) or die("Unable to create bounty!");header("Location: index.php?page=game&gamepage=bca");die();} else {header("Location: index.php?page=game&gamepage=bca2");die();}?>
<?/*This file and all others are protected bya GPL. Please read the licence beforeediting these files.-Voided Alliance, Copyright Auburnflame Games*/include('includes/functions.php');$connected = connectDB();if ($connected == true) {$query = "SELECT * FROM va_users";$result = mysql_query($query);$num1 = mysql_numrows($result);$query2 = "SELECT * FROM va_guilds";$result2 = mysql_query($query2);$num2 = mysql_numrows($result2);$guildN = $_POST['name'];$guildP = $_POST['pass'];$guildD = $_POST['describe'];$cost = 1000;for ($i = 0; $i < $num1; $i++) {if (mysql_result($result,$i,"user") == $_COOKIE['va_users']) {$credits = mysql_result($result,$i,"currency");$id = mysql_result($result,$i,"id");$cGid = mysql_result($result,$i,"guild");}}for ($i = 0; $i < $num2; $i++) {if (mysql_result($result2,$i,"name") == $guildN) {$aEx = true;}}for ($i = 2; $i < 9999999; $i++) { for ($i2 = 0; $i2 < $num2; $i2++) { if (mysql_result($result2,$i2,"id") == $i) { $istakenMB++; } } if ($istakenMB < 1) { $createdID = $i; break; } else { $istakenMB = 0; }}$guildID = $createdID;if ($cGid == 0 or $cGid == "") {if ($credits >= $cost) {if ($aEx != true) {$UC = $credits - $cost;$query = "UPDATE va_users SET currency='" . $UC . "' WHERE id='" . $id . "'";mysql_query($query) or die("Unable to edit Credits!");$query = "UPDATE va_users SET guild='" . $guildID . "' WHERE id='" . $id . "'";mysql_query($query) or die("Unable to edit Guild!");$query = "INSERT INTO va_guilds VALUES ('" . $createdID . "','" . $guildN . "','" . $id . "','" . $guildD . "','','" . $guildP . "')";mysql_query($query) or die("Unable to create guild!");header("Location: index.php?page=game&gamepage=guS");} else {//Guild Already Existsheader("Location: index.php?page=game&gamepage=guF");}} else {//Not Enough Creditsheader("Location: index.php?page=game&gamepage=guF");}} else {//Already in a guild!header("Location: index.php?page=game&gamepage=guF");}//Ending! DO NOT ADD CODE AFTER THIS LINE!} else {header("Location: index.php?page=game&gamepage=guF");}?>
<?/*This file and all others are protected bya GPL. Please read the licence beforeediting these files.-Voided Alliance, Copyright Auburnflame Games*/include('includes/functions.php');$connected = connectDB();if ($connected == true) {$stat = $_POST['stat'];$query = "SELECT * FROM va_users";$result = mysql_query($query);$num1 = mysql_numrows($result);for ($i = 0; $i < $num1; $i++) {if (mysql_result($result,$i,"user") == $_COOKIE['va_users']) {$access = mysql_result($result,$i,"access");}}if ($access > 3) {$query = "SELECT * FROM va_items";$result = mysql_query($query);$num1 = mysql_numrows($result);for ($i = 15; $i < 9999999; $i++) { for ($i2 = 0; $i2 < $num1; $i2++) { if (mysql_result($result,$i2,"id") == $i) { $istakenMB++; } } if ($istakenMB < 1) { $ItemID = $i; break; } else { $istakenMB = 0; }}if ($_POST['isbuffed'] == true) {$query = "INSERT INTO va_items VALUES ('" . $ItemID . "','" . $_POST['rareroll'] . "','" . $_POST['itemName'] . "','" . $_POST['itemDescribe'] . "','" . $_POST['itemimage'] . "','" . $_POST['itemtype'] . "','" . $_POST['itemAP'] . "','1','" . $_POST['buffImage'] . "','" . $_POST['buffName'] . "','" . $_POST['buffBL'] . "','" . $_POST['buffSTR'] . "','" . $_POST['buffDEF'] . "','" . $_POST['buffHP'] . "','" . $_POST['buffMP'] . "')";mysql_query($query) or die("Unable to create item!");} else {$query = "INSERT INTO va_items VALUES ('" . $ItemID . "','" . $_POST['rareroll'] . "','" . $_POST['itemName'] . "','" . $_POST['itemDescribe'] . "','" . $_POST['itemimage'] . "','" . $_POST['itemtype'] . "','" . $_POST['itemAP'] . "','0','" . $_POST['buffImage'] . "','" . $_POST['buffName'] . "','" . $_POST['buffBL'] . "','" . $_POST['buffSTR'] . "','" . $_POST['buffDEF'] . "','" . $_POST['buffHP'] . "','" . $_POST['buffMP'] . "')";mysql_query($query) or die("Unable to create item!");}header("Location: index.php?page=cp");}} else {header("Location: index.php?page=cp");}?>
<?/*This file and all others are protected bya GPL. Please read the licence beforeediting these files.-Voided Alliance, Copyright Auburnflame Games*/include('includes/functions.php');connectDB();$subject = $_POST['subject'];$text = $_POST['text'];$user = $_COOKIE['va_users'];$date = date("n.j.y");$query = "SELECT * FROM va_users";$result = mysql_query($query);$num1 = mysql_numrows($result);for ($i = 0; $i < $num1; $i++) {if (mysql_result($result,$i,"user") == $_COOKIE['va_users']) {$access = mysql_result($result,$i,"access");}}if ($access > 3) {$good = true;}if ($good == true) {$query = "INSERT INTO va_news VALUES ('','" . $subject . "','" . $text . "','" . $user . "','" . $date . "')";mysql_query($query) or die("Unable to create news!");header("Location: index.php?page=cp");die();}else{header("Location: index.php?page=cp");die();}?>
Well, you could post the script and ask us about what things mean *Hehe, don't fall for my cheap tricks to get a free script ^^
Warning: Cannot modify header information - headers already sent by (output started at /home/auburnf/public_html/lp9sc/GGMPOG/ggmpog.php:7) in /home/auburnf/public_html/lp9sc/GGMPOG/ggmpog.php on line 157
<table widht="550px" height="110px" align="center" style="font-family:Verdana, Arial;"><tr align="center"><td><h3>Registration</h3></td></tr><form method="post" action="regprocess.php"><tr align="Center"><td>Username: <input type="Text" name="username"></td></tr><tr align="Center"><td>Password: <input type="text" name="password"></td></tr><tr align="center"><td>E-Mail: <input type="text" name="email"></td></tr><tr align="center"><td>Confirm E-Mail: <input type="text" name="email1"></td></tr><tr align="center"><td><input type="submit" value="Register" name="register"></td></tr></form></table>
<?php//Include scriptinclude('includes/functions.php');//If set registerif(isset($_POST['register'])){//Variables from form$username = $_POST['username'];$password = $_POST['password'];//hash password to hide$password = md5($password);//Email forms$email = $_POST['email'];$email1 = $_POST['email1'];//Date stat$date = date("F j");//Error on filling in form$errors = 0;$emessage = "<center><font face=\"Verdana\">Sorry, we enounctered the following errors when processing your registration:<br /><ul>";//If it is emptyif(empty($username) || empty($password) || empty($email) || empty($email1)){ $errors = 1; $emessage .= "<li>Sorry, you must fill in <strong>all</strong> fields. Please go back and try again.</li>";}if(strlen($_POST['password']) <= 3){ $errors = 1; $emessage .= "<li>Sorry, your password must be <strong>atleast</strong> four characters.</li>";}if($email != $email1){ $errors = 1; $emessage .= "<li>Sorry, The confirmation email does not match your email.</li>";}//if they made errors, show themif($errors != 0){ $emessage .= "</font></center>"; die("$emessage");}//connect to databasemysql_connect("localhost", "*************", "******") or die(mysql_error());//Database namemysql_select_db("auburnf_lp9sc") or die(mysql_error());//Give starting resources etc $now = date("U"); $sql = "INSERT INTO gg_game(username,gil,steel,iron,last_tick,ticks,explorer,swordsman,copper,bronze) VALUES(LAST_INSERTED_ID(),'10000','50','100','$now','100','10','5','250','500')";//perform query, user submitted datamysql_query("INSERT INTO gg_game (username, password, email, date, gil, bronze, copper, iron, steel, explorer, swordsman) VALUES ('$username', '$password', '$email', '$date', '$gil', '$bronze', '$copper', '$iron', '$steel', '$explorer', '$swordsman')") or die(mysql_error());//give them a nice pat on the back for doing everything just rightecho("<center><font face=\"Verdana\">Thanks for registering. You may now log in by clicking <a href=\"/test/login.php\">here</a>.</font></center>");}?>
//Give starting resources etc $now = date("U"); $sql = "INSERT INTO gg_game(username,gil,steel,iron,last_tick,ticks,explorer,swordsman,copper,bronze) VALUES(LAST_INSERTED_ID(),'10000','50','100','$now','100','10','5','250','500')";//perform query, user submitted datamysql_query("INSERT INTO gg_game (username, password, email, date, gil, bronze, copper, iron, steel, explorer, swordsman) VALUES ('$username', '$password', '$email', '$date', '$gil', '$bronze', '$copper', '$iron', '$steel', '$explorer', '$swordsman')") or die(mysql_error());
<table width="300px" height="110px" align="center" style="font-family:Verdana;"><tr align="center"><td><h3>Login</h3></td></tr><form action="loginprocess.php" method="post"><tr align="center"><td>Username: <input type="text" name="username"></td></tr><tr align="Center"><td>Password: <input type="text" name="password"></td></tr><tr align="center"><td><input type="submit" value="Login" name="login"></td></tr></form></table>
<?php//start it!session_start();if(isset($_POST['login'])){//fill in all fields$username = $_POST['username'];$password = $_POST['password'];$password = md5($password);//connect to DBmysql_connect("localhost", "*************", "******") or die(mysql_error());mysql_select_db("auburnf_lp9sc") or die(mysql_error());//make sure they aren't lying about there details! :O$res = mysql_query("SELECT * FROM gg_game WHERE username='$username' AND password='$password'");//no user with details so... :Oif(mysql_num_rows($res) == 0){ echo("<center><font face=\"Verdana\">We did not find your user details, please go <a href=\"login.php\">back</a> and try again.");}else{//set the session data$_SESSION['username'] = $username;$_SESSION['password'] = $password;//redirect to members page =Dheader("Location: ismember.php");}}?>
<?php//start session!session_start();//get the username and password from the session$password = $_SESSION['password'];$username = $_SESSION['username'];//connect to DBmysql_connect("localhost", "************", "******") or die(mysql_error());mysql_select_db("auburnf_lp9sc") or die(mysql_error());//search db for session user and password$res = mysql_query("SELECT * FROM gg_game WHERE username='$username' AND password='$password'") or die(mysql_error());if(mysql_num_rows($res) == 1){ while($get=mysql_fetch_array($res)) {//show user data! echo("<table align=\"center\" width=\"400px\" height=\"110px\" style=\"font-family:Verdana;\">"); echo("<tr align=\"center\"><td><h3>Thanks for logging in $username</h3></td></tr>"); echo('<tr align="center"><td>Your Password is: Encrypted for safety.</td></tr>'); echo('<tr align="Center"><td>Your E-mail is: '. $get['email'] .'</td></tr>'); echo('<tr align="center"><td>You Joined: '. $get['date'] .'</td></tr>'); echo('<tr align="center"><td><br /><br /></td></tr>'); echo('<tr align="center"><td><h3>Current Resources</td></tr>'); echo('<tr align="Center"><td>Gil: '. $get['gil'] .'</td></tr>'); echo('<tr align="center"><td>Bronze: '. $get['bronze'] .'</td></tr>'); echo('<tr align="center"><td>Copper: '. $get['copper'] .'</td></tr>'); echo('<tr align="center"><td>Iron: '. $get['iron'] .'</td></tr>'); echo('<tr align="center"><td>Steel: '. $get['steel'] .'</td></tr>'); echo('<tr align="center"><td>Explorers: '. $get['explorer'] .'</td></tr>'); echo('<tr align="center"><td>Swordsman: '. $get['swordsman'] .'</td></tr>'); echo('<tr align="center"><td><br /><br /></td></tr>'); echo('<tr align="center"><td><h3>Account Options</td></tr>'); echo('<tr align="center"><td><li><a href="/test/logout.php">Logout</a></li></td></tr>'); echo("</table>"); } } else //hmmm we didnt find there data? error time! { echo("<center><font face=\"Verdana\">Sorry, you are not logged in, proceed <a href=\"/test/login.php\">here</a> to login or <a href=\"/test/register.php\">here</a> to register."); }?>
<?php//start it!session_start();//logout!session_destroy();echo("<h3><center><font face=\"Verdana\">You have sucessfully logged out.<font></center></h3><br />");echo("<h4><center><font face=\"Verdana\">Proceed <a href=\"/test/login.php\">here</a> to login again.</font></center></h4>");?>
<?php session_start(); $username = $_SESSION['username']; $password = $_SESSION['password']; $do = $_GET['do']; mysql_connect("localhost", "**********", "******") or die(mysql_error()); mysql_select_db("auburnf_lp9sc") or die(mysql_error()); $res = mysql_query("SELECT * FROM gg_game WHERE username='$username' AND password='$password'"); if(mysql_num_rows($res) == 0) { die("<center><font face=\"Verdana\">We did not find your user details, please go <a href=\"test/login.php\">back</a> and try again."); } if($do == "") { echo('<table align="center" width="500px" height="100px"> <tr align="center" bgcolor="e1e1e1"><td><a href="pm.php?do=inbox">Inbox</a></td></tr> <tr align="center" bgcolor="e1e1e1"><td><a href="pm.php?do=send">Send</a></td></tr> </table>'); }else if($do == "inbox") { $res = mysql_query("SELECT * FROM `gg_pm` WHERE `to` = '$username' ORDER BY `id` DESC") or die(mysql_error()); echo('<center><h3>Inbox</h3></center>'); echo('<table align="center" width="500px" height="100px">'); while($get = mysql_fetch_array($res)) { $title = $get['title']; $from = $get['from']; $id = $get['id']; echo('<tr align="center" bgcolor="e1e1e1"><td><a href="">'. $title .'</a></td><td>From: '. $from .'</td></tr>'); } if(mysql_num_rows($res) == 0) { echo('<tr align="center" bgcolor="e1e1e1"><td>Sorry, no messages in the inbox.</td></tr>'); } }else if($do == "send") { echo('<table align="center" width="500px" height="100px"> <form method="post" action=""> <tr align="center" bgcolor="e1e1e1"><td>To: <input type"text" name="to"></td></tr> <tr align="center" bgcolor="e1e1e1"><td>Title: <input type="text" name="title"></td></tr> <tr align="center" bgcolor="e1e1e1"><td>Message:</td></tr> <tr align="center" bgcolor="e1e1e1"><td><textarea name="message" rows="5" cols="50"></textarea></td></tr> <tr align="Center" bgcolor="e1e1e1"><td><input type="submit" value="send" name="submit"></td></tr> </form> </table>'); } else if($do == "sendit") { $to = $_POST['to']; $title = $_POST['title']; $message = $_POST['message']; $from = $username; mysql_query("INSERT INTO `gg_pm` (`to`, `title`, `message`, `from`) VALUES ('$to', '$title', '$message', '$from')") or die(mysql_error()); echo("Message sent to $to. Thanks. Click <a href=\"test/pm.php\">here</a> to goto your main PM box."); }else if($do == "view") { $id = $_GET['id']; $mes = mysql_query("SELECT * FROM gg_pm WHERE `id`= '$id'") or die(mysql_error()); echo('<table width="500px" height="100px" align="Center">'); while($getit = mysql_fetch_array($mes)) { $from = $getit['from']; $message = $getit['message']; echo('<tr align="center" bgcolor="e1e1e1"><td>From: '. $from .'</td></tr> <tr align="Center" bgcolor="e1e1e1"><td>Message:</td></tr> <tr align="center" bgcolor="e1e1e1"><td><textarea rows="5" cols="50">'. $message .'</textarea></td></tr> <tr align="center" bgcolor="e1e1e1"><td><a href="?do=reply&id='. $id .'">Reply</a></td></tr> <tr align="center" bgcolor="e1e1e1"><td><a href="?do=delete&id='. $id .'">Delete</a></td></tr> <tr align="center" bgcolor="e1e1e1"><td><a href="?do=">PM Home</a> | <a href="/logsys/ismember.php">UserCP Home</a></td></tr>'); } echo('</table>'); }else if($do == "reply") { $id = $_GET['id']; $getname = mysql_query("SELECT * FROM `gg_pm` WHERE `id` = '$id'"); while($gname = mysql_fetch_array($getname)) { $to = $gname['to']; $title = $gname['title']; echo('<form method="post" action="?do=sendit"> <table width="500px" height="100px" align="Center"> <tr align="center" bgcolor="e1e1e1"><td>To: <input type"text" name="to" value="'. $to .'"></td></tr> <tr align="center" bgcolor="e1e1e1"><td>Title: <input type="text" name="title" value="Re: '. $title .'"></td></tr> <tr align="center" bgcolor="e1e1e1"><td>Message:</td></tr> <tr align="center" bgcolor="e1e1e1"><td><textarea name="message" rows="5" cols="50"></textarea></td></tr> <tr align="Center" bgcolor="e1e1e1"><td><input type="submit" value="send" name="submit"></td></tr> </form>'); } }else if($do == "delete") { $id = $_GET['id']; mysql_query("DELETE FROM `gg_pm` WHERE `id` = '$id' AND `to` = '$username'") or die(mysql_error()); echo("<center>Message deleted. Goto your <a href=\"?do=\">PM home</a> or your <a href=\"?do=inbox\">inbox</a>."); } ?>
<table widht="550px" height="110px" align="center" style="font-family:Verdana, Arial;"><tr align="center"><td width="272"><h3>buy</h3></td></tr><form method="post" action="buyprocess.php"><tr align="Center"><td>explorer<input type="text" name="explorer">10gil</td></tr><tr align="Center"><td>swordsman<input type="text" name="swordsman"> 20gil</td></tr><tr align="center"><td><input type="submit" value="buy" name="buy"></td></tr></form></table><br /><table widht="550px" height="110px" align="center" style="font-family:Verdana, Arial;"><tr align="center"><td width="272"><h3>sell</h3></td></tr><form method="post" action="buyprocess.php"><tr align="Center"><td>explorer<input type="text" name="explorer">5gil</td></tr><tr align="Center"><td>swordsman<input type="text" name="swordsman"> 10gil</td></tr><tr align="center"><td><input type="submit" value="buy" name="buy"></td></tr></form></table>
<?php//Include scriptinclude('includes/functions.php');//If set registerif(isset($_POST['buy'])){//Variables from form$explorer = $_POST['explorer'];$swordsman = $_POST['swordsman'];$explorerbuy = $_POST['explorer' * 10];$swordsmanbuy = $_POST['swordsman' * 20];//buytotal$buytotal = $_POST['explorerbuy' + 'swordsmanbuy'];//Buy units$buyunits = $gilvalue - $buytotal//Error on filling in form$errors = 0;$emessage = "<center><font face=\"Verdana\">Sorry, we enounctered the following errors when processing your purchase.<br /><ul>";//If it is emptyif(empty($explorer) || empty($swordsman)){ $errors = 1; $emessage .= "<li>Sorry, you must fill in <strong>all</strong> fields. Please go back and try again. If you do not wish to buy one type of unit fill in the field with 0.</li>";}if(strlen($_POST['explorer,swordsman']) <= -1){ $errors = 1; $emessage .= "<li>You cannot purchase negative units!.</li>";}if(strlen($_POST['explorer,swordsman']) >= 9999999999){ $errors = 1; $emessage .= "<li>You cannot purchase too many units!.</li>";}if($buytotal > $gilvalue){ $errors = 1; $emessage .= "<li>Sorry you do not have enough gil for that many units.</li>";}//if they made errors, show themif($errors != 0){ $emessage .= "</font></center>"; die("$emessage");}//Buy units now$explorernew = $explorerbuy$swordsmannew = $swordsmanbuyif($buytotal < $gilvalue){//connect to databasemysql_connect("localhost", "***********", "*****") or die(mysql_error());//Database namemysql_select_db("auburnf_lp9sc") or die(mysql_error());//Givename$gilvalue = mysql_query("SELECT * FROM gg_game WHERE gil='$gil'");$explorervalue = mysql_query("SELECT * FROM gg_game WHERE explorer='$explorer'");$swordsman = mysql_query("SELECT * FROM gg_game WHERE swordsman='$swordsman'");//Give starting resources etc $now = date("U"); $sql = "INSERT INTO gg_game(username,gil,steel,iron,last_tick,ticks,explorer,swordsman,copper,bronze) VALUES(LAST_INSERTED_ID(),'10000','50','100','$now','100','$explorernew','$swordsmannew','250','500')";//perform query, user submitted datamysql_query("INSERT INTO gg_game (username, password, email, date, gil, bronze, copper, iron, steel, explorer, swordsman) VALUES ('$username', '$password', '$email', '$date', '$gil', '$bronze', '$copper', '$iron', '$steel', '$explorer', '$swordsman')") or die(mysql_error());} else { $errors = 1; $emessage .= "<li>Sorry you do not have enough gil for that many units.</li>"; }?>
//Give starting resources etc $now = date("U"); $sql = "INSERT INTO gg_game(username,gil,steel,iron,last_tick,ticks,explorer,swordsman,copper,bronze) VALUES(LAST_INSERTED_ID(),'10000','50','100','$now','100','$explorernew','$swordsmannew','250','500')";//perform query, user submitted datamysql_query("INSERT INTO gg_game (username, password, email, date, gil, bronze, copper, iron, steel, explorer, swordsman) VALUES ('$username', '$password', '$email', '$date', '$gil', '$bronze', '$copper', '$iron', '$steel', '$explorer', '$swordsman')") or die(mysql_error());
I've noticed that PHP isn't really huge in different commands needed for certain things, for most things that I've been on I havn't learnt many new commands, is there really that much to learn? Because it seems that most things you can make with PHP can be made using the same commands. ;o
$buyunits = $gilvalue - $buytotal$explorernew = $explorerbuy$swordsmannew = $swordsmanbuy
<?php $now = date("U"); $sql = "INSERT INTO gg_game (username, password, email, date, gil, bronze, copper, iron, steel, explorer, swordsman) VALUES ('$username', '$password', '$email', '$date', '$gil', '$bronze', '$copper', '$iron', '$steel', '$explorer', '$swordsman')"; mysql_query($sql) or die(mysql_error());?>
I'm not sure about performing query, was I suppose to include those? ;s I included them so I could use them on the login page to view the current amount of resources etc but it doesn't show the values that I set them to, it just shows 0 for each resource etc
<?phpelse if($do == "send") { echo('<table align="center" width="500px" height="100px"> <form method="post" action="pm.php?do=sendit"> <tr align="center" bgcolor="e1e1e1"><td>To: <input type"text" name="to"></td></tr> <tr align="center" bgcolor="e1e1e1"><td>Title: <input type="text" name="title"></td></tr> <tr align="center" bgcolor="e1e1e1"><td>Message:</td></tr> <tr align="center" bgcolor="e1e1e1"><td><textarea name="message" rows="5" cols="50"></textarea></td></tr> <tr align="Center" bgcolor="e1e1e1"><td><input type="submit" value="send" name="submit"></td></tr> </form> </table>'); } else if($do == "sendit" AND isset($_POST['submit'])) { $to = $_POST['to']; $title = $_POST['title']; $message = $_POST['message']; $from = $username; mysql_query("INSERT INTO `gg_pm` (`to`, `title`, `message`, `from`) VALUES ('$to', '$title', '$message', '$from')") or die(mysql_error()); echo("Message sent to $to. Thanks. Click <a href=\"test/pm.php\">here</a> to goto your main PM box."); }?>
<?phpif(isset($_POST['buy'])){//Variables from form$explorer = $_POST['explorer'];$swordsman = $_POST['swordsman'];$explorerbuy = $_POST['explorer']*10;$swordsmanbuy = $_POST['swordsman']*10;//buytotal$buytotal = $explorerbuy + $swordsmanbuy;//Buy units$buyunits = $gilvalue - $buytotal//Error on filling in form...?>
//This one adds 1000 gil to the logged in playermysql_query("update `players` set `gil`=gil+1000 where `id`=$_SESSION[id]");//This one gets all the data about a usermysql_query("select * from `players` where `id`=$_SESSION[id]");
mysql_query("update `gg_game` set `gil`=gil+10000 where `id`=$_SESSION[id]");
$password = $_SESSION['password'];$username = $_SESSION['username'];$gil = $_SESSION['gil'];
$res = mysql_query("SELECT * FROM gg_game WHERE username='$username' AND password='$password' AND gil='$gil'") or die(mysql_error());if(mysql_num_rows($res) == 1){ while($get=mysql_fetch_array($res)) { echo("<table align=\"center\" width=\"400px\" height=\"110px\" style=\"font-family:Verdana;\">"); echo("<tr align=\"center\"><td><h3>Currently logged in as: $username</h3></td></tr>"); echo("<tr align=\"center\"><td><h3>Gil: $gil</h3></td></tr>"); echo('<tr align="Center"><td>E-mail: '. $get['email'] .'</td></tr>'); echo('<tr align="center"><td>Joined: '. $get['date'] .'</td></tr>'); echo('<tr align="center"><td>Gil: '. $get['gil'] .'</td></tr>'); echo("</table>");
<?php//This one gets all the data about a usermysql_query("select * from `players` where `id`=$_SESSION[id]");?>
<?php$password = $_SESSION['password'];$username = $_SESSION['username'];$gil = $_SESSION['gil'];?>
<?php$sql = "select * from `players` where `id`=$_SESSION[id]";$rs = mysql_query($sql); //Step 1$rs = mysql_fetch_array($rs); //Step 2?>
echo $rs['id']; // Displays the id of the currently logged in userecho $rs['name']; // Displays the name of the currently logged in user
<?php$password = $_SESSION['password'];$username = $_SESSION['username'];$sql = "SELECT * FROM gg_game,players WHERE gg_game.user_id=players.id AND players.name='$username' AND players.password='$password'";$rs = mysql_query($rs);$rs = mysql_fetch_array($rs);$gil = $rs['gil'];?>
Mysql gg_game tableid int 15 NOTNULLusername varchar 255 NOTNULLpassword varchar 255 NOTNULLis id wrong? ;oprimary key = usernameI tried making id primary key too but it still doesn't help =\