-
+
@@ -96,9 +80,6 @@ $message="Invalid username or password.";
-
-
-
Dec 1st 2007
Open!
@@ -110,27 +91,20 @@ $message="Invalid username or password.";
-
-
|
|
- $message";
-
-
-} else if($_SERVER['QUERY_STRING']=="highscores") {
-
-include("hs.php");
-
-} else {
-echo ' EarthBound Welcomes You
+ | $message";
+ } else if($_SERVER['QUERY_STRING']=="highscores") {
+ include("hs.php");
+ } else {
+ echo ' EarthBound Welcomes You
@@ -170,7 +144,7 @@ The game is now open! Go play!
-->
@@ -229,4 +203,4 @@ Players Online:
-
\ No newline at end of file
+
diff --git a/init.sql b/init.sql
new file mode 100644
index 0000000..ec23f9b
--- /dev/null
+++ b/init.sql
@@ -0,0 +1,73 @@
+CREATE DATABASE mop_rpg;
+
+USE mop_rpg;
+
+CREATE TABLE `mrpg_battles` (
+ `id` text,
+ `use` text,
+ `enemy` text,
+ `enemyhp` text,
+ `other` text
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `mrpg_confirm` (
+ `id` int(11) DEFAULT NULL,
+ `q` text,
+ `yesx` int(11) DEFAULT NULL,
+ `yesy` int(11) DEFAULT NULL,
+ `nox` int(11) DEFAULT NULL,
+ `noy` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `mrpg_message` (
+ `id` int(11) DEFAULT NULL,
+ `q` text,
+ `x` int(11) DEFAULT NULL,
+ `y` int(11) DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE `mrpg_monsters` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `image` text,
+ `hp` int(11) DEFAULT NULL,
+ `name` text,
+ `diemsg` text,
+ `expgive` int(11) DEFAULT NULL,
+ `power` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
+
+INSERT INTO `mrpg_monsters` VALUES (1,'rat.png',30,'Rat','rat died',10,0);
+INSERT INTO `mrpg_monsters` VALUES (2,'chef_1.png',30,'Chef','chef screamed "profit has a tiny dick" and died',20,2);
+INSERT INTO `mrpg_monsters` VALUES (3,'monster.png',30,'Monster','monster died',30,5);
+
+CREATE TABLE `mrpg_stat` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `hp` int(11) DEFAULT NULL,
+ `maxhp` int(11) DEFAULT NULL,
+ `pp` int(11) DEFAULT NULL,
+ `offense` int(11) DEFAULT NULL,
+ `defense` int(11) DEFAULT NULL,
+ `fight` int(11) DEFAULT NULL,
+ `speed` int(11) DEFAULT NULL,
+ `wisdom` int(11) DEFAULT NULL,
+ `strength` int(11) DEFAULT NULL,
+ `force` int(11) DEFAULT NULL,
+ `poison` int(11) DEFAULT NULL,
+ `other` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
+
+CREATE TABLE `mrpg_users` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` text,
+ `password` text,
+ `x` int(11) DEFAULT NULL,
+ `y` int(11) DEFAULT NULL,
+ `dir` text,
+ `inventory` text,
+ `level` int(11) DEFAULT NULL,
+ `lastact` text,
+ `mode` text,
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
diff --git a/login.php b/login.php
index 8cbb64b..67ff5f6 100644
--- a/login.php
+++ b/login.php
@@ -2,34 +2,23 @@
include("config.php");
-if($_POST['u']!="")
-{
-$u=addslashes($_POST['u']);
-$p=addslashes($_POST['p']);
-
-if($u!="" && $p!="")
-{
-$sql="SELECT * FROM mrpg_users WHERE name='$u'";
-$result = mysql_query($sql);
-while($row = mysql_fetch_array($result))
-{
-if($row['password']==$p)
-{
-$message="You have been logged in. Proceed to the Game.";
-setcookie("mrpg-ethbnd", strtolower($u . "@seperator@" . $p), time()+525600);
-}
-else
-{
-$message="Invalid username or password.";
-
-}
-}
-
-}
+if($_POST['u']!="") {
+ $u=addslashes($_POST['u']);
+ $p=addslashes($_POST['p']);
+ if($u!="" && $p!="") {
+ $sql="SELECT * FROM mrpg_users WHERE name='$u'";
+ $result = mysql_query($sql);
+ while($row = mysql_fetch_array($result)) {
+ if($row['password']==$p) {
+ $message="You have been logged in. Proceed to the Game.";
+ setcookie("mrpg-ethbnd", strtolower($u . "@seperator@" . $p), time()+525600);
+ } else {
+ $message="Invalid username or password.";
+ }
+ }
+ }
}
?>
-
-
diff --git a/lvlup.php b/lvlup.php
index 233e8f8..07a21e8 100644
--- a/lvlup.php
+++ b/lvlup.php
@@ -9,35 +9,30 @@ $credsYo=explode("@seperator@", $credsYo);
$u=strtolower($credsYo[0]);
$p=strtolower($credsYo[1]);
-if($u=="")
-{
-header("Location: index.php?login");
+if($u=="") {
+ header("Location: index.php?login");
}
$result = mysql_query("SELECT * FROM mrpg_users WHERE name='$u'");
-while($row = mysql_fetch_array($result))
-{
-
- if($row['password']!=$p)
- {
-header("Location: index.php");
-exit;
+while($row = mysql_fetch_array($result)) {
+ if($row['password']!=$p) {
+ header("Location: index.php");
+ exit;
}
}
$sql="SELECT * FROM mrpg_users WHERE name='$u'";
$result = mysql_query($sql);
-while($row = mysql_fetch_array($result))
-{
-$char['id']=$row['id'];
-$char['exp']=$row['level'];
-$mode=$row['mode'];
+while($row = mysql_fetch_array($result)) {
+ $char['id']=$row['id'];
+ $char['exp']=$row['level'];
+ $mode=$row['mode'];
}
if($mode!="lvlup") {
-header("Location: actions.php");
-exit;
+ header("Location: actions.php");
+ exit;
}
@@ -53,17 +48,17 @@ $newlvl=level(2, $char['exp']);
if($newlvl<=5) {
-$increase=2;
+ $increase=2;
} else if($newlvl>5 && $newlvl<=7) {
-$increase=4;
+ $increase=4;
} else if($newlvl>7 && $newlvl<=13) {
-$increase=6;
+ $increase=6;
} else if($newlvl>13 && $newlvl<=20) {
-$increase=8;
+ $increase=8;
} else if($newlvl>20 && $newlvl<=27) {
-$increase=10;
+ $increase=10;
} else {
-$increase=10;
+ $increase=10;
}
$nhp=rand(1, $increase);
@@ -87,7 +82,7 @@ $sql="UPDATE mrpg_stat SET
`strength`=`strength`+$nstrength,
`force`=`force`+$nforce
WHERE id='" . $char['id'] . "'";
-
+
mysql_query($sql);
@@ -126,7 +121,7 @@ imageString($fwim,5, $pos, $y+20, "Your level is now " . level(2, $char['exp']),
header('Content-type: image/png');
-imagejpeg($fwim);
-imageDestroy($fw);
+imagejpeg($fwim);
+imageDestroy($fw);
-?>
\ No newline at end of file
+?>
diff --git a/message.php b/message.php
index 3a9564e..1b2a056 100644
--- a/message.php
+++ b/message.php
@@ -10,72 +10,54 @@ $credsYo=explode("@seperator@", $credsYo);
$u=strtolower($credsYo[0]);
$p=strtolower($credsYo[1]);
-if($u=="")
-{
-header("Location: index.php?login");
-exit;
+if($u=="") {
+ header("Location: index.php?login");
+ exit;
}
$result = mysql_query("SELECT * FROM mrpg_users WHERE name='$u'");
-while($row = mysql_fetch_array($result))
-{
-
- if($row['password']!=$p)
- {
-header("Location: index.php");
-exit;
+while($row = mysql_fetch_array($result)) {
+ if($row['password']!=$p) {
+ header("Location: index.php");
+ exit;
}
}
-
-
-
$sql="SELECT * FROM mrpg_users WHERE name='$u'";
$result = mysql_query($sql);
-while($row = mysql_fetch_array($result))
-{
-$char['id']=$row['id'];
-$char['mode']=$row['mode'];
+while($row = mysql_fetch_array($result)) {
+ $char['id']=$row['id'];
+ $char['mode']=$row['mode'];
}
-
if($char['mode']!="message") {
-header("Location: actions.php");
-exit;
+ header("Location: actions.php");
+ exit;
}
$sql="SELECT * FROM mrpg_message WHERE id=" . $char['id'] . ";";
$result = mysql_query($sql);
-while($row = mysql_fetch_array($result))
-{
-$confirm['q']=$row['q'];
-$confirm['x']=$row['x'];
-$confirm['y']=$row['y'];
-
+while($row = mysql_fetch_array($result)) {
+ $confirm['q']=$row['q'];
+ $confirm['x']=$row['x'];
+ $confirm['y']=$row['y'];
}
if($_SERVER['QUERY_STRING']=="") {
-
-echo "
" . $confirm['q'] . "
-
+ echo "
" . $confirm['q'] . "
";
} else if($_SERVER['QUERY_STRING']=="yes") {
-$sql="UPDATE mrpg_users SET mode='norm', x=" . $confirm['x'] . ", y=" . $confirm['y'] . " WHERE id=" . $char['id'] . ";";
-mysql_query($sql);
+ $sql="UPDATE mrpg_users SET mode='norm', x=" . $confirm['x'] . ", y=" . $confirm['y'] . " WHERE id=" . $char['id'] . ";";
+ mysql_query($sql);
-header("Location: actions.php");
-exit;
+ header("Location: actions.php");
+ exit;
-}
+}
-
-
-
-
-
-?>
\ No newline at end of file
+?>
diff --git a/rantgraph.php b/rantgraph.php
deleted file mode 100644
index b28d361..0000000
--- a/rantgraph.php
+++ /dev/null
@@ -1,176 +0,0 @@
-$value) {
-$text[$key]=explode(":", $value);
-}
-$total=count($text)-1;
-$num=0;
-
-$graphdatshiz=array(0);
-$graphdatshizdates=array(0);
-while($num<=$total) {
-
-if($num!=$total) {
-
-
-
-//echo "" . date("m-d-Y h:i:s", $text[$num][0]+21600) . " | " . date("m-d-Y h:i:s", $text[$num+1][0]+21600) . " | : | ";
-
-
-
-$newb=$text[$num][1] - $text[$num+1][1];
-
-//$graphdatshizdates[]=$text[$num][0]+21600;
-
-$graphdatshizdates[]=$text[$num][0]-518400;
-
-
-
-if($newb<0) {
-$newb=abs($newb);
-
-
-}
-else
-{
-$newb=$newb*-1;
-}
-
-$graphdatshiz[]=$newb;
-
-
-//echo "$newb | \n";
-}
-
-
-$num++;
-}
-
-
-
-
-
-$width=count($graphdatshiz)*5;
-
-//$im=imageCreateTrueColor (round($width/3), 300);
-
-
-$im=imageCreateTrueColor ($width, 300);
-
-$white = imageColorAllocate ($im, 0xFF, 0xFF, 0xFF);
-$light = ImageColorAllocate ($im, 0xCC, 0xCC, 0xCC);
-$black = imageColorAllocate ($im, 0x00, 0x00, 0x00);
-$red = imageColorAllocate ($im, 0xFF, 0x00, 0x00);
-
-
-imageFill ($im, 1, 1, $white);
-
-
-$printx=25;
-
-while($printx<=$width) {
-imageLine ( $im, $printx, 0, $printx, 300, $light);
-$printx=$printx+5;
-}
-
-
-imageLine ( $im, 0, 1, $width, 1, $light);
-imageLine ( $im, 0, 50, $width, 50, $light);
-imageLine ( $im, 0, 100, $width, 100, $light);
-imageLine ( $im, 0, 150, $width, 150, $light);
-imageLine ( $im, 0, 200, $width, 200, $light);
-imageLine ( $im, 0, 250, $width, 250, $light);
-imageLine ( $im, 0, 298, $width, 299, $light);
-imageString($im,1, 1, 1, "3000", $black);
-imageString($im,1, 1, 47, "2500", $black);
-imageString($im,1, 1, 97, "2000", $black);
-imageString($im,1, 1, 147, "1500", $black);
-imageString($im,1, 1, 197, "1000", $black);
-imageString($im,1, 1, 247, "500", $black);
-imageString($im,1, 1, 290, "0", $black);
-
-
-imageString($im,3, 50, 1, "Graph of # of Rants on the Runescape forum per 10 minutes.", $black);
-imageString($im,3, 50, 10, "Large spikes are caused by removal of large threads by Jagex.", $black);
-
-imageRectangle ($im, 0, 0, $width-1, 299, $black);
-
-
-
-function drawpoint($x, $y) {
-
-global $black, $im, $red;
-
-imageSetPixel($im, $x, $y, $red);
-imageSetPixel($im, $x-1, $y, $red);
-imageSetPixel($im, $x+1, $y, $red);
-imageSetPixel($im, $x, $y-1, $red);
-imageSetPixel($im, $x, $y+1, $red);
-}
-
-
-//drawpoint(5,5);
-
-
-$x=25;
-$y=0;
-
-$previousX=25;
-$previousY=300;
-
-
-while($y<=count($graphdatshiz)) {
-
-
-$pos=300-abs(round($graphdatshiz[$y]/10));
-
-
-
-if(!(abs($previousY-$pos)>=1000))
-{
-imageLine ( $im, $previousX, $previousY, $x, $pos, $black);
-$previousX=$x;
-$previousY=$pos;
-}
-
-$date=$graphdatshizdates[$y];
-$olddate=$graphdatshizdates[($y-1)];
-
-$dateH=date("G", $date);
-$datemin=date("i", $date);
-
-$thedate=date("j", $date);
-$olddate=date("j", $olddate);
-
-/*if($dateH==0 && $datemin=="00") {*/
-
-if($thedate!=$olddate) {
-
-//imageString($im,1, $x-80, 290, "---" . date("m-d-Y", $date-86400) . "--><---" . date("m-d-Y", $date) . "-- $date -", $black);
-
-imageString($im,1, $x, 290, "<---" . $thedate . "th", $black);
-
-
-}
-
-//imageString($im,1, $x, 280, "<-----", $black);
-
-drawpoint($x,$pos);
-
-$x=$x+5;
-$y=$y+1;
-}
-
-
-
-header('Content-type: image/png');
-imagePNG ($im);
-imageDestroy ($im);
-
-//print_r($graphdatshiz);
-
-//print_r($graphdatshizdates);
-?>
\ No newline at end of file
diff --git a/rantread.php b/rantread.php
deleted file mode 100644
index 65df535..0000000
--- a/rantread.php
+++ /dev/null
@@ -1,47 +0,0 @@
- Rants $value) {
-
-
-$text[$key]=explode(":", $value);
-
-}
-
-$total=count($text)-1;
-
-$num=0;
-
-
-echo "Num | Raw Time | From | To | | Amount | \n";
-while($num<=$total) {
-
-
-if($num!=$total) {
-echo "$num | " . $text[$num][0] . " | " . date("m-d-Y h:i:s", $text[$num][0]+21600) . " | " . date("m-d-Y h:i:s", $text[$num+1][0]+21600) . " | : | ";
-
-
-
-$newb=$text[$num][1] - $text[$num+1][1];
-
-if($newb<0) {
-$newb=abs($newb);
-}
-else
-{
-$newb=$newb*-1;
-}
-
-echo "$newb | \n";
-}
-
-
-$num++;
-}
-
-echo " ";
-//print_r($text);
-?>
\ No newline at end of file
diff --git a/register.php b/register.php
index 2684291..0d562d2 100644
--- a/register.php
+++ b/register.php
@@ -7,100 +7,67 @@ function validname($input) {
}
-if($_POST['reg']==1)
-{
-if($_POST['username']=="" || $_POST['password']=="" || $_POST['password2']=="")
-{
-$message.="Fill out all the feilds. ";
+if($_POST['reg']==1) {
+ if($_POST['username']=="" || $_POST['password']=="" || $_POST['password2']=="") {
+ $message.="Fill out all the feilds. ";
+ } else {
+ $u=strtolower(addslashes($_POST['username']));
+ $p=strtolower(addslashes($_POST['password']));
+ $p2=strtolower(addslashes($_POST['password2']));
+
+ if(validname($u)=="false" || validname($p)=="false" || validname($p2)=="false") {
+ $message.="Invalid entries. 3-12 characters, Alpha-Numeric only. ";
+ } else {
+ if($p!=$p2) {
+ $message.="Passwords didn't match. ";
+ } else {
+ $result = mysql_query("SELECT * FROM mrpg_users WHERE name='$u'");
+ while($row = mysql_fetch_array($result)) {
+ $namecheck=$row['id'];
+ }
+
+ if($namecheck!="") {
+ $message.="Username is taken!. ";
+ } else {
+ //Register
+ $id=1;
+ $result = mysql_query("SELECT id FROM mrpg_users");
+ while($row = mysql_fetch_array($result)) {
+ if(($row['id']+1)>$id) {
+ $id=($row['id']+1);
+ }
+ }
+
+ mysql_query("INSERT INTO `mrpg_users` ( `id` , `name` , `password` , `x` , `y` , `dir` , `inventory` , `level` , `lastact` , `mode` )
+ VALUES (
+ '$id', '$u', '$p', '5', '3', '0', '', '0', '0', 'norm'
+ );");
+
+ mysql_query("INSERT INTO `mrpg_confirm` VALUES (
+ '$id', '', '0', '0', '0', '0'
+ );");
+
+ mysql_query("INSERT INTO `mrpg_message` VALUES (
+ '$id', '', '0', '0'
+ );");
+
+ mysql_query("INSERT INTO `mrpg_battles` ( `id` , `use` , `enemy` , `enemyhp` , `other` )
+ VALUES (
+ '$id', '0', '0', '0', ''
+ );");
+
+ mysql_query("INSERT INTO `mrpg_stat` ( `id` , `hp` , `maxhp` , `pp` , `offense` , `defense` , `fight` , `speed` , `wisdom` , `strength` , `force` , `poison` , `other` )
+ VALUES (
+ '$id', '20', '20', '5', '1', '1', '1', '1', '1', '1', '1', '0', '0'
+ );");
+
+ $message.="Registered! You can now play!";
+
+ }
+ }
+ }
+ }
}
-else
-{
-
-
-$u=strtolower(addslashes($_POST['username']));
-$p=strtolower(addslashes($_POST['password']));
-$p2=strtolower(addslashes($_POST['password2']));
-
-if(validname($u)=="false" || validname($p)=="false" || validname($p2)=="false")
-{
-$message.="Invalid entries. 3-12 characters, Alpha-Numeric only. ";
-}
-else
-{
-if($p!=$p2)
-{
-$message.="Passwords didn't match. ";
-}
-else
-{
-$result = mysql_query("SELECT * FROM mrpg_users WHERE name='$u'");
-while($row = mysql_fetch_array($result))
-{
-$namecheck=$row['id'];
-}
-
-if($namecheck!="")
-{
-$message.="Username is taken!. ";
-}
-else
-{
-//Register
-
-$id=0;
-$result = mysql_query("SELECT id FROM mrpg_users");
-while($row = mysql_fetch_array($result))
-{
-if(($row['id']+1)>$id)
-{
-$id=($row['id']+1);
-}
-
-}
-
-
-
-mysql_query("INSERT INTO `mrpg_users` ( `id` , `name` , `password` , `x` , `y` , `dir` , `inventory` , `level` , `lastact` , `mode` )
-VALUES (
-'$id', '$u', '$p', '5', '3', '0', '', '0', '0', 'norm'
-);");
-
-
-mysql_query("INSERT INTO `mrpg_confirm` VALUES (
-'$id', '', '0', '0', '0', '0'
-);");
-
-
-mysql_query("INSERT INTO `mrpg_message` VALUES (
-'$id', '', '0', '0'
-);");
-
-
-mysql_query("INSERT INTO `mrpg_battles` ( `id` , `use` , `enemy` , `enemyhp` , `other` )
-VALUES (
-'$id', '0', '0', '0', ''
-);");
-
-
-
-mysql_query("INSERT INTO `mrpg_stat` ( `id` , `hp` , `maxhp` , `pp` , `offense` , `defense` , `fight` , `speed` , `wisdom` , `strength` , `force` , `poison` , `other` )
-VALUES (
-'$id', '20', '20', '5', '1', '1', '1', '1', '1', '1', '1', '0', '0'
-);");
-
-
-
-$message.="Registered! You can now play!";
-
-
-
-}
-}
-}
-}
-}
-
-
?>
diff --git a/stat.php b/stat.php
index aac0128..2e73ad0 100644
--- a/stat.php
+++ b/stat.php
@@ -11,20 +11,17 @@ $p=$char['y'];
$result = mysql_query("SELECT * FROM mrpg_users WHERE name='$u'");
-while($row = mysql_fetch_array($result))
-{
-$uid=$row['id'];
-$x=$row['x'];
-$y=$row['y'];
+while($row = mysql_fetch_array($result)) {
+ $uid=$row['id'];
+ $x=$row['x'];
+ $y=$row['y'];
- if(md5($row['password'])!=$p)
- {
-header("Location: index.php");
-exit;
+ if(md5($row['password'])!=$p) {
+ header("Location: index.php");
+ exit;
}
}
makestatimage($uid);
-
-?>
\ No newline at end of file
+?>
diff --git a/stats.php b/stats.php
index 025a489..2184218 100644
--- a/stats.php
+++ b/stats.php
@@ -4,14 +4,14 @@ include("config.php");
$result = mysql_query("SELECT name,lastact FROM mrpg_users WHERE (" . date("U") . "-lastact)<=60");
-while($row = mysql_fetch_array($result))
-{
-$online.=ucfirst($row['name']) . ", ";
+while($row = mysql_fetch_array($result)) {
+ $online.=ucfirst($row['name']) . ", ";
}
if($online=="") {
-echo "None!";
+ echo "None!";
} else {
-echo $online;
+ echo $online;
}
-?>
\ No newline at end of file
+
+?>
diff --git a/walkable.php b/walkable.php
index ce0e7a7..d240b06 100644
--- a/walkable.php
+++ b/walkable.php
@@ -29,16 +29,13 @@ $walkable[61]=array(0,1,1,1,1,1,1,1,1,1,1,1,1,0,0);
$walkable[62]=array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
function walkable($x,$y) {
-global $walkable;
+ global $walkable;
-if($walkable[$y][$x]==1) {
-return true;
-} else {
-return false;
+ if($walkable[$y][$x]==1) {
+ return true;
+ } else {
+ return false;
+ }
}
-}
-
-
-
-?>
\ No newline at end of file
+?>
| |