diff options
author | Patrick Davison <snapwilliam@gmail.com> | 2011-12-28 11:22:58 -0800 |
---|---|---|
committer | Patrick Davison <snapwilliam@gmail.com> | 2011-12-28 11:22:58 -0800 |
commit | 509f7a404582e9a69810333d58adcbdca57ad652 (patch) | |
tree | d2ce1f57792de18b1d7a08b17ba892ed2a9b015e | |
parent | fcdb42e572af8a274c3cd6cd904d65bdd2c0ad6b (diff) | |
download | pathery-509f7a404582e9a69810333d58adcbdca57ad652.tar.xz |
Minor adjustments, chatfilter added to name-change.
-rw-r--r-- | includes/mapoftheday.php | 2 | ||||
-rw-r--r-- | pages/cp.php | 34 |
2 files changed, 29 insertions, 7 deletions
diff --git a/includes/mapoftheday.php b/includes/mapoftheday.php index 4112f94..8b1c262 100644 --- a/includes/mapoftheday.php +++ b/includes/mapoftheday.php @@ -1 +1 @@ -<?PHP
include_once('maps.php');
include_once('db.inc.php');
//Select from current day.
function getMapOfTheDay() {
$sql = "
select `ID`, `code` from `maps`
WHERE (
DAY(dateCreated) = DAY(NOW())
AND
MONTH(dateCreated) = MONTH(NOW())
AND
YEAR(dateCreated) = YEAR(NOW())
)
";
$result = mysql_query($sql);
//No map for today?
if (mysql_num_rows($result) == 0) {
// If you want to modify the maps created! This is the line
$map = GenerateMap(rand(13, 18), rand(10, 14), rand(6, 9));
$code = GenerateMapCode($map);
$sql = "INSERT INTO `maps` (`code`)
VALUES ('$code')";
mysql_query($sql);
$r['code'] = $code;
$r['map'] = $map;
$r['id'] = mysql_insert_id();
return $r;
}
$r['code'] = mysql_result($result, 0, 'code');
$r['map'] = GenerateMapByCode($r['code']);
$r['id'] = mysql_result($result, 0, 'ID');
return $r;
}
function mapOfTheDay($type = 1) {
$sql = "
select maps.ID, maps.code
FROM `mapOfTheDay`, `maps`
WHERE `mapDate` = CURDATE() AND
`mapType` = $type AND
mapID = maps.ID
";
$result = mysql_query($sql);
//No map for today?
if (mysql_num_rows($result) == 0) {
// If you want to modify the maps created! This is the line
//GenerateMap($rows, $cols, $rockchance, $numBlocks = -1, $cp = -1, $tp = -1) {
switch ($type) {
case 1: //Easy
$map = GenerateMap(13, 7, 12, rand(7,10), rand(0, 2), 0);
break;
case 2: //Normal
$map = GenerateMap(15, 9, 7, rand(11,13), rand(1,3) + rand(0,1), 0);
break;
case 3: //Hard
$map = GenerateMap(19, 9, rand(7, 9), rand(14,16), rand(2,5), rand(1,2));
break;
case 4: //Full random map
//Get the current day as int.
$numday = date('w');
$numday = intval($numday);
switch ($numday) {
case 0: //Sunday
//Thirty
$map = GenerateMap(
18, 14, 20 , //width, height, rocks
weight(30) , //Walls
weight(1) , //Checkpoints
weight(1) //Teleports
);
break;
case 1: //Monday
//Simple
$map = GenerateMap(
18, 9, 7 , //width, height, rocks
weight(15,16,17) , //Walls
weight(0) , //Checkpoints
weight(0) //Teleports
);
break;
case 2: //Tuesday
//ABC's
$map = GenerateMap(
19, 11, 12 , //width, height, rocks
weight(20,21,22,22,23) , //Walls
weight(3) , //Checkpoints
weight(0) //Teleports
);
break;
case 3: //Wednesday
//Tele Madness
$map = GenerateMap(
17, 12, 10 , //width, height, rocks
weight(17,18) , //Walls
weight(1) , //Checkpoints
weight(5) //Teleports
);
break;
case 4: //Thursday
//Rocky Maze
$map = GenerateMap(
19, 15, 5 , //width, height, rocks
weight(16,17,18) , //Walls
weight(1,2,2,2,3,3) , //Checkpoints
weight(0) //Teleports
);
break;
case 5: //Friday
//Side to Side
$map = GenerateMap(
26, 6, 12 , //width, height, rocks
weight(17,18,19) , //Walls
weight(2,2,2,3,3) , //Checkpoints
weight(3,3,3,4) //Teleports
);
break;
case 6: //Saturday
//Dual map
$dualmapa[] = "s???????????????????f";
$dualmapa[] = "s???????????????????f";
$dualmapa[] = "s???????????????????f";
$dualmapa[] = "s???????????????????f";
$dualmapa[] = "s???????????????????f";
$dualmapa[] = "s???????????????????f";
$dualmapa[] = "oqqqqqqqqqqqqqqqqqqqq";
$dualmapa[] = "oqqqqqqqqqqqqqqqqqqqq";
$dualmapb[] = "s???????????????????f";
$dualmapb[] = "s???????????????????f";
$dualmapb[] = "s???????????????????f";
$dualmapb[] = "s???????????????????f";
$dualmapb[] = "s???????????????????f";
$dualmapb[] = "s???????????????????f";
$dualmapa = insertPoint($dualmapa, 'abc');
$dualmapb = insertPoint($dualmapb, 'abc');
$dualmap = array_merge($dualmapa, $dualmapb);
$dualmap = insertPoint($dualmap, 'tu');
$myparams['checkpoints'] = 3;
$myparams['teleports'] = 1;
$myparams['rockchance'] = 9;
$myparams['walls'] = weight(20, 20, 21, 21, 22, 23);
$map = GenerateShapedMap($dualmap, $myparams);
break;
}
break;
default:
$map = GenerateMap(rand(13, 18), rand(10, 14), rand(6, 9));
break;
}
$code = GenerateMapCode($map);
$sql = "INSERT INTO `maps` (`code`)
VALUES ('$code')";
mysql_query($sql);
$mapID = mysql_insert_id();
$r['code'] = $code;
$r['map'] = $map;
$r['id'] = $mapID;
$sql = "INSERT INTO `mapOfTheDay` (`mapID`, `mapType`, `mapDate`)
VALUES ('$mapID', '$type', CURDATE()) ";
mysql_query($sql);
return $r;
}
$r['code'] = mysql_result($result, 0, 'code');
$r['map'] = GenerateMapByCode($r['code']);
$r['id'] = mysql_result($result, 0, 'ID');
return $r;
}
// RMA # CT1160811
// 97686
//Select from yesterday
function getYesterdaysMap() {
$sql = "
select `ID`, `code` from `maps`
WHERE (
DAY(dateCreated) = DAY(NOW()) - 1
AND
MONTH(dateCreated) = MONTH(NOW())
AND
YEAR(dateCreated) = YEAR(NOW())
)
";
$result = mysql_query($sql);
//No map for today?
if (mysql_num_rows($result) == 0) {
return -1;
}
$r['code'] = mysql_result($result, 0, 'code');
$r['id'] = mysql_result($result, 0, 'ID');
return $r;
}
?>
\ No newline at end of file +<?PHP
include_once('maps.php');
include_once('db.inc.php');
//Select from current day.
function getMapOfTheDay() {
$sql = "
select `ID`, `code` from `maps`
WHERE (
DAY(dateCreated) = DAY(NOW())
AND
MONTH(dateCreated) = MONTH(NOW())
AND
YEAR(dateCreated) = YEAR(NOW())
)
";
$result = mysql_query($sql);
//No map for today?
if (mysql_num_rows($result) == 0) {
// If you want to modify the maps created! This is the line
$map = GenerateMap(rand(13, 18), rand(10, 14), rand(6, 9));
$code = GenerateMapCode($map);
$sql = "INSERT INTO `maps` (`code`)
VALUES ('$code')";
mysql_query($sql);
$r['code'] = $code;
$r['map'] = $map;
$r['id'] = mysql_insert_id();
return $r;
}
$r['code'] = mysql_result($result, 0, 'code');
$r['map'] = GenerateMapByCode($r['code']);
$r['id'] = mysql_result($result, 0, 'ID');
return $r;
}
function mapOfTheDay($type = 1) {
$sql = "
select maps.ID, maps.code
FROM `mapOfTheDay`, `maps`
WHERE `mapDate` = CURDATE() AND
`mapType` = $type AND
mapID = maps.ID
";
$result = mysql_query($sql);
//No map for today?
if (mysql_num_rows($result) == 0) {
// If you want to modify the maps created! This is the line
//GenerateMap($rows, $cols, $rockchance, $numBlocks = -1, $cp = -1, $tp = -1) {
switch ($type) {
case 1: //Easy
$map = GenerateMap(13, 7, 12, rand(7,10), rand(0, 1), 0);
break;
case 2: //Normal
$map = GenerateMap(15, 9, 7, rand(11,13), rand(1,3) + rand(0,1), 0);
break;
case 3: //Hard
$map = GenerateMap(19, 9, rand(7, 9), rand(14,16), rand(2,5), rand(1,2));
break;
case 4: //Full random map
//Get the current day as int.
$numday = date('w');
$numday = intval($numday);
switch ($numday) {
case 0: //Sunday
//Thirty
$map = GenerateMap(
18, 14, 20 , //width, height, rocks
weight(30) , //Walls
weight(1) , //Checkpoints
weight(1) //Teleports
);
break;
case 1: //Monday
//Simple
$map = GenerateMap(
18, 9, 7 , //width, height, rocks
weight(15,16,17) , //Walls
weight(0) , //Checkpoints
weight(0) //Teleports
);
break;
case 2: //Tuesday
//ABC's
$map = GenerateMap(
19, 11, 12 , //width, height, rocks
weight(20,21,22,22,23) , //Walls
weight(3) , //Checkpoints
weight(0) //Teleports
);
break;
case 3: //Wednesday
//Tele Madness
$map = GenerateMap(
17, 12, 10 , //width, height, rocks
weight(17,18) , //Walls
weight(1) , //Checkpoints
weight(5) //Teleports
);
break;
case 4: //Thursday
//Rocky Maze
$map = GenerateMap(
19, 15, 5 , //width, height, rocks
weight(16,17,18) , //Walls
weight(1,2,2,2,3,3) , //Checkpoints
weight(0) //Teleports
);
break;
case 5: //Friday
//Side to Side
$map = GenerateMap(
26, 6, 12 , //width, height, rocks
weight(17,18,19) , //Walls
weight(2,2,2,3,3) , //Checkpoints
weight(3,3,3,4) //Teleports
);
break;
case 6: //Saturday
//Dual map
$dualmapa[] = "s???????????????????f";
$dualmapa[] = "s???????????????????f";
$dualmapa[] = "s???????????????????f";
$dualmapa[] = "s???????????????????f";
$dualmapa[] = "s???????????????????f";
$dualmapa[] = "s???????????????????f";
$dualmapa[] = "oqqqqqqqqqqqqqqqqqqqq";
$dualmapa[] = "oqqqqqqqqqqqqqqqqqqqq";
$dualmapb[] = "s???????????????????f";
$dualmapb[] = "s???????????????????f";
$dualmapb[] = "s???????????????????f";
$dualmapb[] = "s???????????????????f";
$dualmapb[] = "s???????????????????f";
$dualmapb[] = "s???????????????????f";
$dualmapa = insertPoint($dualmapa, 'abc');
$dualmapb = insertPoint($dualmapb, 'abc');
$dualmap = array_merge($dualmapa, $dualmapb);
$dualmap = insertPoint($dualmap, 'tu');
$myparams['checkpoints'] = 3;
$myparams['teleports'] = 1;
$myparams['rockchance'] = 9;
$myparams['walls'] = weight(20, 20, 21, 21, 22, 23);
$map = GenerateShapedMap($dualmap, $myparams);
break;
}
break;
default:
$map = GenerateMap(rand(13, 18), rand(10, 14), rand(6, 9));
break;
}
$code = GenerateMapCode($map);
$sql = "INSERT INTO `maps` (`code`)
VALUES ('$code')";
mysql_query($sql);
$mapID = mysql_insert_id();
$r['code'] = $code;
$r['map'] = $map;
$r['id'] = $mapID;
$sql = "INSERT INTO `mapOfTheDay` (`mapID`, `mapType`, `mapDate`)
VALUES ('$mapID', '$type', CURDATE()) ";
mysql_query($sql);
return $r;
}
$r['code'] = mysql_result($result, 0, 'code');
$r['map'] = GenerateMapByCode($r['code']);
$r['id'] = mysql_result($result, 0, 'ID');
return $r;
}
// RMA # CT1160811
// 97686
//Select from yesterday
function getYesterdaysMap() {
$sql = "
select `ID`, `code` from `maps`
WHERE (
DAY(dateCreated) = DAY(NOW()) - 1
AND
MONTH(dateCreated) = MONTH(NOW())
AND
YEAR(dateCreated) = YEAR(NOW())
)
";
$result = mysql_query($sql);
//No map for today?
if (mysql_num_rows($result) == 0) {
return -1;
}
$r['code'] = mysql_result($result, 0, 'code');
$r['id'] = mysql_result($result, 0, 'ID');
return $r;
}
?>
\ No newline at end of file diff --git a/pages/cp.php b/pages/cp.php index f5fd566..2abc6b4 100644 --- a/pages/cp.php +++ b/pages/cp.php @@ -16,15 +16,14 @@ function validatename($name) { return false;
if ($name != htmlentities($name))
return false;
- if (strlen($name) > 16)
+ if (strlen($name) > 14)
return false;
return true;
}
-$inputname = sql_clean($_POST['displayName']);
-
-if ($inputname) {
+if (isset($_POST['displayName'])) {
$inputname = sql_clean($_POST['displayName']);
+ $inputname = chatFilter($inputname);
$userID = $_SESSION['userID'];
if ($_SESSION['accepted'] == 1) {
@@ -49,12 +48,35 @@ $displayName = htmlspecialchars($_SESSION['displayName'], ENT_COMPAT | ENT_HTML5 <h2>Change your display name</h2>
<form action="cp" method="post" name="changename">
-<input type="text" size="20" maxlength="16" value="<?php echo $displayName ?>" name="displayName" class="forminput" />
+<input type="text" size="20" maxlength="14" value="<?php echo $displayName ?>" name="displayName" class="forminput" />
<input type="submit" value="Change name" class="forminput" />
</div>
</form>
<?php
+
+
+function chatFilter($chat) {
+ //cuss words
+ $chat = eregi_replace("fuck you", "i am moron", $chat);
+ $chat = eregi_replace("fuck", "dumb", $chat);
+
+
+ $chat = eregi_replace("asshole", "dumb", $chat);
+ $chat = eregi_replace("damnit", "dumb", $chat);
+ $chat = eregi_replace("damn", "dumb", $chat);
+ $chat = eregi_replace("cunt", "dumb", $chat);
+ $chat = eregi_replace("shit", "dumb", $chat);
+ $chat = eregi_replace("bitch", "dumb", $chat);
+ $chat = eregi_replace("sucks ass", "is dumb", $chat);
+ $chat = eregi_replace("suck ass", "is dumb", $chat);
+ $chat = eregi_replace("stfu", "shutup", $chat);
+ $chat = eregi_replace("omfg", "omg", $chat);
+ $chat = eregi_replace("fuk", "dumb", $chat);
+ return $chat;
+}
+
+
htmlFooter();
-?>
+?>
\ No newline at end of file |