Skip to content

Commit

Permalink
php7 + recreated (All?) the tables in a SQL
Browse files Browse the repository at this point in the history
  • Loading branch information
y4my4my4m committed Apr 9, 2018
1 parent 73fd4de commit c65858a
Show file tree
Hide file tree
Showing 9 changed files with 159 additions and 42 deletions.
22 changes: 11 additions & 11 deletions connect.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?php

$db = mysql_connect("***", "***", "***") or die("Could not connect.");
$db = mysqli_connect("localhost", "root","YOURPASSWORD","db123450_merveilles") or die("Could not connect.");
if(!$db)
die("no db");
if(!mysql_select_db("db124350_merveilles",$db))
if(!mysqli_select_db($db,"db123450_merveilles"))
die("No database selected.");
if(!get_magic_quotes_gpc())
{
$_GET = array_map('mysql_real_escape_string', $_GET);
$_POST = array_map('mysql_real_escape_string', $_POST);
$_COOKIE = array_map('mysql_real_escape_string', $_COOKIE);
$_GET = array_map(array($db, 'real_escape_string'), $_GET);
$_POST = array_map(array($db, 'real_escape_string'), $_POST);
$_COOKIE = array_map(array($db, 'real_escape_string'), $_COOKIE);
}
else
{
$_GET = array_map('stripslashes', $_GET);
$_POST = array_map('stripslashes', $_POST);
$_GET = array_map('stripslashes', $_GET);
$_POST = array_map('stripslashes', $_POST);
$_COOKIE = array_map('stripslashes', $_COOKIE);
$_GET = array_map('mysql_real_escape_string', $_GET);
$_POST = array_map('mysql_real_escape_string', $_POST);
$_COOKIE = array_map('mysql_real_escape_string', $_COOKIE);
$_GET = array_map(array($db, 'real_escape_string'), $_GET);
$_POST = array_map(array($db, 'real_escape_string'), $_POST);
$_COOKIE = array_map(array($db, 'real_escape_string'), $_COOKIE);
}

?>
?>
97 changes: 97 additions & 0 deletions db123450_merveilles.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
-- MySQL dump 10.16 Distrib 10.1.31-MariaDB, for Linux (x86_64)
--
-- Host: localhost Database: db123450_merveilles
-- ------------------------------------------------------
-- Server version 10.1.31-MariaDB

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `xiv_merveilles`
--

