Skip to content

Commit

Permalink
updated the SQL with default values, and other query fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
y4my4my4m committed Apr 9, 2018
1 parent 1c101c9 commit c0666c0
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
16 changes: 8 additions & 8 deletions db123450_merveilles.sql
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ DROP TABLE IF EXISTS `xiv_merveilles`;
CREATE TABLE `xiv_merveilles` (
`mv_name` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`mv_password` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`x` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`y` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`floor` int(11) DEFAULT NULL,
`x` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT '27',
`y` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT '41',
`floor` int(11) DEFAULT '1',
`max_floor` int(11) DEFAULT NULL,
`xp` int(11) DEFAULT NULL,
`hp` int(11) DEFAULT NULL,
`mp` int(11) DEFAULT NULL,
`hp` int(11) DEFAULT '30',
`mp` int(11) DEFAULT '30',
`kill` tinyint(1) DEFAULT NULL,
`save` varchar(11) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`message` varchar(11) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
Expand All @@ -42,7 +42,7 @@ CREATE TABLE `xiv_merveilles` (
`warp2` int(11) DEFAULT NULL,
`warp3` int(11) DEFAULT NULL,
`warp4` int(11) DEFAULT NULL,
`mv_time` int(11) DEFAULT NULL
`mv_time` int(11) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

Expand All @@ -61,7 +61,7 @@ CREATE TABLE `xiv_merveilles_monsters` (
`time` int(11) DEFAULT NULL,
`floor` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
Expand Down Expand Up @@ -94,4 +94,4 @@ CREATE TABLE `xiv_merveilles_special` (
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2018-04-10 0:04:54
-- Dump completed on 2018-04-10 1:39:28
4 changes: 2 additions & 2 deletions editor.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

session_start();
if(!$_SESSION['loggedin'] || !($_SESSION['name'] == 'fet' || $_SESSION['name'] == 'ika')) header('Location: ./login.php', true, 302);
if(!$_SESSION['loggedin'] || !($_SESSION['name'] == 'fet' || $_SESSION['name'] == 'ika' || $_SESSION['name'] == 'y4m')) header('Location: ./login.php', true, 302);

?><html>
<head>
Expand Down Expand Up @@ -48,4 +48,4 @@
MerveillesME_Init('editor_container', <?php echo json_encode($data) ?>);
</script>
</body>
</html>
</html>
1 change: 1 addition & 0 deletions levels/0-1.dat

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion levels/1-1.dat

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions map.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@


$resetUser = $_GET['User'];
$resetUser = ereg_replace("[^A-Za-z0-9]", "", $resetUser );
$resetUser = preg_replace("[^A-Za-z0-9]", "", $resetUser );
$resetUser = substr($resetUser,0,3);


print "<h1>Reset Player Location</h1><hr/>";

if($resetUser!=''){
$UPDATESQL = mysqli_query($db, "UPDATE xiv_merveilles SET floor = 2, x=27, y=41 WHERE mv_name='$resetUser'");
$UPDATESQL = mysqli_query($db, "UPDATE xiv_merveilles SET floor = 2, x=27, y=41 WHERE mv_name='".$resetUser."'");

print $resetUser;
print ' was warped to Fauns Nest';
Expand Down
6 changes: 3 additions & 3 deletions register.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
$name = strtolower(preg_replace("/[^A-Za-z0-9 ]/", '', $_POST['username']));
$pass = strtolower(preg_replace("/[^A-Za-z0-9 ]/", '', $_POST['password']));

$mysql = mysqli_query($db, "SELECT * FROM xiv_merveilles WHERE mv_name = '$name' AND mv_password = '$pass'");
$mysql = mysqli_query($db, "SELECT * FROM xiv_merveilles WHERE mv_name = '.$name.' AND mv_password = '.$pass.'");
if(mysqli_num_rows($mysql) > 0)
{
$_SESSION['loggedin'] = "YES";
Expand All @@ -32,7 +32,7 @@

// look for username

$mysql = mysqli_query($db, "SELECT * FROM xiv_merveilles WHERE mv_name = '$name'");
$mysql = mysqli_query($db, "SELECT * FROM xiv_merveilles WHERE mv_name = '.$name.'");
if(mysqli_num_rows($mysql) > 0)
{
die("Sorry, \"$name\" is already associated with a different password.");
Expand All @@ -43,7 +43,7 @@
$head = rand(2,13);
$body = rand(2,13);

$sql='insert into xiv_merveilles (mv_name,mv_password,x,y,avatar_head,avatar_body)values(\''.$name.'\',\''.$pass.'\', 30, 43, '.$head.', '.$body.')';
$sql="insert into xiv_merveilles (mv_name,mv_password,x,y,avatar_head,avatar_body)values('".$name."','".$pass."', 30, 43, ".$head.", ".$body.")";
$result=mysqli_query($db, $sql) or die(mysqli_error());
//$result=mysqli_query($sql);

Expand Down
10 changes: 5 additions & 5 deletions scripts/merveilles.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ function generateMap(&$square, $playerf, $players, &$logs, $downstairX = null, $
}
}

$request= 'SELECT x, y, message, to_floor as toFloor, to_x as toX, to_y as toY, image from xiv_merveilles_special where floor = '.$playerf;
$request= "SELECT x, y, message, to_floor as toFloor, to_x as toX, to_y as toY, image from xiv_merveilles_special where floor = '".$playerf."'";
$result = mysqli_query($db, $request) or die(mysqli_error($db));
while($row = mysqli_fetch_assoc($result))
{
Expand Down Expand Up @@ -309,7 +309,7 @@ function generateMap(&$square, $playerf, $players, &$logs, $downstairX = null, $
$row['hp']+= $heal;
if($row['hp'] > 30) $row['hp'] = 30;

mysqli_query($db, 'UPDATE xiv_merveilles SET hp = '.$row['hp'].' WHERE mv_name = \''.mysqli_real_escape_string($db, $row['mv_name']).'\'');
mysqli_query($db, "UPDATE xiv_merveilles SET hp='".$row['hp']."' WHERE mv_name='".mysqli_real_escape_string($db, $row['mv_name'])."'");

$playerxp+= $xp;
$playermp-= $mp;
Expand Down Expand Up @@ -402,8 +402,8 @@ function generateMap(&$square, $playerf, $players, &$logs, $downstairX = null, $
if(!isset($monsters[$reqY])) $monsters[$reqY] = array();
$monsters[$reqY][$reqX] = (string) $percentHealth; //maj directe de la carte
}
mysqli_query($db, 'DELETE FROM xiv_merveilles_monsters WHERE `floor` = '.$playerf.' AND x = '.$reqX.' AND y = '.$reqY);
mysqli_query($db, 'INSERT INTO xiv_merveilles_monsters (x, y, health, `time`, `floor`) VALUES ('.$reqX.','.$reqY.','.$percentHealth.', 10,'.$playerf.');');
mysqli_query($db, "DELETE FROM xiv_merveilles_monsters WHERE `floor` = '".$playerf."' AND x = '".$reqX."' AND y = '".$reqY."'");
mysqli_query($db, "INSERT INTO xiv_merveilles_monsters (x, y, health, `time`, `floor`) VALUES (".$reqX.",".$reqY.",".$percentHealth.", 10,".$playerf.");");

$information = array(
'type' => $battleresult,
Expand All @@ -424,7 +424,7 @@ function generateMap(&$square, $playerf, $players, &$logs, $downstairX = null, $
$background = 'backgrounds/'.$playerf.'-'.$players.'.gif';
if(!file_exists('./img/'.$background)) $background = 'world.gif';

mysqli_query($db,'UPDATE xiv_merveilles SET x = '.$playerx.', y = '.$playery.', xp = '.$playerxp.', hp = '.$playerhp.', mp = '.$playermp.', `kill` = '.$playerkp.', `save` = '.$playersv.', `floor` = '.$playerf.', max_floor = '.$playermf.', message = \''.mysqli_real_escape_string($db,$playermsg).'\', message_timestamp = '.$playermsgts.', mv_time = 0 WHERE mv_name= \''.$playern.'\'');
mysqli_query($db,"UPDATE xiv_merveilles SET x = ".$playerx.", y = ".$playery.", xp = ".$playerxp.", hp = ".$playerhp.", mp = ".$playermp.", `kill` = ".$playerkp.", `save` = ".$playersv.", `floor` = ".$playerf.", max_floor = ".$playermf.", message = '".mysqli_real_escape_string($db,$playermsg)."', message_timestamp = ".$playermsgts.", mv_time = 0 WHERE mv_name= '".$playern."'");

$data = array(
'status' => array(
Expand Down
9 changes: 4 additions & 5 deletions scripts/spellbook.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?
$offline = '';
$spell_unknown = "
$spell_unknown="
<div class='spell' id='cast2'>
<p class='spellname_unknown'>unknown</p>
<p>0mp</p>
Expand All @@ -10,12 +9,12 @@
if($_GET['cast']){

if($_GET['cast']=='3'&&$playermp>9){
$UPDATESQL = mysqli_query($db, "UPDATE xiv_merveilles SET floor = 4, x=29, y=29, mp=mp-10 WHERE mv_name='$playern'");
echo "<meta http-equiv='refresh' content='0;url=http://m0oo.com/mvl/portable.php'>";
$UPDATESQL = mysqli_query($db, "UPDATE xiv_merveilles SET floor=4, x=29, y=29, mp=mp-10 WHERE mv_name='".$playern."'");
echo "<meta http-equiv='refresh' content='0;url=/portable.php'>";
}

if($_GET['cast']=='1'&&$warp1>0){
$UPDATESQL = mysqli_query($db, "UPDATE xiv_merveilles SET floor = 10, x=21, y=12, mp=mp-5 WHERE mv_name='$playern' and x=21 and y=12 OR mv_name='$playern' and x=3 and y=45");
$UPDATESQL = mysqli_query($db, "UPDATE xiv_merveilles SET floor=10, x=21, y=12, mp=mp-5 WHERE mv_name='".$playern."' and x=21 and y=12 OR mv_name='".$playern."' and x=3 and y=45");
echo "<meta http-equiv='refresh' content='0;url=/portable.php'>";
}

Expand Down

0 comments on commit c0666c0

Please sign in to comment.