DROP TABLE IF EXISTS `xiv_merveilles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
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,
`max_floor` int(11) DEFAULT NULL,
`xp` int(11) DEFAULT NULL,
`hp` int(11) DEFAULT NULL,
`mp` int(11) DEFAULT NULL,
`kill` tinyint(1) DEFAULT NULL,
`save` varchar(11) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`message` varchar(11) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`message_timestamp` datetime DEFAULT NULL,
`avatar_head` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`avatar_body` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`warp1` int(11) DEFAULT NULL,
`warp2` int(11) DEFAULT NULL,
`warp3` int(11) DEFAULT NULL,
`warp4` int(11) DEFAULT NULL,
`mv_time` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `xiv_merveilles_monsters`
--

DROP TABLE IF EXISTS `xiv_merveilles_monsters`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `xiv_merveilles_monsters` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`x` int(11) DEFAULT NULL,
`y` int(11) DEFAULT NULL,
`health` int(11) DEFAULT NULL,
`time` int(11) DEFAULT NULL,
`floor` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `xiv_merveilles_special`
--

DROP TABLE IF EXISTS `xiv_merveilles_special`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `xiv_merveilles_special` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`x` int(11) DEFAULT NULL,
`y` int(11) DEFAULT NULL,
`message` varchar(11) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`to_floor` int(11) DEFAULT NULL,
`to_x` int(11) DEFAULT NULL,
`to_y` int(11) DEFAULT NULL,
`image` int(11) DEFAULT NULL,
`floor` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2018-04-10 0:04:54
6 changes: 3 additions & 3 deletions login.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
if(isset($_SESSION['loggedin'])){die("<meta http-equiv='refresh' content='0; URL=portable.php'>");}

$online = 0;
$result = mysql_query("SELECT * from xiv_merveilles WHERE mv_time<10 ");
while($row = mysql_fetch_array($result))
//$result = mysqli_query("SELECT * from xiv_merveilles WHERE mv_time<10 ");
//while($row = mysqli_fetch_array($result))
{$online = $online+1;}


Expand Down Expand Up @@ -60,4 +60,4 @@
</div>

</body>
</html>
</html>
2 changes: 1 addition & 1 deletion map.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
print "<h1>Reset Player Location</h1><hr/>";

if($resetUser!=''){
$UPDATESQL = mysql_query("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
18 changes: 9 additions & 9 deletions register.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

session_start();
include 'connect.php';


$actions = "<meta http-equiv='refresh' content='0; URL=login.php'>";
$actions = "<meta http-equiv='refresh' content='0;url=login.php'>";

// Refresh and login if session loggedin

Expand All @@ -17,8 +15,8 @@
$name = strtolower(preg_replace("/[^A-Za-z0-9 ]/", '', $_POST['username']));
$pass = strtolower(preg_replace("/[^A-Za-z0-9 ]/", '', $_POST['password']));

$mysql = mysql_query("SELECT * FROM xiv_merveilles WHERE mv_name = '$name' AND mv_password = '$pass'");
if(mysql_num_rows($mysql) > 0)
$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";
$_SESSION['name'] = $name;
Expand All @@ -34,8 +32,8 @@

// look for username

$mysql = mysql_query("SELECT * FROM xiv_merveilles WHERE mv_name = '$name'");
if(mysql_num_rows($mysql) > 0)
$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 @@ -46,9 +44,11 @@
$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.')';
$result=mysql_query($sql) or die(mysql_error());
$result=mysqli_query($db, $sql) or die(mysqli_error());
//$result=mysqli_query($sql);

$_SESSION['loggedin'] = "YES";
$_SESSION['name'] = $name;
die("$actions");

?>
?>
4 changes: 2 additions & 2 deletions scripts/jsme/plugins/merveilles/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@


REQUIRE_ONCE('./../../../../connect.php');
mysql_query('DELETE from xiv_merveilles_monsters where floor = '.$floor);
mysqli_query('DELETE from xiv_merveilles_monsters where floor = '.$floor);

header('Location: ./../../../../editor.php?floor='.$floor, true, 302);

?>
?>
32 changes: 18 additions & 14 deletions scripts/merveilles.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ function generateMap(&$square, $playerf, $players, &$logs, $downstairX = null, $

$playern = $_SESSION['name'];

$request='SELECT * from xiv_merveilles where mv_name= \''.mysql_real_escape_string($playern).'\'';
$request2=mysql_query($request) or die("Could not get user stats");$u=mysql_fetch_array($request2);
$request="SELECT * from xiv_merveilles where mv_name='".mysqli_real_escape_string($db, $playern)."'";
$request2=mysqli_query($db, $request) or die("Could not get user stats");
$u=mysqli_fetch_array($request2);

// GET VARIABLES
$playerx = $u['x'];
Expand Down Expand Up @@ -181,8 +182,8 @@ 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;
$result = mysql_query($request) or die(mysql_error());
while($row = mysql_fetch_assoc($result))
$result = mysqli_query($db, $request) or die(mysqli_error($db));
while($row = mysqli_fetch_assoc($result))
{
$map[$row['y']][$row['x']] = $row;
}
Expand Down Expand Up @@ -256,10 +257,10 @@ function generateMap(&$square, $playerf, $players, &$logs, $downstairX = null, $
$playermsg = '';
}

$request= 'SELECT x, y, health from xiv_merveilles_monsters where floor = '.$playerf.' ORDER BY `time` DESC';
$result = mysql_query($request) or die(mysql_error());
$request= "SELECT x, y, health from xiv_merveilles_monsters where floor = '".$playerf."' ORDER BY `time` DESC";
$result = mysqli_query($db,$request) or die(mysqli_error($db));

while($row = mysql_fetch_assoc($result))
while($row = mysqli_fetch_assoc($result))
{
if($row['health'] == 0)
{
Expand All @@ -274,11 +275,14 @@ function generateMap(&$square, $playerf, $players, &$logs, $downstairX = null, $
}


$result = mysql_query('SELECT mv_name, x, y, `save`, `kill`, hp, xp, message, avatar_head, avatar_body from xiv_merveilles WHERE floor = '.$playerf.' AND mv_time < 10');


$result = mysqli_query($db, "SELECT mv_name, x, y, `save`, `kill`, hp, xp, message, avatar_head, avatar_body from xiv_merveilles WHERE floor = '".$playerf."' AND mv_time < 10");


$arrayPlayers = array();

while($row = mysql_fetch_assoc($result))
while($row = mysqli_fetch_assoc($result))
{
if(strtolower($row['mv_name']) == strtolower($playern)) continue;

Expand All @@ -305,7 +309,7 @@ function generateMap(&$square, $playerf, $players, &$logs, $downstairX = null, $
$row['hp']+= $heal;
if($row['hp'] > 30) $row['hp'] = 30;

mysql_query('UPDATE xiv_merveilles SET hp = '.$row['hp'].' WHERE mv_name = \''.mysql_real_escape_string($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 @@ -398,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
}
mysql_query('DELETE FROM xiv_merveilles_monsters WHERE `floor` = '.$playerf.' AND x = '.$reqX.' AND y = '.$reqY);
mysql_query('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 @@ -420,7 +424,7 @@ function generateMap(&$square, $playerf, $players, &$logs, $downstairX = null, $
$background = 'backgrounds/'.$playerf.'-'.$players.'.gif';
if(!file_exists('./img/'.$background)) $background = 'world.gif';

mysql_query('UPDATE xiv_merveilles SET x = '.$playerx.', y = '.$playery.', xp = '.$playerxp.', hp = '.$playerhp.', mp = '.$playermp.', `kill` = '.$playerkp.', `save` = '.$playersv.', `floor` = '.$playerf.', max_floor = '.$playermf.', message = \''.mysql_real_escape_string($playermsg).'\', message_timestamp = '.$playermsgts.', mv_time = 0 WHERE mv_name= \''.$playern.'\'');
mysqli_query('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($playermsg).'\', message_timestamp = '.$playermsgts.', mv_time = 0 WHERE mv_name= \''.$playern.'\'');

$data = array(
'status' => array(
Expand Down Expand Up @@ -461,4 +465,4 @@ function generateMap(&$square, $playerf, $players, &$logs, $downstairX = null, $
else{
$classClient ='clientPortable';
}
?>
?>
4 changes: 2 additions & 2 deletions scripts/spellbook.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
if($_GET['cast']){

if($_GET['cast']=='3'&&$playermp>9){
$UPDATESQL = mysql_query("UPDATE xiv_merveilles SET floor = 4, x=29, y=29, mp=mp-10 WHERE mv_name='$playern'");
$UPDATESQL = mysqli_query("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'>";
}

if($_GET['cast']=='1'&&$warp1>0){
$UPDATESQL = mysql_query("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("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=http://m0oo.com/mvl/portable.php'>";
}

Expand Down
16 changes: 16 additions & 0 deletions xiv_merveilles.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- MySQL dump 10.16 Distrib 10.1.31-MariaDB, for Linux (x86_64)
--
-- Host: localhost Database: xiv_merveilles
-- ------------------------------------------------------
-- Server version 10.1.31-MariaDB

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

0 comments on commit c65858a

Please sign in to comment.