mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-26 01:09:22 +02:00
Importing Znote AAC 1.5_SVN rev 168 to github.
This commit is contained in:
parent
78b1a429b8
commit
ba07284044
5
.htaccess
Normal file
5
.htaccess
Normal file
@ -0,0 +1,5 @@
|
||||
Options +FollowSymLinks
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ /characterprofile.php?name=$1
|
4
Znote AAC license.txt
Normal file
4
Znote AAC license.txt
Normal file
@ -0,0 +1,4 @@
|
||||
Meeh... I don't bother this. Its practically yours, do whatever you fucking want with it.
|
||||
I am Znote from otland.net, I created this acc. Please love me :D
|
||||
|
||||
Enjoy!
|
260
admin.php
Normal file
260
admin.php
Normal file
@ -0,0 +1,260 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||
protect_page();
|
||||
admin_only($user_data);
|
||||
// Encryption (if select field has $key 0, it will return false, so add $enc + $key will return 100, subtract and you get 0, not false).
|
||||
$enc = 100;
|
||||
// Don't bother to think about cross site scripting here, since they can't access the page unless they are admin anyway.
|
||||
|
||||
// start
|
||||
if (empty($_POST) === false) {
|
||||
// BAN system!
|
||||
if (!empty($_POST['ban_char']) && !empty($_POST['ban_type']) && !empty($_POST['ban_action']) && !empty($_POST['ban_reason']) && !empty($_POST['ban_time']) && !empty($_POST['ban_comment'])) {
|
||||
if (user_character_exist($_POST['ban_char'])) {
|
||||
|
||||
// Decrypt and store values
|
||||
$charname = $_POST['ban_char'];
|
||||
$typeid = (int)$_POST['ban_type'] - $enc;
|
||||
$actionid = (int)$_POST['ban_action'] - $enc;
|
||||
$reasonid = (int)$_POST['ban_type'] - $enc;
|
||||
$time = (int)$_POST['ban_time'] - $enc;
|
||||
$comment = $_POST['ban_comment'];
|
||||
//var_dump($charname, $typeid, $actionid, $reasonid, $time, $comment);
|
||||
|
||||
if (set_rule_violation($charname, $typeid, $actionid, $reasonid, $time, $comment)) {
|
||||
$errors[] = 'Violation entry has been set for '. $charname .'.';
|
||||
} else {
|
||||
$errors[] = 'Website character name: '. $config['website_char'] .' does not exist. Create this character name or configure another name in config.php';
|
||||
$errors[] = 'Website failed to recognize a character it can represent while inserting a rule violation.';
|
||||
}
|
||||
|
||||
} else {
|
||||
$errors[] = 'Character '. $_POST['ban_char'] .' does not exist.';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// delete character:
|
||||
if (empty($_POST['del_name']) === false) {
|
||||
if (user_character_exist($_POST['del_name'])) {
|
||||
user_delete_character(user_character_id($_POST['del_name']));
|
||||
$errors[] = 'Character '. $_POST['del_name'] .' permanently deleted.';
|
||||
} else {
|
||||
$errors[] = 'Character '. $_POST['del_name'] .' does not exist.';
|
||||
}
|
||||
}
|
||||
|
||||
// Reset password for char name
|
||||
if (empty($_POST['reset_pass']) === false && empty($_POST['new_pass']) === false) {
|
||||
// reset_pass = character name
|
||||
if (user_character_exist($_POST['reset_pass'])) {
|
||||
$acc_id = user_character_account_id($_POST['reset_pass']);
|
||||
|
||||
if ($acc_id != $session_user_id) {
|
||||
if ($config['TFSVersion'] == 'TFS_02') {
|
||||
user_change_password($acc_id, $_POST['new_pass']);
|
||||
} else if ($config['TFSVersion'] == 'TFS_03') {
|
||||
user_change_password03($acc_id, $_POST['new_pass']);
|
||||
}
|
||||
$errors[] = 'The password to the account of character name: '. $_POST['reset_pass'] .' has been set to: '. $_POST['new_pass'] .'.';
|
||||
} else {
|
||||
header('Location: changepassword.php');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Give points to character
|
||||
if (empty($_POST['points_char']) === false && empty($_POST['points_value']) === false) {
|
||||
// fetch account id
|
||||
$char = $_POST['points_char'];
|
||||
$points = $_POST['points_value'];
|
||||
$accid = user_character_account_id($char);
|
||||
if ($points > 0) {
|
||||
if ($accid > 0) {
|
||||
$new_points = $points;
|
||||
$old_points = mysql_result(mysql_query("SELECT `points` FROM `znote_accounts` WHERE `account_id`='$accid';"), 0, 'points');
|
||||
$new_points += $old_points;
|
||||
$update_account = mysql_query("UPDATE `znote_accounts` SET `points`='$new_points' WHERE `account_id`='$accid'");
|
||||
$errors[] = 'Success! Character '. $char .' has recieved '. $points .' premium points.';
|
||||
} else $errors[] = 'Account id is invalid. (Did you write correct character name?)'. $accid;
|
||||
} else $errors[] = 'Why the heck give a character 0 points?!';
|
||||
}*/
|
||||
|
||||
// Give points to character
|
||||
if (empty($_POST['points_char']) === false && empty($_POST['points_value']) === false) {
|
||||
$char = sanitize($_POST['points_char']);
|
||||
$points = (int)$_POST['points_value'];
|
||||
data_dump($_POST, false, "post data");
|
||||
$account = mysql_select_single("SELECT `account_id` FROM `players` WHERE `name`='$char' LIMIT 1;");
|
||||
data_dump($account, false, "fetching account id from players table");
|
||||
$znote_account = mysql_select_single("SELECT `id`, `points` FROM `znote_accounts` WHERE `account_id`='". $account['account_id'] ."';");
|
||||
data_dump($znote_account, false, "Fetching existing points from znote_accounts");
|
||||
|
||||
data_dump(
|
||||
array(
|
||||
'Old:' => $znote_account['points'],
|
||||
'New:' => $points,
|
||||
'Total:' => ($znote_account['points'] + $points)
|
||||
),
|
||||
false,
|
||||
"Points calculation:");
|
||||
$points += $znote_account['points'];
|
||||
mysql_update("UPDATE `znote_accounts` SET `points`='$points' WHERE `account_id`='". $account['account_id'] ."';");
|
||||
}
|
||||
|
||||
// Set character position
|
||||
if (empty($_POST['position_name']) === false && empty($_POST['position_type']) === false) {
|
||||
if (user_character_exist($_POST['position_name'])) {
|
||||
if (array_key_exists($_POST['position_type'], $config['ingame_positions'])) {
|
||||
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
|
||||
set_ingame_position($_POST['position_name'], $_POST['position_type']);
|
||||
} else if ($config['TFSVersion'] == 'TFS_03') {
|
||||
set_ingame_position03($_POST['position_name'], $_POST['position_type']);
|
||||
}
|
||||
$pos = 'Undefined';
|
||||
foreach ($config['ingame_positions'] as $key=>$value) {
|
||||
if ($key == $_POST['position_type']) {
|
||||
$pos = $value;
|
||||
}
|
||||
}
|
||||
$errors[] = 'Character '. $_POST['position_name'] .' recieved the ingame position: '. $pos .'.';
|
||||
}
|
||||
} else {
|
||||
$errors[] = 'Character '. $_POST['position_name'] .' does not exist.';
|
||||
}
|
||||
}
|
||||
|
||||
// If empty post
|
||||
}
|
||||
|
||||
// Display whatever output we figure out to add
|
||||
if (empty($errors) === false){
|
||||
echo '<font color="red"><b>';
|
||||
echo output_errors($errors);
|
||||
echo '</b></font>';
|
||||
}
|
||||
// end
|
||||
?>
|
||||
<h1>Admin Page.</h1>
|
||||
<p>
|
||||
<?php
|
||||
$basic = user_znote_data('version', 'installed', 'cached');
|
||||
if ($basic['version'] !== $version) {
|
||||
mysql_query("UPDATE `znote` SET `version`='$version';") or die(mysql_error());
|
||||
$basic = user_znote_data('version', 'installed', 'cached');
|
||||
}
|
||||
echo "Running Znote AAC Version: ". $basic['version'] .".<br>";
|
||||
echo "Last cached on: ". getClock($basic['cached'], true) .".<br>";
|
||||
?>
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<b>Permanently Delete/erase character from database:</b>
|
||||
<form type="submit" action="" method="post">
|
||||
<input type="text" name="del_name" placeholder="Character name...">
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
<b>Ban/violate :3 character and/or his account:</b>
|
||||
<form action="" method="post">
|
||||
<table style="background-color:lightblue;">
|
||||
<!-- row 1 -->
|
||||
<tr>
|
||||
<td>
|
||||
<input type="text" name="ban_char" placeholder="Character name...">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- row 2 -->
|
||||
<tr>
|
||||
<td>
|
||||
<select name="ban_type">
|
||||
<?php
|
||||
foreach ($config['ban_type'] as $key=>$value) {
|
||||
echo "<option value=\"". ($enc + $key) ."\">". $value ."</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<select name="ban_action">
|
||||
<?php
|
||||
foreach ($config['ban_action'] as $key=>$value) {
|
||||
echo "<option value=\"". ($enc + $key) ."\">". $value ."</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<select name="ban_time">
|
||||
<?php
|
||||
foreach ($config['ban_time'] as $key=>$value) {
|
||||
echo "<option value=\"". ($enc + $key) ."\">". $value ."</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- row 3 -->
|
||||
<tr>
|
||||
<td>
|
||||
Ban reason:
|
||||
<select name="ban_reason">
|
||||
<?php
|
||||
foreach ($config['ban_reason'] as $key=>$value) {
|
||||
echo "<option value=\"". ($enc + $key) ."\">". $value ."</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- row 4 -->
|
||||
<tr>
|
||||
<td>
|
||||
Violation comment: (max 60 cols).
|
||||
<input type="text" name="ban_comment" maxlength="60" placeholder="Ban for botting rotworms.">
|
||||
<input type="submit" value="Set Violation">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
<b>Reset password to the account of character name:</b>
|
||||
<form action="" method="post">
|
||||
<input type="text" name="reset_pass" placeholder="Character name">
|
||||
<input type="text" name="new_pass" placeholder="New password">
|
||||
<input type="submit" value="Change Password">
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
<b>Set character name to position:</b>
|
||||
<?php
|
||||
if ($config['TFSVersion'] == 'TFS_03' && count($config['ingame_positions']) == 5) {
|
||||
?>
|
||||
<font color="red">ERROR: You forgot to add (Senior Tutor) rank in config.php!</font>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<input type="text" name="position_name" placeholder="Character name">
|
||||
<select name="position_type">
|
||||
<?php
|
||||
foreach ($config['ingame_positions'] as $key=>$value) {
|
||||
echo "<option value=\"". $key ."\">". $value ."</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<input type="submit" value="Set Position">
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
<b>Give shop points to character:</b>
|
||||
<form action="" method="post">
|
||||
<input type="text" name="points_char" placeholder="Character name">
|
||||
<input type="text" name="points_value" placeholder="Points">
|
||||
<input type="submit" value="Give Points">
|
||||
</form>
|
||||
</li>
|
||||
</ul>
|
||||
<div id="twitter"><?php include 'twtrNews.php'; ?></div>
|
||||
|
||||
<?php include 'layout/overall/footer.php'; ?>
|
122
admin_gallery.php
Normal file
122
admin_gallery.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||
protect_page();
|
||||
admin_only($user_data);
|
||||
// start
|
||||
|
||||
// Delete
|
||||
if (isset($_POST['delete'])) {
|
||||
$data = explode(":", $_POST['delete']);
|
||||
echo 'Image '. $data[0] .' deleted.';
|
||||
updateImage($data[0], 3);
|
||||
}
|
||||
|
||||
// Accept
|
||||
if (isset($_POST['accept'])) {
|
||||
$data = explode(":", $_POST['accept']);
|
||||
echo 'Image '. $data[0] .' accepted and is now public.';
|
||||
updateImage($data[0], 2);
|
||||
}
|
||||
|
||||
// Wether we accept or delete, re-create the cache
|
||||
if (isset($_POST['accept']) || isset($_POST['delete'])) {
|
||||
$cache = new Cache('engine/cache/gallery');
|
||||
$images = fetchImages(2);
|
||||
if ($images != false) {
|
||||
$data = array();
|
||||
foreach ($images as $image) {
|
||||
$row['title'] = $image['title'];
|
||||
$row['desc'] = $image['desc'];
|
||||
$row['date'] = $image['date'];
|
||||
$row['image'] = $image['image'];
|
||||
$data[] = $row;
|
||||
}
|
||||
} else $data = "";
|
||||
$cache->setContent($data);
|
||||
$cache->save();
|
||||
}
|
||||
|
||||
?><h1>Images in need of moderation:</h1><?php
|
||||
$images = fetchImages(1);
|
||||
if ($images != false) {
|
||||
foreach($images as $image) {
|
||||
$pw = explode("!", $image['image']);
|
||||
?>
|
||||
<table>
|
||||
<tr class="yellow">
|
||||
<td><h2><?php echo $image['title']; ?><form action="" method="post"><input type="submit" name="accept" value="<?php echo $image['id']; ?>:Accept Image"/></form><form action="" method="post"><input type="submit" name="delete" value="<?php echo $image['id']; ?>:Delete Image"/></form></h2></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?php echo 'http://'. $pw[0] .'.imgland.net/'. $pw[1] .'.'. $pw[2]; ?>"><img src="<?php echo 'http://'. $pw[0] .'.imgland.net/'. $pw[1] .'.'. $pw[2]; ?>" width="650"/></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
$descr = str_replace("\\r", "", $image['desc']);
|
||||
$descr = str_replace("\\n", "<br />", $descr);
|
||||
?>
|
||||
<p><?php echo $descr; ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php }
|
||||
} else echo '<h2>All good, no new images to moderate.</h2>';
|
||||
|
||||
?><h1>Public Images:</h1><?php
|
||||
$images = fetchImages(2);
|
||||
if ($images != false) {
|
||||
foreach($images as $image) {
|
||||
$pw = explode("!", $image['image']);
|
||||
?>
|
||||
<table>
|
||||
<tr class="yellow">
|
||||
<td><h2><?php echo $image['title']; ?><form action="" method="post"><input type="submit" name="delete" value="<?php echo $image['id']; ?>:Delete Image"/></form></h2></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?php echo 'http://'. $pw[0] .'.imgland.net/'. $pw[1] .'.'. $pw[2]; ?>"><img src="<?php echo 'http://'. $pw[0] .'.imgland.net/'. $pw[1] .'.'. $pw[2]; ?>" width="650"/></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
$descr = str_replace("\\r", "", $image['desc']);
|
||||
$descr = str_replace("\\n", "<br />", $descr);
|
||||
?>
|
||||
<p><?php echo $descr; ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php }
|
||||
} else echo '<h2>There are currently no public images.</h2>';
|
||||
|
||||
?><h1>Deleted Images:</h1><?php
|
||||
$images = fetchImages(3);
|
||||
if ($images != false) {
|
||||
foreach($images as $image) {
|
||||
$pw = explode("!", $image['image']);
|
||||
?>
|
||||
<table>
|
||||
<tr class="yellow">
|
||||
<td><h2><?php echo $image['title']; ?><form action="" method="post"><input type="submit" name="accept" value="<?php echo $image['id']; ?>:Recover Image"/></form></h2></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?php echo 'http://'. $pw[0] .'.imgland.net/'. $pw[1] .'.'. $pw[2]; ?>"><img src="<?php echo 'http://'. $pw[0] .'.imgland.net/'. $pw[1] .'.'. $pw[2]; ?>" width="650"/></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
$descr = str_replace("\\r", "", $image['desc']);
|
||||
$descr = str_replace("\\n", "<br />", $descr);
|
||||
?>
|
||||
<p><?php echo $descr; ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php }
|
||||
} else echo '<h2>There are currently no deleted images.</h2>';
|
||||
// end
|
||||
include 'layout/overall/footer.php'; ?>
|
157
admin_news.php
Normal file
157
admin_news.php
Normal file
@ -0,0 +1,157 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||
protect_page();
|
||||
admin_only($user_data);
|
||||
// Recieving POST
|
||||
if (empty($_POST) === false) {
|
||||
list($action, $id) = explode('!', sanitize($_POST['option']));
|
||||
|
||||
// Delete
|
||||
if ($action === 'd') {
|
||||
echo '<font color="green"><b>News deleted!</b></font>';
|
||||
mysql_query("DELETE FROM `znote_news` WHERE `id`='$id';");
|
||||
$cache = new Cache('engine/cache/news');
|
||||
$news = fetchAllNews();
|
||||
$cache->setContent($news);
|
||||
$cache->save();
|
||||
}
|
||||
// Add news
|
||||
if ($action === 'a') {
|
||||
// fetch data
|
||||
$char_array = user_character_list($user_data['id']);
|
||||
?>
|
||||
|
||||
<form action="" method="post">
|
||||
<input type="hidden" name="option" value="i!0">
|
||||
Select character:<select name="selected_char">
|
||||
<?php
|
||||
$count = 0;
|
||||
if ($char_array !== false) {
|
||||
foreach ($char_array as $name) {
|
||||
$name = $name['name'];
|
||||
$charD = user_character_data(user_character_id($name), 'group_id', 'id');
|
||||
if ($charD['group_id'] > 1) {
|
||||
echo '<option value="'. user_character_id($name) .'">'. $name .'</option>';
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<input type="text" name="title" value="" placeholder="Title"><br />
|
||||
<textarea name="text" cols="75" rows="10" placeholder="Contents..."></textarea><br />
|
||||
<input type="submit" value="Create News">
|
||||
</form>
|
||||
<br>
|
||||
<p>
|
||||
[b]<b>Bold Text</b>[/b]<br>
|
||||
[size=5]Size 5 text[/size]<br>
|
||||
[img]<a href="http://www.imgland.net/" target="_BLANK">Direct Image Link</a>[/img]<br>
|
||||
[center]Cented Text[/center]<br>
|
||||
[link]<a href="http://youtube.com/" target="_BLANK">http://youtube.com/</a>[/link]<br>
|
||||
[link=http://youtube.com/]<a href="http://youtube.com/" target="_BLANK">Click to View youtube</a>[/link]<br>
|
||||
[color=<font color="green">GREEN</font>]<font color="green">Green Text!</font>[/color]<br>
|
||||
[*]* Noted text [/*]
|
||||
</p>
|
||||
|
||||
<?php
|
||||
if ($count === 0) echo "<font size='6' color='red'>ERROR: NO GMs or Tutors on this account!</font>";
|
||||
}
|
||||
// Insert news
|
||||
if ($action === 'i') {
|
||||
echo '<font color="green"><b>News created successfully!</b></font>';
|
||||
list($charid, $title, $text) = array((int)$_POST['selected_char'], mysql_real_escape_string($_POST['title']), mysql_real_escape_string($_POST['text']));
|
||||
$date = time();
|
||||
mysql_query("INSERT INTO `znote_news` (`title`, `text`, `date`, `pid`) VALUES ('$title', '$text', '$date', '$charid');");
|
||||
// Reload the cache.
|
||||
$cache = new Cache('engine/cache/news');
|
||||
$news = fetchAllNews();
|
||||
$cache->setContent($news);
|
||||
$cache->save();
|
||||
}
|
||||
// Save
|
||||
if ($action === 's') {
|
||||
echo '<font color="green"><b>News successfully updated!</b></font>';
|
||||
list($title, $text) = array(mysql_real_escape_string($_POST['title']), mysql_real_escape_string($_POST['text']));
|
||||
mysql_query("UPDATE `znote_news` SET `title`='$title',`text`='$text' WHERE `id`='$id';") or die("FUCK!");
|
||||
$cache = new Cache('engine/cache/news');
|
||||
$news = fetchAllNews();
|
||||
$cache->setContent($news);
|
||||
$cache->save();
|
||||
}
|
||||
// Edit
|
||||
if ($action === 'e') {
|
||||
$news = fetchAllNews();
|
||||
$edit = array();
|
||||
foreach ($news as $n) if ($n['id'] == $id) $edit = $n;
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<input type="hidden" name="option" value="s!<?php echo $id; ?>">
|
||||
<input type="text" name="title" value="<?php echo $edit['title']; ?>"><br />
|
||||
<textarea name="text" cols="75" rows="10"><?php echo $edit['text']; ?></textarea><br />
|
||||
<input type="submit" value="Save Changes">
|
||||
</form>
|
||||
<br>
|
||||
<p>
|
||||
[b]<b>Bold Text</b>[/b]<br>
|
||||
[size=5]Size 5 text[/size]<br>
|
||||
[img]<a href="http://www.imgland.net/" target="_BLANK">Direct Image Link</a>[/img]<br>
|
||||
[center]Cented Text[/center]<br>
|
||||
[link]<a href="http://youtube.com/" target="_BLANK">http://youtube.com/</a>[/link]<br>
|
||||
[link=http://youtube.com/]<a href="http://youtube.com/" target="_BLANK">Click to View youtube</a>[/link]<br>
|
||||
[color=<font color="green">GREEN</font>]<font color="green">Green Text!</font>[/color]<br>
|
||||
[*]* Noted text [/*]
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<h1>News admin panel</h1>
|
||||
<form action="" method="post">
|
||||
<input type="hidden" name="option" value="a!0">
|
||||
<input type="submit" value="Create new article">
|
||||
</form>
|
||||
<?php
|
||||
// pre stuff
|
||||
$news = fetchAllNews();
|
||||
if ($news !== false) {
|
||||
?>
|
||||
<table id="news">
|
||||
<tr class="yellow">
|
||||
<td>Date</td>
|
||||
<td>By</td>
|
||||
<td>Title</td>
|
||||
<td>Edit</td>
|
||||
<td>Delete</td>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($news as $n) {
|
||||
echo '<tr>';
|
||||
echo '<td>'. getClock($n['date'], true) .'</td>';
|
||||
echo '<td><a href="characterprofile.php?name='. $n['name'] .'">'. $n['name'] .'</a></td>';
|
||||
echo '<td>'. $n['title'] .'</td>';
|
||||
echo '<td>';
|
||||
// edit
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<input type="hidden" name="option" value="e!<?php echo $n['id']; ?>">
|
||||
<input type="submit" value="Edit">
|
||||
</form>
|
||||
<?php
|
||||
echo '</td>';
|
||||
echo '<td>';
|
||||
// delete
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<input type="hidden" name="option" value="d!<?php echo $n['id']; ?>">
|
||||
<input type="submit" value="Delete">
|
||||
</form>
|
||||
<?php
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
include 'layout/overall/footer.php'; ?>
|
143
admin_skills.php
Normal file
143
admin_skills.php
Normal file
@ -0,0 +1,143 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||
protect_page();
|
||||
admin_only($user_data);
|
||||
// start
|
||||
|
||||
// PREP: Create a function that echos player skills
|
||||
function playerSkill($skills, $id) {
|
||||
if (!$skills) return 0;
|
||||
else {
|
||||
return $skills[$id]['value'];
|
||||
}
|
||||
}
|
||||
|
||||
// UPDATE SKILLS POST
|
||||
if (isset($_POST['pid']) && (int)$_POST['pid'] > 0) {
|
||||
$pid = (int)$_POST['pid'];
|
||||
if ($config['TFSVersion'] != 'TFS_10') $status = user_is_online($pid);
|
||||
else $status = user_is_online_10($pid);
|
||||
if (!$status) {
|
||||
if ($config['TFSVersion'] != 'TFS_10') {
|
||||
mysql_update("UPDATE `player_skills` SET `value`='". (int)$_POST['fist'] ."' WHERE `player_id`='$pid' AND `skillid`='0' LIMIT 1;");
|
||||
mysql_update("UPDATE `player_skills` SET `value`='". (int)$_POST['club'] ."' WHERE `player_id`='$pid' AND `skillid`='1' LIMIT 1;");
|
||||
mysql_update("UPDATE `player_skills` SET `value`='". (int)$_POST['sword'] ."' WHERE `player_id`='$pid' AND `skillid`='2' LIMIT 1;");
|
||||
mysql_update("UPDATE `player_skills` SET `value`='". (int)$_POST['axe'] ."' WHERE `player_id`='$pid' AND `skillid`='3' LIMIT 1;");
|
||||
mysql_update("UPDATE `player_skills` SET `value`='". (int)$_POST['dist'] ."' WHERE `player_id`='$pid' AND `skillid`='4' LIMIT 1;");
|
||||
mysql_update("UPDATE `player_skills` SET `value`='". (int)$_POST['shield'] ."' WHERE `player_id`='$pid' AND `skillid`='5' LIMIT 1;");
|
||||
mysql_update("UPDATE `player_skills` SET `value`='". (int)$_POST['fish'] ."' WHERE `player_id`='$pid' AND `skillid`='6' LIMIT 1;");
|
||||
mysql_update("UPDATE `players` SET `maglevel`='". (int)$_POST['magic'] ."' WHERE `id`='$pid' LIMIT 1;");
|
||||
mysql_update("UPDATE `players` SET `level`='". (int)$_POST['level'] ."' WHERE `id`='$pid' LIMIT 1;");
|
||||
mysql_update("UPDATE `players` SET `experience`='". level_to_experience((int)$_POST['level']) ."' WHERE `id`='$pid' LIMIT 1;");
|
||||
} else {
|
||||
mysql_update("UPDATE `players` SET `skill_fist`='". (int)$_POST['fist'] ."', `skill_club`='". (int)$_POST['club'] ."', `skill_sword`='". (int)$_POST['sword'] ."', `skill_axe`='". (int)$_POST['axe'] ."', `skill_dist`='". (int)$_POST['dist'] ."', `skill_shielding`='". (int)$_POST['shield'] ."', `skill_fishing`='". (int)$_POST['fish'] ."', `maglevel`='". (int)$_POST['magic'] ."', `level`='". (int)$_POST['level'] ."', `experience`='". level_to_experience((int)$_POST['level']) ."' WHERE `id`='$pid' LIMIT 1;");
|
||||
}
|
||||
?>
|
||||
<h1>Player skills updated!</h1>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<font color="red" size="7">Player must be offline!</font>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
// Stage 1: Fetch name
|
||||
if (isset($_GET['name'])) {
|
||||
$name = getValue($_GET['name']);
|
||||
} else $name = false;
|
||||
//if (isset($_POST['name'])) $name = getValue($_POST['name']);
|
||||
|
||||
// Stage 2: Fetch user id and skills
|
||||
$skills = false;
|
||||
$pid = 0;
|
||||
if ($name !== false) {
|
||||
if (user_character_exist($name)) {
|
||||
$pid = user_character_id($name);
|
||||
|
||||
if ($config['TFSVersion'] != 'TFS_10') {
|
||||
$skills = mysql_select_multi("SELECT `value` FROM `player_skills` WHERE `player_id`='$pid' LIMIT 7;");
|
||||
$player = mysql_select_single("SELECT `maglevel`, `level` FROM `players` WHERE `id`='$pid' LIMIT 1;");
|
||||
$skills[] = array('value' => $player['maglevel']);
|
||||
$skills[] = array('value' => $player['level']);
|
||||
} else {
|
||||
$player = mysql_select_single("SELECT `skill_fist`, `skill_club`, `skill_sword`, `skill_axe`, `skill_dist`, `skill_shielding`, `skill_fishing`, `maglevel`, `level` FROM `players` WHERE `id`='$pid' LIMIT 1;");
|
||||
$skills = array(
|
||||
0 => array('value' => $player['skill_fist']),
|
||||
1 => array('value' => $player['skill_club']),
|
||||
2 => array('value' => $player['skill_sword']),
|
||||
3 => array('value' => $player['skill_axe']),
|
||||
4 => array('value' => $player['skill_dist']),
|
||||
5 => array('value' => $player['skill_shielding']),
|
||||
6 => array('value' => $player['skill_fishing']),
|
||||
7 => array('value' => $player['maglevel']),
|
||||
8 => array('value' => $player['level']),
|
||||
);
|
||||
}
|
||||
|
||||
//data_dump($skills, false, "Player skills");
|
||||
} else $name = false;
|
||||
}
|
||||
|
||||
?>
|
||||
<form action="" method="<?php if (!$name) echo "get"; else echo "post";?>">
|
||||
<input type="hidden" name="pid" value="<?php echo $pid; ?>">
|
||||
<table class="table">
|
||||
<tr class="yellow">
|
||||
<td colspan="2"><center><font size="6">Player skills administration</font></center></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input name="name" type="text" placeholder="Character name" <?php if ($name !== false) echo "value='$name' disabled";?>>
|
||||
<br><br>
|
||||
Fist fighting:<br>
|
||||
<input name="fist" type="text" <?php if (!$name) echo "disabled";?> value="<?php echo playerSkill($skills, 0); ?>">
|
||||
<br><br>
|
||||
Club fighting:<br>
|
||||
<input name="club" type="text" <?php if (!$name) echo "disabled";?> value="<?php echo playerSkill($skills, 1); ?>">
|
||||
<br><br>
|
||||
Sword fighting:<br>
|
||||
<input name="sword" type="text" <?php if (!$name) echo "disabled";?> value="<?php echo playerSkill($skills, 2); ?>">
|
||||
<br><br>
|
||||
Axe fighting:<br>
|
||||
<input name="axe" type="text" <?php if (!$name) echo "disabled";?> value="<?php echo playerSkill($skills, 3); ?>">
|
||||
<br><br>
|
||||
</td>
|
||||
<td>
|
||||
Dist fighting:<br>
|
||||
<input name="dist" type="text" <?php if (!$name) echo "disabled";?> value="<?php echo playerSkill($skills, 4); ?>">
|
||||
<br><br>
|
||||
Shield fighting:<br>
|
||||
<input name="shield" type="text" <?php if (!$name) echo "disabled";?> value="<?php echo playerSkill($skills, 5); ?>">
|
||||
<br><br>
|
||||
Fish fighting:<br>
|
||||
<input name="fish" type="text" <?php if (!$name) echo "disabled";?> value="<?php echo playerSkill($skills, 6); ?>">
|
||||
<br><br>
|
||||
Level:<br>
|
||||
<input name="level" type="text" <?php if (!$name) echo "disabled";?> value="<?php echo playerSkill($skills, 8); ?>">
|
||||
<br><br>
|
||||
Magic level:<br>
|
||||
<input name="magic" type="text" <?php if (!$name) echo "disabled";?> value="<?php echo playerSkill($skills, 7); ?>">
|
||||
<br><br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<?php
|
||||
if (!$name) {
|
||||
?>
|
||||
<input class="btn btn-primary" type="submit" value="Fetch character skills info">
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<input class="btn btn-success" type="submit" value="UPDATE SKILLS">
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<a href="admin_skills.php">Reset fields / search new character</a>
|
||||
</form>
|
||||
<?php
|
||||
// end
|
||||
include 'layout/overall/footer.php'; ?>
|
9
adminempty.php
Normal file
9
adminempty.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||
protect_page();
|
||||
admin_only($user_data);
|
||||
// start
|
||||
|
||||
|
||||
|
||||
// end
|
||||
include 'layout/overall/footer.php'; ?>
|
45
auctionChar.php
Normal file
45
auctionChar.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php require_once 'engine/init.php';
|
||||
protect_page();
|
||||
include 'layout/overall/header.php';
|
||||
|
||||
// Import from config:
|
||||
$auction = $config['shop_auction'];
|
||||
|
||||
if ($auction['characterAuction']) {
|
||||
?>
|
||||
<h1>Character auctioning</h1>
|
||||
<table class="auction_char">
|
||||
<tr class="yellow">
|
||||
<td>Name</td>
|
||||
<td>Level</td>
|
||||
<td>Vocation</td>
|
||||
<td>Image</td>
|
||||
<td>Price/Buy</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="characterprofile.php?name=Tester" target="_BLANK">Tester</a></td>
|
||||
<td>105</td>
|
||||
<td>Sorcerer</td>
|
||||
<td><a href="asd" target="_BLANK">VIEW</a></td>
|
||||
<td><button>105 points</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
<textarea cols="65" rows="15">
|
||||
CREATE TABLE IF NOT EXISTS `znote_auction_player` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`player_id` int(11) NOT NULL,
|
||||
`account_id` int(11) NOT NULL,
|
||||
`bidder_id` int(11) NOT NULL,
|
||||
`vocation` int(11) NOT NULL,
|
||||
`level` int(11) NOT NULL,
|
||||
`image` varchar(255) NOT NULL,
|
||||
`price` int(11) NOT NULL,
|
||||
`time` int(11) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
|
||||
</textarea>
|
||||
<?php
|
||||
} else echo "<p>Character shop auctioning system is disabled.</p>";
|
||||
|
||||
include 'layout/overall/footer.php'; ?>
|
||||
|
6
blank.php
Normal file
6
blank.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
|
||||
|
||||
<h1>Blank</h1>
|
||||
<p>This is a blank sample page.</p>
|
||||
|
||||
<?php include 'layout/overall/footer.php'; ?>
|
78
buypoints.php
Normal file
78
buypoints.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php require_once 'engine/init.php';
|
||||
protect_page();
|
||||
include 'layout/overall/header.php';
|
||||
|
||||
// Import from config:
|
||||
$paypal = $config['paypal'];
|
||||
$prices = $config['paypal_prices'];
|
||||
|
||||
if ($paypal['enabled']) {
|
||||
?>
|
||||
|
||||
<h1>Buy Points</h1>
|
||||
<h2>Buy points using Paypal:</h2>
|
||||
<table id="buypointsTable" class="table table-striped table-hover">
|
||||
<tr class="yellow">
|
||||
<th>Price:</th>
|
||||
<th>Points:</th>
|
||||
<?php if ($paypal['showBonus']) { ?>
|
||||
<th>Bonus:</th>
|
||||
<?php } ?>
|
||||
<th>Action:</th>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($prices as $price => $points) {
|
||||
echo '<tr class="special">';
|
||||
echo '<td>'. $price .'('. $paypal['currency'] .')</td>';
|
||||
echo '<td>'. $points .'</td>';
|
||||
if ($paypal['showBonus']) echo '<td>'. calculate_discount(($paypal['points_per_currency'] * $price), $points) .' bonus</td>';
|
||||
?>
|
||||
<td>
|
||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="POST">
|
||||
<input type="hidden" name="cmd" value="_xclick">
|
||||
<input type="hidden" name="business" value="<?php echo $paypal['email']; ?>">
|
||||
<input type="hidden" name="item_name" value="<?php echo $points .' shop points on '. $config['site_title']; ?>">
|
||||
<input type="hidden" name="item_number" value="1">
|
||||
<input type="hidden" name="amount" value="<?php echo $price; ?>">
|
||||
<input type="hidden" name="no_shipping" value="1">
|
||||
<input type="hidden" name="no_note" value="1">
|
||||
<input type="hidden" name="currency_code" value="<?php echo $paypal['currency']; ?>">
|
||||
<input type="hidden" name="lc" value="GB">
|
||||
<input type="hidden" name="bn" value="PP-BuyNowBF">
|
||||
<input type="hidden" name="return" value="<?php echo $paypal['success']; ?>">
|
||||
<input type="hidden" name="cancel_return" value="<?php echo $paypal['failed']; ?>">
|
||||
<input type="hidden" name="rm" value="2">
|
||||
<input type="hidden" name="notify_url" value="<?php echo $paypal['ipn']; ?>" />
|
||||
<input type="hidden" name="custom" value="<?php echo sanitize($_SESSION['user_id']).'!'.$price.'!'.$points; ?>">
|
||||
<input type="submit" value=" PURCHASE ">
|
||||
</form>
|
||||
</td>
|
||||
<?php
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
if ($config['paygol']['enabled'] == true) {
|
||||
?>
|
||||
<!-- PayGol Form using Post method -->
|
||||
<h2>Buy points using Paygol:</h2>
|
||||
<?php $paygol = $config['paygol']; ?>
|
||||
<p><?php echo $paygol['price'] ." ". $paygol['currency'] ."~ for ". $paygol['points'] ." points:"; ?></p>
|
||||
<form name="pg_frm" method="post" action="http://www.paygol.com/micropayment/paynow" >
|
||||
<input type="hidden" name="pg_serviceid" value="<?php echo $paygol['serviceID']; ?>">
|
||||
<input type="hidden" name="pg_currency" value="<?php echo $paygol['currency']; ?>">
|
||||
<input type="hidden" name="pg_name" value="<?php echo $paygol['name']; ?>">
|
||||
<input type="hidden" name="pg_custom" value="<?php echo $session_user_id; ?>">
|
||||
<input type="hidden" name="pg_price" value="<?php echo $paygol['price']; ?>">
|
||||
<input type="hidden" name="pg_return_url" value="<?php echo $paygol['returnURL']; ?>">
|
||||
<input type="hidden" name="pg_cancel_url" value="<?php echo $paygol['cancelURL']; ?>">
|
||||
<input type="hidden" name="pg_notify" value="<?php echo $paygol['ipnURL']; ?>">
|
||||
<input type="image" name="pg_button" src="http://www.paygol.com/micropayment/img/buttons/150/black_en_pbm.png" border="0" alt="Make payments with PayGol: the easiest way!" title="Make payments with PayGol: the easiest way!" >
|
||||
</form>
|
||||
<?php }
|
||||
|
||||
if (!$config['paypal']['enabled'] && !$config['paygol']['enabled']) echo '<h1>Buy Points system disabled.</h1><p>Sorry, this functionality is disabled.</p>';
|
||||
include 'layout/overall/footer.php'; ?>
|
93
changepassword.php
Normal file
93
changepassword.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php require_once 'engine/init.php';
|
||||
protect_page();
|
||||
|
||||
if (empty($_POST) === false) {
|
||||
/* Token used for cross site scripting security */
|
||||
if (!Token::isValid($_POST['token'])) {
|
||||
$errors[] = 'Token is invalid.';
|
||||
}
|
||||
|
||||
$required_fields = array('current_password', 'new_password', 'new_password_again');
|
||||
|
||||
foreach($_POST as $key=>$value) {
|
||||
if (empty($value) && in_array($key, $required_fields) === true) {
|
||||
$errors[] = 'You need to fill in all fields.';
|
||||
break 1;
|
||||
}
|
||||
}
|
||||
|
||||
$pass_data = user_data($session_user_id, 'password');
|
||||
//$pass_data['password'];
|
||||
// $_POST['']
|
||||
|
||||
// .3 compatibility
|
||||
if ($config['TFSVersion'] == 'TFS_03' && $config['salt'] === true) {
|
||||
$salt = user_data($session_user_id, 'salt');
|
||||
}
|
||||
if (sha1($_POST['current_password']) === $pass_data['password'] || $config['TFSVersion'] == 'TFS_03' && $config['salt'] === true && sha1($salt['salt'].$_POST['current_password']) === $pass_data['password']) {
|
||||
if (trim($_POST['new_password']) !== trim($_POST['new_password_again'])) {
|
||||
$errors[] = 'Your new passwords do not match.';
|
||||
} else if (strlen($_POST['new_password']) < 6) {
|
||||
$errors[] = 'Your new passwords must be at least 6 characters.';
|
||||
} else if (strlen($_POST['new_password']) > 32) {
|
||||
$errors[] = 'Your new passwords must be less than 33 characters.';
|
||||
}
|
||||
} else {
|
||||
$errors[] = 'Your current password is incorrect.';
|
||||
}
|
||||
|
||||
print_r($errors);
|
||||
}
|
||||
|
||||
include 'layout/overall/header.php'; ?>
|
||||
|
||||
<h1>Change Password:</h1>
|
||||
|
||||
<?php
|
||||
if (isset($_GET['success']) && empty($_GET['success'])) {
|
||||
echo 'Your password has been changed.<br>You will need to login again with the new password.';
|
||||
session_destroy();
|
||||
header("refresh:2;url=index.php");
|
||||
exit();
|
||||
} else {
|
||||
if (empty($_POST) === false && empty($errors) === true) {
|
||||
//Posted the form without errors
|
||||
if ($config['TFSVersion'] == 'TFS_02') {
|
||||
user_change_password($session_user_id, $_POST['new_password']);
|
||||
} else if ($config['TFSVersion'] == 'TFS_03') {
|
||||
user_change_password03($session_user_id, $_POST['new_password']);
|
||||
}
|
||||
header('Location: changepassword.php?success');
|
||||
} else if (empty($errors) === false){
|
||||
echo '<font color="red"><b>';
|
||||
echo output_errors($errors);
|
||||
echo '</b></font>';
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>
|
||||
Current password:<br>
|
||||
<input type="password" name="current_password">
|
||||
</li>
|
||||
<li>
|
||||
New password:<br>
|
||||
<input type="password" name="new_password">
|
||||
</li>
|
||||
<li>
|
||||
New password again:<br>
|
||||
<input type="password" name="new_password_again">
|
||||
</li>
|
||||
<?php
|
||||
/* Form file */
|
||||
Token::create();
|
||||
?>
|
||||
<li>
|
||||
<input type="submit" value="Change password">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
include 'layout/overall/footer.php'; ?>
|
207
characterprofile.php
Normal file
207
characterprofile.php
Normal file
@ -0,0 +1,207 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||
if ($config['log_ip']) {
|
||||
znote_visitor_insert_detailed_data(4);
|
||||
}
|
||||
if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
||||
$name = $_GET['name'];
|
||||
|
||||
if (user_character_exist($name)) {
|
||||
$user_id = user_character_id($name);
|
||||
if ($config['TFSVersion'] == 'TFS_10') {
|
||||
$profile_data = user_character_data($user_id, 'name', 'level', 'vocation', 'lastlogin');
|
||||
$profile_data['online'] = user_is_online_10($user_id);
|
||||
} else $profile_data = user_character_data($user_id, 'name', 'level', 'vocation', 'lastlogin', 'online');
|
||||
$profile_znote_data = user_znote_character_data($user_id, 'created', 'hide_char', 'comment');
|
||||
|
||||
$guild_exist = false;
|
||||
if (get_character_guild_rank($user_id) > 0) {
|
||||
$guild_exist = true;
|
||||
$guild = get_player_guild_data($user_id);
|
||||
$guild_name = get_guild_name($guild['guild_id']);
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- PROFILE MARKUP HERE-->
|
||||
<?php ?>
|
||||
<h1><font class="profile_font" name="profile_font_header">Profile: <?php echo $profile_data['name']; ?></font></h1>
|
||||
<ul class="unstyled">
|
||||
<li><font class="profile_font" name="profile_font_level">Level: <?php echo $profile_data['level']; ?></font></li>
|
||||
<li><font class="profile_font" name="profile_font_vocation">Vocation: <?php echo vocation_id_to_name($profile_data['vocation']); ?></font></li>
|
||||
<?php
|
||||
if ($guild_exist) {
|
||||
?>
|
||||
<li><font class="profile_font" name="profile_font_vocation"><b><?php echo $guild['rank_name']; ?></b> of <a href="guilds.php?name=<?php echo $guild_name; ?>"><?php echo $guild_name; ?></a></font></li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<li><font class="profile_font" name="profile_font_lastlogin">Last Login: <?php
|
||||
if ($profile_data['lastlogin'] != 0) {
|
||||
echo getClock($profile_data['lastlogin'], true, false);
|
||||
} else {
|
||||
echo 'Never.';
|
||||
}
|
||||
|
||||
?></font></li>
|
||||
<li><font class="profile_font" name="profile_font_status">Status:</font> <?php
|
||||
if ($config['TFSVersion'] == 'TFS_10') {
|
||||
if ($profile_data['online']) {
|
||||
echo '<font class="profile_font" name="profile_font_online" color="green"><b>ONLINE</b></font>';
|
||||
} else {
|
||||
echo '<font class="profile_font" name="profile_font_online" color="red"><b>OFFLINE</b></font>';
|
||||
}
|
||||
} else {
|
||||
if ($profile_data['online'] == 1) {
|
||||
echo '<font class="profile_font" name="profile_font_online" color="green"><b>ONLINE</b></font>';
|
||||
} else {
|
||||
echo '<font class="profile_font" name="profile_font_online" color="red"><b>OFFLINE</b></font>';
|
||||
}
|
||||
}
|
||||
?></li>
|
||||
<li><font class="profile_font" name="profile_font_created">Created: <?php echo getClock($profile_znote_data['created'], true); ?></font></li>
|
||||
<li><font class="profile_font" name="profile_font_comment">Comment:</font> <br><textarea name="profile_comment_textarea" cols="70" rows="10" readonly="readonly" class="span12"><?php echo $profile_znote_data['comment']; ?></textarea></li>
|
||||
<!-- DEATH LIST -->
|
||||
<li>
|
||||
<b>Death List:</b><br>
|
||||
<?php
|
||||
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
|
||||
$array = user_fetch_deathlist($user_id);
|
||||
if ($array) {
|
||||
//data_dump($array, false, "Data:");
|
||||
?>
|
||||
<ul>
|
||||
<?php
|
||||
// Design and present the list
|
||||
foreach ($array as $value) {
|
||||
echo '<li>';
|
||||
// $value[0]
|
||||
$value['time'] = getClock($value['time'], true);
|
||||
if ($value['is_player'] == 1) {
|
||||
$value['killed_by'] = 'player: <a href="characterprofile.php?name='. $value['killed_by'] .'">'. $value['killed_by'] .'</a>';
|
||||
} else {
|
||||
$value['killed_by'] = 'monster: '. $value['killed_by'] .'.';
|
||||
}
|
||||
|
||||
echo '['. $value['time'] .'] Killed at level '. $value['level'] .' by '. $value['killed_by'];
|
||||
echo '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
} else {
|
||||
echo '<b><font color="green">This player has never died.</font></b>';
|
||||
}
|
||||
//Done.
|
||||
} else if ($config['TFSVersion'] == 'TFS_03') {
|
||||
$array = user_fetch_deathlist03($user_id);
|
||||
if ($array) {
|
||||
?>
|
||||
<ul>
|
||||
<?php
|
||||
// Design and present the list
|
||||
foreach ($array as $value) {
|
||||
echo '<li>';
|
||||
$value[3] = user_get_killer_id(user_get_kid($value['id']));
|
||||
if ($value[3] !== false && $value[3] >= 1) {
|
||||
$namedata = user_character_data((int)$value[3], 'name');
|
||||
if ($namedata !== false) {
|
||||
$value[3] = $namedata['name'];
|
||||
$value[3] = 'player: <a href="characterprofile.php?name='. $value[3] .'">'. $value[3] .'</a>';
|
||||
} else {
|
||||
$value[3] = 'deleted player.';
|
||||
}
|
||||
} else {
|
||||
$value[3] = user_get_killer_m_name(user_get_kid($value['id']));
|
||||
if ($value[3] === false) $value[3] = 'deleted player.';
|
||||
}
|
||||
echo '['. getClock($value['date'], true) .'] Killed at level '. $value['level'] .' by '. $value[3];
|
||||
echo '</li>';
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<?php
|
||||
} else {
|
||||
echo '<b><font color="green">This player has never died.</font></b>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</li>
|
||||
|
||||
<!-- END DEATH LIST -->
|
||||
|
||||
<!-- CHARACTER LIST -->
|
||||
<?php
|
||||
if (user_character_hide($profile_data['name']) != 1 && user_character_list_count(user_character_account_id($name)) > 1) {
|
||||
?>
|
||||
<li>
|
||||
<b>Other visible characters on this account:</b><br>
|
||||
<?php
|
||||
$characters = user_character_list(user_character_account_id($profile_data['name']));
|
||||
// characters: [0] = name, [1] = level, [2] = vocation, [3] = town_id, [4] = lastlogin, [5] = online
|
||||
if ($characters && count($characters) > 1) {
|
||||
?>
|
||||
<table id="characterprofileTable" class="table table-striped table-hover">
|
||||
<tr class="yellow">
|
||||
<th>
|
||||
Name:
|
||||
</th>
|
||||
<th>
|
||||
Level:
|
||||
</th>
|
||||
<th>
|
||||
Vocation:
|
||||
</th>
|
||||
<th>
|
||||
Last login:
|
||||
</th>
|
||||
<th>
|
||||
Status:
|
||||
</th>
|
||||
</tr>
|
||||
<?php
|
||||
// Design and present the list
|
||||
foreach ($characters as $char) {
|
||||
if ($char['name'] != $profile_data['name']) {
|
||||
if (hide_char_to_name(user_character_hide($char['name'])) != 'hidden') {
|
||||
echo '<tr>';
|
||||
echo '<td><a href="characterprofile.php?name='. $char['name'] .'">'. $char['name'] .'</a></td>';
|
||||
echo '<td>'. $char['level'] .'</td>';
|
||||
echo '<td>'. $char['vocation'] .'</td>';
|
||||
echo '<td>'. $char['lastlogin'] .'</td>';
|
||||
echo '<td>'. $char['online'] .'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
} else {
|
||||
echo '<b><font color="green">This player has never died.</font></b>';
|
||||
}
|
||||
//Done.
|
||||
?>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<!-- END CHARACTER LIST -->
|
||||
<li><font class="profile_font" name="profile_font_share_url">Address: <a href="<?php
|
||||
if ($config['htwrite']) echo "http://".$_SERVER['HTTP_HOST']."/". $profile_data['name'];
|
||||
else echo "http://".$_SERVER['HTTP_HOST']."/characterprofile.php?name=". $profile_data['name'];
|
||||
|
||||
?>"><?php
|
||||
if ($config['htwrite']) echo "http://".$_SERVER['HTTP_HOST']."/". $profile_data['name'];
|
||||
else echo "http://".$_SERVER['HTTP_HOST']."/characterprofile.php?name=". $profile_data['name'];
|
||||
?></a></font></li>
|
||||
</ul>
|
||||
<!-- END PROFILE MARKUP HERE-->
|
||||
|
||||
<?php
|
||||
} else {
|
||||
echo htmlentities(strip_tags($name, ENT_QUOTES)).' does not exist.';
|
||||
}
|
||||
} else {
|
||||
header('Location: index.php');
|
||||
}
|
||||
|
||||
include 'layout/overall/footer.php'; ?>
|
461
config.php
Normal file
461
config.php
Normal file
@ -0,0 +1,461 @@
|
||||
<?php
|
||||
// Available options: TFS_02, TFS_03
|
||||
// TFS 0.2 = TFS_02
|
||||
// TFS 0.3 = TFS_03 (If ur using 0.3.6, set $config['salt'] to false)!
|
||||
// TFS 0.4 = TFS_03
|
||||
// TFS 1.0 = TFS_10 (Under developement)
|
||||
$config['TFSVersion'] = 'TFS_10';
|
||||
|
||||
$config['site_title'] = 'Znote AAC';
|
||||
$config['site_title_context'] = 'Because open communities are good communities. :3';
|
||||
|
||||
// ------------------------ \\
|
||||
// MYSQL CONNECTION DETAILS \\
|
||||
// ------------------------ \\
|
||||
|
||||
// phpmyadmin username for OT server: (DONT USE "root" if ur hosting to public.).
|
||||
$config['sqlUser'] = 'new';
|
||||
|
||||
// phpmyadmin password for OT server:
|
||||
$config['sqlPassword'] = 'new';
|
||||
|
||||
// The database name to connect to. (This is usually same as username).
|
||||
$config['sqlDatabase'] = 'new';
|
||||
|
||||
// Hostname is usually localhost or 127.0.0.1.
|
||||
$config['sqlHost'] = 'localhost';
|
||||
|
||||
/* CLOCK FUNCTION
|
||||
- getClock() = returns current time in numbers.
|
||||
- getClock(time(), true) = returns current time in formatted date
|
||||
- getClock(false, true) = same as above
|
||||
- getClock(false, true, false) = get current time, don't adjust timezone
|
||||
- echo getClock($profile_data['lastlogin'], true); = from characterprofile,
|
||||
explains when user was last logged in. */
|
||||
function getClock($time = false, $format = false, $adjust = true) {
|
||||
if (!$time) $time = time();
|
||||
// Date string representation
|
||||
$date = "d F Y (H:i)"; // 15 July 2013 (13:50)
|
||||
if ($adjust) $adjust = (2 * 3600); // Adjust to fit your timezone.
|
||||
else $adjust = 0;
|
||||
if ($format) return date($date, $time+$adjust);
|
||||
else return $time+$adjust;
|
||||
}
|
||||
|
||||
// ------------------- \\
|
||||
// CUSTOM SERVER STUFF \\
|
||||
// ------------------- \\
|
||||
|
||||
// Vocation ids and names.
|
||||
$config['vocations'] = array(
|
||||
0 => 'No vocation',
|
||||
1 => 'Sorcerer',
|
||||
2 => 'Druid',
|
||||
3 => 'Paladin',
|
||||
4 => 'Knight',
|
||||
5 => 'Master Sorcerer',
|
||||
6 => 'Elder Druid',
|
||||
7 => 'Royal Paladin',
|
||||
8 => 'Elite Knight',
|
||||
);
|
||||
|
||||
// Town ids and names: (In RME map editor, open map, click CTRL + T to view towns, their names and their IDs.
|
||||
// townID => 'townName' etc: ['3'=>'Thais']
|
||||
$config['towns'] = array(
|
||||
0 => 'Town 0',
|
||||
1 => 'Town 1',
|
||||
2 => 'Town 2',
|
||||
3 => 'Town 3',
|
||||
4 => 'Town 4',
|
||||
5 => 'Town 5',
|
||||
6 => 'Town 6',
|
||||
7 => 'Town 7',
|
||||
8 => 'Town 8',
|
||||
9 => 'Town 9',
|
||||
);
|
||||
|
||||
// Leave on black square in map and player should get teleported to their selected town.
|
||||
// If chars get buggy set this position to a beginner location to force players there.
|
||||
$config['default_pos'] = array(
|
||||
'x' => 5,
|
||||
'y' => 5,
|
||||
'z' => 2,
|
||||
);
|
||||
|
||||
$config['war_status'] = array(
|
||||
0 => 'Pending..',
|
||||
1 => 'Accepted',
|
||||
2 => 'Rejected',
|
||||
3 => 'Cancelled',
|
||||
4 => '???',
|
||||
5 => 'Ended',
|
||||
);
|
||||
|
||||
/* -- SUB PAGES --
|
||||
Some custom layouts/templates have custom pages, they can use
|
||||
this sub page functionality for that.
|
||||
*/
|
||||
$config['allowSubPages'] = true;
|
||||
|
||||
// ---------------- \\
|
||||
// Create Character \\
|
||||
// ---------------- \\
|
||||
|
||||
// Max characters on each account:
|
||||
$config['max_characters'] = 7;
|
||||
|
||||
// Available character vocation users can create.
|
||||
$config['available_vocations'] = array(1, 2, 3, 4);
|
||||
|
||||
// Available towns (specify town ids, etc: (0, 1, 2); to display 3 town options (town id 0, 1 and 2).
|
||||
$config['available_towns'] = array(1);
|
||||
|
||||
$config['level'] = 8;
|
||||
$config['health'] = 185;
|
||||
$config['mana'] = 35;
|
||||
$config['cap'] = 435;
|
||||
$config['soul'] = 0;
|
||||
|
||||
$config['maleOutfitId'] = 128;
|
||||
$config['femaleOutfitId'] = 138;
|
||||
|
||||
// No vocation info (if user select vocation id 0, we force thees configurations on him
|
||||
$config['nvlevel'] = 1;
|
||||
$config['nvHealth'] = 150;
|
||||
$config['nvMana'] = 0;
|
||||
$config['nvCap'] = 400;
|
||||
$config['nvSoul'] = 0;
|
||||
|
||||
$config['nvForceTown'] = 0; // Force a town to no vocation even though he selected something else? 0 = no, 1 = yes.
|
||||
$config['nvTown'] = 0; // Town id to force no vocations to get to, if nvForceTown is 1.
|
||||
|
||||
// Minimum allowed character name letters. Etc 4 letters: "Kåre".
|
||||
$config['minL'] = 4;
|
||||
// Maximum allowed character name letters. Etc 20 letters: "Bobkåreolesofiesberg"
|
||||
$config['maxL'] = 20;
|
||||
|
||||
// Maximum allowed character name words. Etc 2 words = "Bob Kåre", 3 words: "Bob Arne Kåre" as max char name words.
|
||||
$config['maxW'] = 2;
|
||||
|
||||
// -------------- \\
|
||||
// WEBSITE STUFF \\
|
||||
// -------------- \\
|
||||
|
||||
// ONLY FOR TFS 0.2 (TFS 0.3/4 users don't need to care about this, as its fully loaded from db)
|
||||
$config['house'] = array(
|
||||
'house_file' => 'C:\test\Mystic Spirit_0.2.5\data\world\forgotten-house.xml',
|
||||
'price_sqm' => '50', // price per house sqm
|
||||
);
|
||||
|
||||
$config['status'] = array(
|
||||
'status_check' => false, //enable or disable status checker
|
||||
'status_ip' => '127.0.0.1',
|
||||
'status_port' => "7171",
|
||||
);
|
||||
|
||||
$config['validate_IP'] = true; // Only allow legal IP addresses to register and create character.
|
||||
$config['salt'] = false; // Some noob 0.3.6 servers don't support salt.
|
||||
|
||||
// Restricted names
|
||||
$config['invalidNameTags'] = array("god", "gm", "cm", "gamemaster", "hoster", "admin", "admim", "adm", "owner", "staff");
|
||||
|
||||
// Level requirement to create guild? (Just set it to 1 to allow all levels).
|
||||
$config['create_guild_level'] = 8;
|
||||
|
||||
// Change Gender can be purchased in shop, or perhaps you want to allow everyone to change gender for free?
|
||||
$config['free_sex_change'] = false;
|
||||
|
||||
// Do you need to have premium account to create a guild?
|
||||
$config['guild_require_premium'] = false;
|
||||
|
||||
$config['guildwar_enabled'] = true;
|
||||
|
||||
// Use htaccess rewrite? (basically this makes website.com/username work instead of website.com/characterprofile.php?name=username
|
||||
// Linux users needs to enable mod_rewrite php extention to make it work properly, so set it to false if your lost and using Linux.
|
||||
$config['htwrite'] = true;
|
||||
|
||||
// What client version and server port are you using on this OT?
|
||||
// Used for the Downloads page.
|
||||
$config['client'] = 960; // 954 = tibia 9.54
|
||||
|
||||
// Download link to client. Recommended:
|
||||
// Select download link from remere map editor website!
|
||||
// See list of clients: http://remeresmapeditor.com/marklar.php?clients
|
||||
$config['client_download'] = 'http://remeresmapeditor.com/rmedl.php?file=tibia'. $config['client'] .'.exe';
|
||||
|
||||
$config['port'] = 7171; // Port number to connect to your OT.
|
||||
|
||||
// How often do you want highscores to update?
|
||||
$config['cache_lifespan'] = 60 * 15; // 15 minutes.
|
||||
|
||||
// WARNING! Account names written here will have admin access to web page!
|
||||
$config['page_admin_access'] = array(
|
||||
'otland0',
|
||||
'otland1',
|
||||
'znote'
|
||||
);
|
||||
|
||||
// Built-in FORUM
|
||||
// Enable forum, enable guildboards, level to create threads/post in them
|
||||
// How long do they have to wait to create thread or post?
|
||||
// How to design/display hidden/closed/sticky threads.
|
||||
$config['forum'] = array(
|
||||
'enabled' => true,
|
||||
'guildboard' => true,
|
||||
'level' => 5,
|
||||
'cooldownPost' => 60,
|
||||
'cooldownCreate' => 180,
|
||||
'hidden' => '<font color="orange">[H]</font>',
|
||||
'closed' => '<font color="red">[C]</font>',
|
||||
'sticky' => '<font color="green">[S]</font>',
|
||||
);
|
||||
|
||||
// Guilds and guild war pages will do lots of queries on bigger databases.
|
||||
// So its recommended to require login to view them, but you can disable this
|
||||
// If you don't have any problems with load.
|
||||
$config['require_login'] = array(
|
||||
'guilds' => false,
|
||||
'guildwars' => false,
|
||||
);
|
||||
|
||||
// IMPORTANT! Write a character name(that exist) that will represent website bans!
|
||||
// Or remember to create character "God Website" character exist.
|
||||
// If you don't do this, bann from admin panel won't work properly.
|
||||
$config['website_char'] = 'God Website';
|
||||
|
||||
//----------------\\
|
||||
// ADVANCED STUFF \\
|
||||
//----------------\\
|
||||
|
||||
// Don't touch this unless you know what you are doing. (modifying this(key value) also requires modifications in OT files /XML/commands.xml).
|
||||
$config['ingame_positions'] = array(
|
||||
1 => 'Player',
|
||||
2 => 'Tutor',
|
||||
3 => 'Senior Tutor',
|
||||
4 => 'Gamemaster',
|
||||
5 => 'Community Manager',
|
||||
6 => 'God',
|
||||
);
|
||||
|
||||
// Enable OS advanced feautures? false = no, true = yes
|
||||
$config['os_enabled'] = false;
|
||||
|
||||
// What kind of computer are you hosting this website on?
|
||||
// Available options: LINUX or WINDOWS
|
||||
$config['os'] = 'WINDOWS';
|
||||
|
||||
// Measure how much players are lagging in-game. (Not completed).
|
||||
$config['ping'] = false;
|
||||
|
||||
// BAN STUFF - Don't touch this unless you know what you are doing.
|
||||
// You can order the lines the way you want, from top to bot, in which order you
|
||||
// wish for them to be displayed in admin panel. Just make sure key[#] represent your describtion.
|
||||
$config['ban_type'] = array(
|
||||
4 => 'NOTATION_ACCOUNT',
|
||||
2 => 'NAMELOCK_PLAYER',
|
||||
3 => 'BAN_ACCOUNT',
|
||||
5 => 'DELETE_ACCOUNT',
|
||||
1 => 'BAN_IPADDRESS',
|
||||
);
|
||||
|
||||
// BAN STUFF - Don't touch this unless you know what you are doing.
|
||||
// You can order the lines the way you want, from top to bot, in which order you
|
||||
// wish for them to be displayed in admin panel. Just make sure key[#] represent your describtion.
|
||||
$config['ban_action'] = array(
|
||||
0 => 'Notation',
|
||||
1 => 'Name Report',
|
||||
2 => 'Banishment',
|
||||
3 => 'Name Report + Banishment',
|
||||
4 => 'Banishment + Final Warning',
|
||||
5 => 'NR + Ban + FW',
|
||||
6 => 'Statement Report',
|
||||
);
|
||||
|
||||
// Ban reasons, for changes beside default values to work with client,
|
||||
// you also need to edit sources (tools.cpp line 1096)
|
||||
$config['ban_reason'] = array(
|
||||
0 => 'Offensive Name',
|
||||
1 => 'Invalid Name Format',
|
||||
2 => 'Unsuitable Name',
|
||||
3 => 'Name Inciting Rule Violation',
|
||||
4 => 'Offensive Statement',
|
||||
5 => 'Spamming',
|
||||
6 => 'Illegal Advertising',
|
||||
7 => 'Off-Topic Public Statement',
|
||||
8 => 'Non-English Public Statement',
|
||||
9 => 'Inciting Rule Violation',
|
||||
10 => 'Bug Abuse',
|
||||
11 => 'Game Weakness Abuse',
|
||||
12 => 'Using Unofficial Software to Play',
|
||||
13 => 'Hacking',
|
||||
14 => 'Multi-Clienting',
|
||||
15 => 'Account Trading or Sharing',
|
||||
16 => 'Threatening Gamemaster',
|
||||
17 => 'Pretending to Have Influence on Rule Enforcement',
|
||||
18 => 'False Report to Gamemaster',
|
||||
19 => 'Destructive Behaviour',
|
||||
20 => 'Excessive Unjustified Player Killing',
|
||||
21 => 'Spoiling Auction',
|
||||
);
|
||||
|
||||
// BAN STUFF
|
||||
// Ban time duration selection in admin panel
|
||||
// seconds => describtion
|
||||
$config['ban_time'] = array(
|
||||
3600 => '1 hour',
|
||||
21600 => '6 hours',
|
||||
43200 => '12 hours',
|
||||
86400 => '1 day',
|
||||
259200 => '3 days',
|
||||
604800 => '1 week',
|
||||
1209600 => '2 weeks',
|
||||
2592000 => '1 month',
|
||||
);
|
||||
|
||||
|
||||
// --------------- \\
|
||||
// SECURITY STUFF \\
|
||||
// --------------- \\
|
||||
$config['use_token'] = false;
|
||||
$config['use_captcha'] = false;
|
||||
|
||||
/* Store visitor data
|
||||
Store visitor data in the database, logging every IP visitng site,
|
||||
and how many times they have visited the site. And sometimes what
|
||||
they do on the site.
|
||||
|
||||
This helps to prevent POST SPAM (like register 1000 accounts in a few seconds)
|
||||
and other things which can stress and slow down the server.
|
||||
|
||||
The only downside is that database can get pretty fed up with much IP data
|
||||
if table never gets flushed once in a while. So I highly recommend you
|
||||
to configure flush_ip_logs if IPs are logged.
|
||||
*/
|
||||
|
||||
$config['log_ip'] = true;
|
||||
|
||||
// Flush IP logs each configured seconds, 60 * 15 = 15 minutes.
|
||||
// Set to false to entirely disable ip log flush.
|
||||
// It is important to flush for optimal performance.
|
||||
$config['flush_ip_logs'] = 59 * 27;
|
||||
|
||||
/* IP SECURTY REQUIRE: $config['log_ip'] = true;
|
||||
Configure how tight this security shall be.
|
||||
Etc: You can max click on anything/refresh page
|
||||
[max activity] 15 times, within time period 10
|
||||
seconds. During time_period, you can also only
|
||||
register 1 account and 1 character.
|
||||
*/
|
||||
$config['ip_security'] = array(
|
||||
'time_period' => 10, // In seconds
|
||||
'max_activity' => 10, // page clicks/visits
|
||||
'max_post' => 6, // register, create, highscore, character search such actions
|
||||
'max_account' => 1, // register
|
||||
'max_character' => 1, // create char
|
||||
'max_forum_post' => 1, // Create threads and post in forum
|
||||
);
|
||||
|
||||
//////////////
|
||||
/// PAYPAL ///
|
||||
//////////////
|
||||
|
||||
// Write your paypal address here, and what currency you want to recieve money in.
|
||||
$config['paypal'] = array(
|
||||
'enabled' => true,
|
||||
'email' => 'Change_Paypal_mail_in_config.php', // Example: paypal@mail.com
|
||||
'currency' => 'EUR',
|
||||
'points_per_currency' => 10, // 1 currency = ? points? [ONLY used to calculate bonuses]
|
||||
'success' => "http://".$_SERVER['HTTP_HOST']."/success.php",
|
||||
'failed' => "http://".$_SERVER['HTTP_HOST']."/failed.php",
|
||||
'ipn' => "http://".$_SERVER['HTTP_HOST']."/ipn.php",
|
||||
'showBonus' => true,
|
||||
);
|
||||
|
||||
// Configure the "buy now" buttons prices, first write price, then how many points you get.
|
||||
// Giving some bonus points for higher donations will tempt users to donate more.
|
||||
$config['paypal_prices'] = array(
|
||||
// price => points,
|
||||
5 => 45, // -10% bonus
|
||||
10 => 100, // 0% bonus
|
||||
15 => 165, // +10% bonus
|
||||
20 => 240, // +20% bonus
|
||||
25 => 325, // +30% bonus
|
||||
30 => 420, // +40% bonus
|
||||
);
|
||||
|
||||
//////////////////
|
||||
/// PAYGOL SMS ///
|
||||
//////////////////
|
||||
// !!! Paygol takes 60%~ of the money, and send aprox 40% to your paypal.
|
||||
// You can configure paygol to send each month, then they will send money to you 1 month after recieving 50+ eur.
|
||||
$config['paygol'] = array(
|
||||
'enabled' => true,
|
||||
'serviceID' => 40339,// Service ID from paygol.com
|
||||
'currency' => 'EUR',
|
||||
'price' => 5,
|
||||
'points' => 25, // Remember to write same details in paygol.com!
|
||||
'name' => '25 points',
|
||||
'returnURL' => "http://".$_SERVER['HTTP_HOST']."/success.php",
|
||||
'cancelURL' => "http://".$_SERVER['HTTP_HOST']."/failed.php",
|
||||
'ipnURL' => "http://".$_SERVER['HTTP_HOST']."/paygol_ipn.php",
|
||||
);
|
||||
|
||||
////////////
|
||||
/// SHOP ///
|
||||
////////////
|
||||
// If useDB is set to true, player can shop in-game as well using Znote LUA shop system plugin.
|
||||
$config['shop'] = array(
|
||||
'enabled' => true,
|
||||
'enableShopConfirmation' => true, // Verify that user wants to buy with popup
|
||||
'useDB' => false, // Fetch offers from database, or the below config array
|
||||
'showImage' => true,
|
||||
'imageServer' => 'items.znote.eu',
|
||||
'imageType' => 'gif',
|
||||
);
|
||||
|
||||
// If useDB is false, this array list will be used for shop offers.
|
||||
$config['shop_offers'] = array(
|
||||
// offer 1
|
||||
1 => array(
|
||||
'type' => 1, // 1 = item id offers, 2 = premium days [itemid ignored], 3 = sex change[itemid & count ignored], 4+ = custom.
|
||||
'itemid' => 2160, // item to get in-game
|
||||
'count' => 5, //if type is 2, this represents premium days
|
||||
'describtion' => "Crystal coin.", // Describtion shown on website
|
||||
'points' => 100, // How many points this offer costs
|
||||
),
|
||||
|
||||
// offer 2
|
||||
2 => array(
|
||||
'type' => 1,
|
||||
'itemid' => 2392,
|
||||
'count' => 1,
|
||||
'describtion' => "Fire sword.",
|
||||
'points' => 10,
|
||||
),
|
||||
|
||||
// offer 3
|
||||
3 => array(
|
||||
'type' => 2,
|
||||
'itemid' => 12466, // Item to display on page
|
||||
'count' => 7,
|
||||
'describtion' => "Premium membership.",
|
||||
'points' => 25,
|
||||
),
|
||||
|
||||
// offer 4
|
||||
4 => array(
|
||||
'type' => 3,
|
||||
'itemid' => 12666,
|
||||
'count' => 3,
|
||||
'describtion' => "Change character gender.",
|
||||
'points' => 10,
|
||||
),
|
||||
5 => array(
|
||||
'type' => 3,
|
||||
'itemid' => 12666,
|
||||
'count' => 0,
|
||||
'describtion' => "Change character gender.",
|
||||
'points' => 20,
|
||||
),
|
||||
);
|
||||
?>
|
6
contact.php
Normal file
6
contact.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
|
||||
|
||||
<h1>Contact</h1>
|
||||
<p>TODO: Edit the contact details here.</p>
|
||||
|
||||
<?php include 'layout/overall/footer.php'; ?>
|
151
createcharacter.php
Normal file
151
createcharacter.php
Normal file
@ -0,0 +1,151 @@
|
||||
<?php require_once 'engine/init.php';
|
||||
protect_page();
|
||||
include 'layout/overall/header.php';
|
||||
|
||||
if (empty($_POST) === false) {
|
||||
// $_POST['']
|
||||
$required_fields = array('name', 'selected_town');
|
||||
foreach($_POST as $key=>$value) {
|
||||
if (empty($value) && in_array($key, $required_fields) === true) {
|
||||
$errors[] = 'You need to fill in all fields.';
|
||||
break 1;
|
||||
}
|
||||
}
|
||||
|
||||
// check errors (= user exist, pass long enough
|
||||
if (empty($errors) === true) {
|
||||
if (!Token::isValid($_POST['token'])) {
|
||||
$errors[] = 'Token is invalid.';
|
||||
}
|
||||
$_POST['name'] = validate_name($_POST['name']);
|
||||
if ($_POST['name'] === false) {
|
||||
$errors[] = 'Your name can not contain more than 2 words.';
|
||||
} else {
|
||||
if (user_character_exist($_POST['name']) === true) {
|
||||
$errors[] = 'Sorry, that character name already exist.';
|
||||
}
|
||||
if (!preg_match("/^[a-zA-Z_ ]+$/", $_POST['name'])) {
|
||||
$errors[] = 'Your name may only contain a-z, A-Z and spaces.';
|
||||
}
|
||||
if (strlen($_POST['name']) < $config['minL'] || strlen($_POST['name']) > $config['maxL']) {
|
||||
$errors[] = 'Your character name must be between 4 - 20 characters long.';
|
||||
}
|
||||
// name restriction
|
||||
$resname = explode(" ", $_POST['name']);
|
||||
foreach($resname as $res) {
|
||||
if(in_array(strtolower($res), $config['invalidNameTags'])) {
|
||||
$errors[] = 'Your username contains a restricted word.';
|
||||
}
|
||||
else if(strlen($res) == 1) {
|
||||
$errors[] = 'Too short words in your name.';
|
||||
}
|
||||
}
|
||||
// Validate vocation id
|
||||
if (!in_array((int)$_POST['selected_vocation'], $config['available_vocations'])) {
|
||||
$errors[] = 'Permission Denied. Wrong vocation.';
|
||||
}
|
||||
// Validate town id
|
||||
if (!in_array((int)$_POST['selected_town'], $config['available_towns'])) {
|
||||
$errors[] = 'Permission Denied. Wrong town.';
|
||||
}
|
||||
// Validate gender id
|
||||
if (!in_array((int)$_POST['selected_gender'], array(0, 1))) {
|
||||
$errors[] = 'Permission Denied. Wrong gender.';
|
||||
}
|
||||
if (vocation_id_to_name($_POST['selected_vocation']) === false) {
|
||||
$errors[] = 'Failed to recognize that vocation, does it exist?';
|
||||
}
|
||||
if (town_id_to_name($_POST['selected_town']) === false) {
|
||||
$errors[] = 'Failed to recognize that town, does it exist?';
|
||||
}
|
||||
if (gender_exist($_POST['selected_gender']) === false) {
|
||||
$errors[] = 'Failed to recognize that gender, does it exist?';
|
||||
}
|
||||
// Char count
|
||||
$char_count = user_character_list_count($session_user_id);
|
||||
if ($char_count >= $config['max_characters']) {
|
||||
$errors[] = 'Your account is not allowed to have more than '. $config['max_characters'] .' characters.';
|
||||
}
|
||||
if (validate_ip(getIP()) === false && $config['validate_IP'] === true) {
|
||||
$errors[] = 'Failed to recognize your IP address. (Not a valid IPv4 address).';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<h1>Create Character</h1>
|
||||
<?php
|
||||
if (isset($_GET['success']) && empty($_GET['success'])) {
|
||||
echo 'Congratulations! Your character has been created. See you in-game!';
|
||||
} else {
|
||||
if (empty($_POST) === false && empty($errors) === true) {
|
||||
if ($config['log_ip']) {
|
||||
znote_visitor_insert_detailed_data(2);
|
||||
}
|
||||
//Register
|
||||
$character_data = array(
|
||||
'name' => format_character_name($_POST['name']),
|
||||
'account_id'=> $session_user_id,
|
||||
'vocation' => $_POST['selected_vocation'],
|
||||
'town_id' => $_POST['selected_town'],
|
||||
'sex' => $_POST['selected_gender'],
|
||||
'lastip' => ip2long(getIP()),
|
||||
'created' => time()
|
||||
);
|
||||
|
||||
user_create_character($character_data);
|
||||
header('Location: createcharacter.php?success');
|
||||
exit();
|
||||
//End register
|
||||
|
||||
} else if (empty($errors) === false){
|
||||
echo '<font color="red"><b>';
|
||||
echo output_errors($errors);
|
||||
echo '</b></font>';
|
||||
}
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>
|
||||
Name:<br>
|
||||
<input type="text" name="name">
|
||||
</li>
|
||||
<li>
|
||||
<!-- Available vocations to select from when creating character -->
|
||||
Vocation:<br>
|
||||
<select name="selected_vocation">
|
||||
<?php foreach ($config['available_vocations'] as $id) { ?>
|
||||
<option value="<?php echo $id; ?>"><?php echo vocation_id_to_name($id); ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<!-- Available genders to select from when creating character -->
|
||||
Gender:<br>
|
||||
<select name="selected_gender">
|
||||
<option value="1">Male(boy)</option>
|
||||
<option value="0">Female(girl)</option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<!-- Available towns to select from when creating character -->
|
||||
Town:<br>
|
||||
<select name="selected_town">
|
||||
<?php foreach ($config['available_towns'] as $tid) { ?>
|
||||
<option value="<?php echo $tid; ?>"><?php echo town_id_to_name($tid); ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</li>
|
||||
<?php
|
||||
/* Form file */
|
||||
Token::create();
|
||||
?>
|
||||
<li>
|
||||
<input type="submit" value="Create Character">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
include 'layout/overall/footer.php'; ?>
|
18
credits.php
Normal file
18
credits.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
|
||||
|
||||
<h1>Znote AAC</h1>
|
||||
<p>This website is powered by the Znote AAC engine.</p>
|
||||
|
||||
<h2>Developers:</h2>
|
||||
<p>Main developer: <a href="http://otland.net/members/znote/">Znote</a>.</p>
|
||||
|
||||
<h3>Thanks to: (in no particular order)</h3>
|
||||
<p>
|
||||
<a href="http://otland.net/members/chris/">Chris</a> - PHP OOP file samples, testing, bugfixing.
|
||||
<br><a href="http://otland.net/members/kiwi+dan/">Kiwi Dan</a> - Researching TFS 0.2 for me, participation in developement.
|
||||
<br><a href="http://otland.net/members/amoaz/">Amoaz</a> - Pentesting and security tips.
|
||||
<br><a href="http://otland.net/members/evan/">Evan</a> - Researching TFS 0.3, constructive feedback, suggestion and participation.
|
||||
<br><a href="http://otland.net/members/talaturen/">Talaturen</a> - Repository for this AAC.
|
||||
</p>
|
||||
|
||||
<?php include 'layout/overall/footer.php'; ?>
|
39
deaths.php
Normal file
39
deaths.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||
$cache = new Cache('engine/cache/deaths');
|
||||
if ($cache->hasExpired()) {
|
||||
|
||||
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
|
||||
$deaths = fetchLatestDeaths();
|
||||
} else if ($config['TFSVersion'] == 'TFS_03') {
|
||||
$deaths = fetchLatestDeaths_03(30);
|
||||
}
|
||||
$cache->setContent($deaths);
|
||||
$cache->save();
|
||||
} else {
|
||||
$deaths = $cache->load();
|
||||
}
|
||||
if ($deaths) {
|
||||
?>
|
||||
<h1>Latest Deaths</h1>
|
||||
<table id="deathsTable" class="table table-striped">
|
||||
<tr class="yellow">
|
||||
<th>Victim</th>
|
||||
<th>Time</th>
|
||||
<th>Killer</th>
|
||||
</tr>
|
||||
<?php foreach ($deaths as $death) {
|
||||
echo '<tr>';
|
||||
echo "<td>At level ". $death['level'] .": <a href='characterprofile.php?name=". $death['victim'] ."'>". $death['victim'] ."</a></td>";
|
||||
echo "<td>". getClock($death['time'], true) ."</td>";
|
||||
if ($death['is_player'] == 1) echo "<td>Player: <a href='characterprofile.php?name=". $death['killed_by'] ."'>". $death['killed_by'] ."</a></td>";
|
||||
else if ($death['is_player'] == 0) {
|
||||
if ($config['TFSVersion'] == 'TFS_03') echo "<td>Monster: ". ucfirst(str_replace("a ", "", $death['killed_by'])) ."</td>";
|
||||
else echo "<td>Monster: ". ucfirst($death['killed_by']) ."</td>";
|
||||
}
|
||||
else echo "<td>". $death['killed_by'] ."</td>";
|
||||
echo '</tr>';
|
||||
} ?>
|
||||
</table>
|
||||
<?php
|
||||
} else echo 'No deaths exist.';
|
||||
include 'layout/overall/footer.php'; ?>
|
30
downloads.php
Normal file
30
downloads.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
|
||||
|
||||
<h1>Downloads</h1>
|
||||
<p>In order to play, you need an compatible IP changer and a Tibia client.</p>
|
||||
|
||||
<p>Download otland IP changer <a href="http://static0.otland.net/ipchanger.exe">HERE</a>.</p>
|
||||
<p>Download Tibia client <?php echo ($config['client'] / 100); ?> <a href="<?php echo $config['client_download']; ?>">HERE</a>.</p>
|
||||
|
||||
<h2>How to connect and play:</h2>
|
||||
<ol>
|
||||
<li>
|
||||
<a href="http://remeresmapeditor.com/rmedl.php?file=tibia<?php echo ($config['client']); ?>.exe">Download</a>, install and start the tibia client if you havent already.
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://static0.otland.net/ipchanger.exe">Download</a> and run the IP changer.
|
||||
</li>
|
||||
<li>
|
||||
In the IP changer, write this in the IP field: <?php echo $_SERVER['SERVER_NAME']; ?>
|
||||
</li>
|
||||
<li>
|
||||
In the IP changer, write this in the Port field: <?php echo $config['port']; ?>
|
||||
</li>
|
||||
<li>
|
||||
Now you can successfully login on the tibia client and play. <br>
|
||||
If you do not have an account to login with, you need to register an account <a href="register.php">HERE</a>.
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<?php
|
||||
include 'layout/overall/footer.php'; ?>
|
4
failed.php
Normal file
4
failed.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
|
||||
<h1>Failed!</h1>
|
||||
<p>Something went wrong. :(</p>
|
||||
<?php include 'layout/overall/footer.php'; ?>
|
105
gallery.php
Normal file
105
gallery.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||
$logged_in = user_logged_in();
|
||||
if ($logged_in === true) {
|
||||
if (!empty($_POST['new'])) {
|
||||
?>
|
||||
<h1>Create image article</h1>
|
||||
<p>Only works with "Direct link" URLs from <a href="http://www.imgland.net/">imgland.net</a>
|
||||
<br />Don't understand? Don't worry! Watch this <a href="http://youtu.be/r9pEc7T3cJg" target="_BLANK">video guide!</a></p>
|
||||
<form action="" method="post">
|
||||
Image URL:<br /><input type="text" name="image" size="70"><br />
|
||||
Image Title:<br /><input type="text" name="title" size="70"><br />
|
||||
Image Describtion:<br /><textarea name="desc" cols="55" rows="15"></textarea><br />
|
||||
<input type="submit" name="Submit" value="Post Image Article">
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
if (!empty($_POST['image']) && !empty($_POST['title']) && !empty($_POST['desc'])) {
|
||||
$image = sanitize($_POST['image']);
|
||||
$image = str_replace("www", "", str_replace(":", "", str_replace("/", "", str_replace(".", "!", str_replace("imgland.net", "", str_replace("http", "", $image))))));
|
||||
$title = sanitize($_POST['title']);
|
||||
$desc = sanitize($_POST['desc']);
|
||||
|
||||
// Insert to database
|
||||
insertImage((int)$session_user_id, $title, $desc, $image);
|
||||
|
||||
$pw = explode("!", $image);
|
||||
?>
|
||||
<h1>Image Posted</h1>
|
||||
<p>However, your image will not be listed until a GM have verified it.<br />
|
||||
Feel free to remind the GM in-game to login on website and approve the image post.</p>
|
||||
<h2>Preview:</h2>
|
||||
<table>
|
||||
<tr class="yellow">
|
||||
<td><h3><?php echo $title; ?></h3></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?php echo 'http://'. $pw[0] .'.imgland.net/'. $pw[1] .'.'. $pw[2]; ?>" target="_BLANK"><img class="galleryImage" src="<?php echo 'http://'. $pw[0] .'.imgland.net/'. $pw[1] .'.'. $pw[2]; ?>"/></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
$descr = str_replace("\\r", "", $desc);
|
||||
$descr = str_replace("\\n", "<br />", $descr);
|
||||
?>
|
||||
<p><?php echo $descr; ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
if (empty($_POST)) {
|
||||
?>
|
||||
<h1>Gallery</h1>
|
||||
<?php if ($logged_in === true) { ?>
|
||||
<form action="" method="post">
|
||||
Got some cool images to show the community? <input type="submit" name="new" value="Add Image">
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
$cache = new Cache('engine/cache/gallery');
|
||||
$images = $cache->load();
|
||||
if ($images != false) {
|
||||
foreach($images as $image) {
|
||||
$pw = explode("!", $image['image']);
|
||||
?>
|
||||
<table>
|
||||
<tr class="yellow">
|
||||
<td><h3><?php echo $image['title']; ?></h3></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="<?php echo 'http://'. $pw[0] .'.imgland.net/'. $pw[1] .'.'. $pw[2]; ?>" target="_BLANK"><img class="galleryImage" src="<?php echo 'http://'. $pw[0] .'.imgland.net/'. $pw[1] .'.'. $pw[2]; ?>"/></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
$descr = str_replace("\\r", "", $image['desc']);
|
||||
$descr = str_replace("\\n", "<br />", $descr);
|
||||
?>
|
||||
<p><?php echo $descr; ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php }
|
||||
} else echo '<h2>There are currently no public images.</h2>';
|
||||
|
||||
if ($logged_in === false) echo 'You need to be logged in to add images.';
|
||||
}
|
||||
include 'layout/overall/footer.php';
|
||||
/*
|
||||
$url = strtolower("HTTP://1.imgland.net/pxPmUL.jpg");
|
||||
echo $url .'<br />';
|
||||
$url = str_replace("www", "", str_replace(":", "", str_replace("/", "", str_replace(".", "!", str_replace("imgland.net", "", str_replace("http", "", $url))))));
|
||||
$url = sanitize($url);
|
||||
echo $url;
|
||||
$url = explode("!", $url);
|
||||
<a href="<?php echo 'http://'. $url[0] .'.imgland.net/'. $url[1] .'.'. $url[2]; ?>"><img src="<?php echo 'http://'. $url[0] .'.imgland.net/'. $url[1] .'.'. $url[2]; ?>" width="650"/></a>
|
||||
echo time();
|
||||
//insertImage(2, "Yaay!", "Super describtion!", "1!pxpmul!jpg");
|
||||
*/?>
|
664
guilds.php
Normal file
664
guilds.php
Normal file
@ -0,0 +1,664 @@
|
||||
<?php require_once 'engine/init.php';
|
||||
if ($config['require_login']['guilds']) protect_page();
|
||||
include 'layout/overall/header.php';
|
||||
|
||||
if (user_logged_in() === true) {
|
||||
|
||||
// fetch data
|
||||
$char_count = user_character_list_count($session_user_id);
|
||||
$char_array = user_character_list($user_data['id']);
|
||||
|
||||
$characters = array();
|
||||
if ($char_array !== false) {
|
||||
foreach ($char_array as $value) {
|
||||
$characters[] = $value['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($_GET['name'])) {
|
||||
// Display the guild list
|
||||
?>
|
||||
|
||||
<h1>Guild List:</h1>
|
||||
<?php
|
||||
$guilds = get_guilds_list();
|
||||
if ($guilds !== false) {
|
||||
?>
|
||||
<table id="guildsTable" class="table table-striped table-hover">
|
||||
<tr class="yellow">
|
||||
<th>Guild name:</th>
|
||||
<th>Members:</th>
|
||||
<th>Founded:</th>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($guilds as $guild) {
|
||||
$gcount = count_guild_members($guild['id']);
|
||||
if ($gcount >= 1) {
|
||||
$url = url("guilds.php?name=". $guild['name']);
|
||||
echo '<tr class="special" onclick="javascript:window.location.href=\'' . $url . '\'">';
|
||||
echo '<td>'. $guild['name'] .'</td>';
|
||||
echo '<td>'. count_guild_members($guild['id']) .'</td>';
|
||||
echo '<td>'. getClock($guild['creationdata'], true) .'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php } else echo '<p>Guild list is empty.</p>';?>
|
||||
<!-- user stuff -->
|
||||
<?php
|
||||
if (user_logged_in() === true) {
|
||||
// post verifications
|
||||
// CREATE GUILD
|
||||
if (!empty($_POST['selected_char']) && !empty($_POST['guild_name'])) {
|
||||
if (user_character_account_id($_POST['selected_char']) === $session_user_id) {
|
||||
//code here
|
||||
$name = sanitize($_POST['selected_char']);
|
||||
$user_id = user_character_id($name);
|
||||
$char_data = user_character_data($user_id, 'level', 'online');
|
||||
|
||||
// If character level is high enough
|
||||
if ($char_data['level'] >= $config['create_guild_level']) {
|
||||
|
||||
// If character is offline
|
||||
if ($char_data['online'] == 0) {
|
||||
$acc_data = user_data($user_data['id'], 'premdays');
|
||||
|
||||
// If character is premium
|
||||
if ($config['guild_require_premium'] == false || $acc_data['premdays'] > 0) {
|
||||
|
||||
if (get_character_guild_rank($user_id) < 1) {
|
||||
|
||||
if (preg_match("/^[a-zA-Z_ ]+$/", $_POST['guild_name'])) {
|
||||
// Only allow normal symbols as guild name
|
||||
|
||||
$guildname = sanitize($_POST['guild_name']);
|
||||
|
||||
$gid = get_guild_id($guildname);
|
||||
if ($gid === false) {
|
||||
create_guild($user_id, $guildname);
|
||||
header('Location: success.php');
|
||||
exit();
|
||||
} else echo 'A guild with that name already exist.';
|
||||
} else echo 'Guild name may only contain a-z, A-Z and spaces.';
|
||||
} else echo 'You are already in a guild.';
|
||||
} else echo 'You need a premium account to create a guild.';
|
||||
} else echo 'Your character must be offline to create a guild.';
|
||||
} else echo $name .' is level '. $char_data['level'] .'. But you need level '. $config['create_guild_level'] .'+ to create your own guild!';
|
||||
}
|
||||
}
|
||||
// end
|
||||
?>
|
||||
|
||||
|
||||
<!-- FORMS TO CREATE GUILD-->
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>
|
||||
Create Guild:<br>
|
||||
<select name="selected_char">
|
||||
<?php
|
||||
for ($i = 0; $i < $char_count; $i++) {
|
||||
echo '<option value="'. $characters[$i] .'">'. $characters[$i] .'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<input type="text" name="guild_name">
|
||||
|
||||
<input type="submit" value="Create Guild">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
} else echo 'You need to be logged in to create guilds.';
|
||||
?>
|
||||
<!-- end user-->
|
||||
|
||||
<?php
|
||||
} else { // GUILD OVERVIEW
|
||||
$gid = get_guild_id($_GET['name']);
|
||||
if ($gid === false) {
|
||||
header('Location: guilds.php');
|
||||
exit();
|
||||
}
|
||||
$gcount = count_guild_members($gid);
|
||||
if ($gcount < 1) {
|
||||
header('Location: guilds.php');
|
||||
exit();
|
||||
}
|
||||
$inv_data = guild_invite_list($gid);
|
||||
$players = get_guild_players($gid);
|
||||
$inv_count = 0;
|
||||
|
||||
// Calculate invite count
|
||||
if ($inv_data !== false) {
|
||||
foreach ($inv_data as $inv) {
|
||||
++$inv_count;
|
||||
}
|
||||
}
|
||||
|
||||
// calculate visitor access
|
||||
if (user_logged_in() === true) {
|
||||
// Get visitor access in this guild
|
||||
$highest_access = 0;
|
||||
|
||||
foreach ($players as $player) {
|
||||
$rid = $player['rank_id'];
|
||||
|
||||
for ($i = 0; $i < $char_count; $i++) {
|
||||
$data = user_character_data(user_character_id($characters[$i]), 'rank_id');
|
||||
if ($data['rank_id'] == $rid) {
|
||||
$access = get_guild_position($data['rank_id']);
|
||||
if ($access == 2 || $access == 3) { //If player got access level vice leader or leader
|
||||
if ($access > $highest_access) $highest_access = $access;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Display the specific guild page
|
||||
?>
|
||||
|
||||
<h1>Guild: <?php echo sanitize($_GET['name']);
|
||||
?> </h1>
|
||||
<table id="guildViewTable" class="table table-striped">
|
||||
<tr class="yellow">
|
||||
<th>Rank:</th>
|
||||
<th>Name:</th>
|
||||
<th>Level:</th>
|
||||
<th>Vocation:</th>
|
||||
<th>Status:</th>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($players as $player) {
|
||||
$chardata = user_character_data(user_character_id($player['name']), 'online');
|
||||
echo '<tr>';
|
||||
echo '<td>'. get_player_guild_rank($player['rank_id']) .'</td>';
|
||||
echo '<td><a href="characterprofile.php?name='. $player['name'] .'">'. $player['name'] .'</a></td>';
|
||||
echo '<td>'. $player['level'] .'</td>';
|
||||
echo '<td>'. $config['vocations'][$player['vocation']] .'</td>';
|
||||
if ($chardata['online'] == 1) echo '<td> <b><font color="green"> Online </font></b></td>';
|
||||
else echo '<td> Offline </td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
<?php if ($inv_count > 0) { ?>
|
||||
<h3>Invited characters</h3>
|
||||
<table>
|
||||
<tr class="yellow">
|
||||
<td>Name:</td>
|
||||
<?php
|
||||
if ($highest_access == 2 || $highest_access == 3) {
|
||||
echo '<td>Remove:</td>';
|
||||
}
|
||||
// Shuffle through visitor characters
|
||||
for ($i = 0; $i < $char_count; $i++) {
|
||||
$exist = false;
|
||||
// Shuffle through invited character, see if they match your character.
|
||||
foreach ($inv_data as $inv) {
|
||||
if (user_character_id($characters[$i]) == $inv['player_id']) {
|
||||
$exist = true;
|
||||
}
|
||||
}
|
||||
if ($exist) echo '<td>Join Guild:</td><td>Reject Invitation:</td>';
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
$bool = false;
|
||||
foreach ($inv_data as $inv) {
|
||||
$uninv = user_character_data($inv['player_id'], 'name');
|
||||
echo '<tr>';
|
||||
echo '<td>'. $uninv['name'] .'</td>';
|
||||
// Remove invitation
|
||||
if ($highest_access == 2 || $highest_access == 3) {
|
||||
?> <form action="" method="post"> <?php
|
||||
echo '<td>';
|
||||
echo '<input type="hidden" name="uninvite" value="' . $inv['player_id'] . '" />';
|
||||
echo '<input type="submit" value="Remove Invitation">';
|
||||
echo '</td>';
|
||||
?> </form> <?php
|
||||
}
|
||||
// Join Guild
|
||||
?> <form action="" method="post"> <?php
|
||||
for ($i = 0; $i < $char_count; $i++) {
|
||||
if (user_character_id($characters[$i]) == $inv['player_id']) {
|
||||
echo '<td>';
|
||||
echo '<input type="hidden" name="joinguild" value="' . $inv['player_id'] . '" />';
|
||||
echo '<input type="submit" value="Join Guild">';
|
||||
echo '</td>';
|
||||
$bool = true;
|
||||
}
|
||||
}
|
||||
if (isset($bool, $exist) && !$bool && $exist) {
|
||||
echo '<td></td>';
|
||||
$bool = false;
|
||||
}
|
||||
?> </form> <?php
|
||||
// Reject invitation
|
||||
?> <form action="" method="post"> <?php
|
||||
for ($i = 0; $i < $char_count; $i++) {
|
||||
if (user_character_id($characters[$i]) == $inv['player_id']) {
|
||||
echo '<td>';
|
||||
echo '<input type="hidden" name="uninvite" value="' . $inv['player_id'] . '" />';
|
||||
echo '<input type="submit" value="Reject Invitation">';
|
||||
echo '</td>';
|
||||
$bool = true;
|
||||
}
|
||||
}
|
||||
if (isset($bool, $exist) && !$bool && $exist) {
|
||||
echo '<td></td>';
|
||||
$bool = false;
|
||||
}
|
||||
?> </form> <?php
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php } ?>
|
||||
<!-- Leader stuff -->
|
||||
<?php
|
||||
// Only guild leaders
|
||||
if (user_logged_in() === true) {
|
||||
|
||||
// Uninvite and joinguild is also used for visitors who reject their invitation.
|
||||
if (!empty($_POST['uninvite'])) {
|
||||
//
|
||||
guild_remove_invitation($_POST['uninvite'], $gid);
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
exit();
|
||||
}
|
||||
if (!empty($_POST['joinguild'])) {
|
||||
//
|
||||
foreach ($inv_data as $inv) {
|
||||
if ($inv['player_id'] == $_POST['joinguild']) {
|
||||
$chardata = user_character_data($_POST['joinguild'], 'online');
|
||||
if ($chardata['online'] == 0) {
|
||||
if (guild_player_join($_POST['joinguild'], $gid)) {
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
exit();
|
||||
} else echo '<font color="red" size="4">Failed to find guild position representing member.</font>';
|
||||
} else echo '<font color="red" size="4">Character must be offline before joining guild.</font>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_POST['leave_guild'])) {
|
||||
$name = sanitize($_POST['leave_guild']);
|
||||
$cidd = user_character_id($name);
|
||||
// If character is offline
|
||||
$chardata = user_character_data($cidd, 'online');
|
||||
if ($chardata['online'] == 0) {
|
||||
guild_player_leave($cidd);
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
exit();
|
||||
} else echo '<font color="red" size="4">Character must be offline first!</font>';
|
||||
}
|
||||
|
||||
if ($highest_access >= 2) {
|
||||
// Guild leader stuff
|
||||
|
||||
// Promote character to guild position
|
||||
if (!empty($_POST['promote_character']) && !empty($_POST['promote_position'])) {
|
||||
// Verify that promoted character is from this guild.
|
||||
$p_rid = $_POST['promote_position'];
|
||||
$p_cid = user_character_id($_POST['promote_character']);
|
||||
$p_guild = get_player_guild_data($p_cid);
|
||||
|
||||
if ($p_guild['guild_id'] == $gid) {
|
||||
// Do the magic.
|
||||
$chardata = user_character_data($p_cid, 'online');
|
||||
if ($chardata['online'] == 0) {
|
||||
update_player_guild_position($p_cid, $p_rid);
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
exit();
|
||||
} else echo '<font color="red" size="4">Character not offline.</font>';
|
||||
|
||||
}
|
||||
}
|
||||
if (!empty($_POST['invite'])) {
|
||||
if (user_character_exist($_POST['invite'])) {
|
||||
//
|
||||
$status = false;
|
||||
if ($inv_data !== false) {
|
||||
foreach ($inv_data as $inv) {
|
||||
if ($inv['player_id'] == user_character_id($_POST['invite'])) $status = true;
|
||||
}
|
||||
}
|
||||
foreach ($players as $player) {
|
||||
if ($player['name'] == $_POST['invite']) $status = true;
|
||||
}
|
||||
|
||||
if ($status == false) {
|
||||
guild_invite_player(user_character_id($_POST['invite']), $gid);
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
exit();
|
||||
} else echo '<font color="red" size="4">That character is already invited(or a member) on this guild.</font>';
|
||||
} else echo '<font color="red" size="4">That character name does not exist.</font>';
|
||||
}
|
||||
|
||||
if (!empty($_POST['disband'])) {
|
||||
//
|
||||
$gidd = (int)$_POST['disband'];
|
||||
$members = get_guild_players($gidd);
|
||||
$online = false;
|
||||
|
||||
// First figure out if anyone are online.
|
||||
foreach ($members as $member) {
|
||||
$chardata = user_character_data(user_character_id($member['name']), 'online');
|
||||
if ($chardata['online'] == 1) {
|
||||
$online = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$online) {
|
||||
// Then remove guild rank from every player.
|
||||
foreach ($members as $member) {
|
||||
//$chardata = user_character_data(user_character_id($member['name']), 'online');
|
||||
guild_player_leave(user_character_id($member['name']));
|
||||
}
|
||||
|
||||
// Remove all guild invitations to this guild
|
||||
if ($inv_count > 0) guild_remove_invites($gidd);
|
||||
|
||||
// Then remove the guild itself.
|
||||
guild_delete($gidd);
|
||||
header('Location: success.php');
|
||||
exit();
|
||||
} else echo '<font color="red" size="4">All members must be offline to disband the guild.</font>';
|
||||
}
|
||||
|
||||
if (!empty($_POST['new_leader'])) {
|
||||
$new_leader = (int)$_POST['new_leader'];
|
||||
$old_leader = guild_leader($gid);
|
||||
|
||||
$online = false;
|
||||
$newData = user_character_data($new_leader, 'online');
|
||||
$oldData = user_character_data($old_leader, 'online');
|
||||
if ($newData['online'] == 1 || $oldData['online'] == 1) $online = true;
|
||||
|
||||
if ($online == false) {
|
||||
if (guild_change_leader($new_leader, $old_leader)) {
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
exit();
|
||||
} else echo '<font color="red" size="4">Something went wrong when attempting to change leadership.</font>';
|
||||
} else echo '<font color="red" size="4">The new and old leader must be offline to change leadership.</font>';
|
||||
}
|
||||
|
||||
if (!empty($_POST['change_ranks'])) {
|
||||
$c_gid = (int)$_POST['change_ranks'];
|
||||
$c_ranks = get_guild_rank_data($c_gid);
|
||||
$rank_data = array();
|
||||
$rank_ids = array();
|
||||
|
||||
// Feed new rank data
|
||||
foreach ($c_ranks as $rank) {
|
||||
$tmp = 'rank_name!'. $rank['level'];
|
||||
if (!empty($_POST[$tmp])) {
|
||||
$rank_data[$rank['level']] = sanitize($_POST[$tmp]);
|
||||
$rank_ids[$rank['level']] = $rank['id'];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($rank_data as $level => $name) {
|
||||
guild_change_rank($rank_ids[$level], $name);
|
||||
}
|
||||
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!empty($_POST['remove_member'])) {
|
||||
$name = sanitize($_POST['remove_member']);
|
||||
$cid = user_character_id($name);
|
||||
|
||||
guild_remove_member($cid);
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!empty($_POST['forumGuildId'])) {
|
||||
if ($config['forum']['guildboard'] === true) {
|
||||
$forumExist = mysql_select_single("SELECT `id` FROM `znote_forum` WHERE `guild_id`='$gid' LIMIT 1;");
|
||||
if ($forumExist === false) {
|
||||
// Insert data
|
||||
mysql_insert("INSERT INTO `znote_forum` (`name`, `access`, `closed`, `hidden`, `guild_id`)
|
||||
VALUES ('Guild',
|
||||
'1',
|
||||
'0',
|
||||
'0',
|
||||
'$gid');");
|
||||
echo '<h1>Guild board has been created.</h1>';
|
||||
} else echo '<h1>Guild board already exist.</h1>';
|
||||
|
||||
} else {
|
||||
echo '<h1>Error: Guild board system is disabled.</h1>';
|
||||
}
|
||||
}
|
||||
|
||||
$members = count_guild_members($gid);
|
||||
$ranks = get_guild_rank_data($gid);
|
||||
?>
|
||||
<!-- Form to create guild -->
|
||||
<?php
|
||||
if ($config['forum']['guildboard'] === true && $config['forum']['enabled'] === true) {
|
||||
$forumExist = mysql_select_single("SELECT `id` FROM `znote_forum` WHERE `guild_id`='$gid' LIMIT 1;");
|
||||
if ($forumExist === false) {
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>Create forum guild board:<br>
|
||||
<input type="hidden" name="forumGuildId" value="<?php echo $gid; ?>">
|
||||
<input type="submit" value="Create Guild Board">
|
||||
</ul>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- forms to invite character -->
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>Invite Character to guild:<br>
|
||||
<input type="text" name="invite" placeholder="Character name">
|
||||
<input type="submit" value="Invite Character">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<?php if ($members > 1) { ?>
|
||||
<!-- FORMS TO PROMOTE CHARACTER-->
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>
|
||||
Promote Character:<br>
|
||||
<select name="promote_character">
|
||||
<?php
|
||||
//$gid = get_guild_id($_GET['name']);
|
||||
//$players = get_guild_players($gid);
|
||||
foreach ($players as $player) {
|
||||
$pl_data = get_player_guild_data(user_character_id($player['name']));
|
||||
if ($pl_data['rank_level'] != 3) {
|
||||
echo '<option value="'. $player['name'] .'">'. $player['name'] .'</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<select name="promote_position">
|
||||
<?php
|
||||
foreach ($ranks as $rank) {
|
||||
if ($rank['level'] != 3) {
|
||||
if ($rank['level'] != 2) {
|
||||
echo '<option value="'. $rank['id'] .'">'. $rank['name'] .'</option>';
|
||||
} else {
|
||||
if ($highest_access == 3) {
|
||||
echo '<option value="'. $rank['id'] .'">'. $rank['name'] .'</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<input type="submit" value="Promote Member">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<!-- Remove member from guild -->
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>
|
||||
Kick member from guild:<br>
|
||||
<select name="remove_member">
|
||||
<?php
|
||||
//$gid = get_guild_id($_GET['name']);
|
||||
//$players = get_guild_players($gid);
|
||||
foreach ($players as $player) {
|
||||
$pl_data = get_player_guild_data(user_character_id($player['name']));
|
||||
if ($pl_data['rank_level'] != 3) {
|
||||
if ($pl_data['rank_level'] != 2) {
|
||||
echo '<option value="'. $player['name'] .'">'. $player['name'] .'</option>';
|
||||
} else if ($highest_access == 3) echo '<option value="'. $player['name'] .'">'. $player['name'] .'</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<input type="submit" value="Remove member">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<?php } ?>
|
||||
<br><br>
|
||||
<?php if ($highest_access == 3) { ?>
|
||||
<!-- forms to change rank titles -->
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li><b>Change rank titles:</b><br>
|
||||
<?php
|
||||
$rank_count = 1;
|
||||
foreach ($ranks as $rank) {
|
||||
echo '<input type="text" name="rank_name!'. $rank['level'] .'" value="'. $rank['name'] .'">';
|
||||
}
|
||||
echo '<input type="hidden" name="change_ranks" value="' . $gid . '" />';
|
||||
?>
|
||||
<input type="submit" value="Update Ranks">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<!-- forms to disband guild -->
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li><b>DELETE GUILD (All members must be offline):</b><br>
|
||||
<?php echo '<input type="hidden" name="disband" value="' . $gid . '" />'; ?>
|
||||
<input type="submit" value="Disband Guild">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<!-- forms to change leadership-->
|
||||
<?php if ($members > 1) { ?>
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li><b>Change Leadership with:</b><br>
|
||||
<select name="new_leader">
|
||||
<?php
|
||||
//$gid = get_guild_id($_GET['name']);
|
||||
//$players = get_guild_players($gid);
|
||||
foreach ($players as $player) {
|
||||
$pl_data = get_player_guild_data(user_character_id($player['name']));
|
||||
if ($pl_data['rank_level'] != 3) {
|
||||
echo '<option value="'. user_character_id($player['name']) .'">'. $player['name'] .'</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<input type="submit" value="Change Leadership">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<?php }} ?>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!-- end leader-->
|
||||
<?php
|
||||
if ($config['TFSVersion'] == 'TFS_02') $wardata = get_guild_wars();
|
||||
else if ($config['TFSVersion'] == 'TFS_03') $wardata = get_guild_wars03();
|
||||
else die("Can't recognize TFS version. It has to be either TFS_02 or TFS_03. Correct this in config.php");
|
||||
$war_exist = false;
|
||||
if ($wardata !== false) {
|
||||
foreach ($wardata as $wars) {
|
||||
if ($wars['guild1'] == $gid || $wars['guild2'] == $gid) $war_exist = true;
|
||||
}
|
||||
}
|
||||
if ($war_exist && $config['guildwar_enabled'] === true) {
|
||||
?>
|
||||
<h2>War overview:</h2>
|
||||
<table>
|
||||
<tr class="yellow">
|
||||
<td>Attacker:</td>
|
||||
<td>Defender:</td>
|
||||
<td>status:</td>
|
||||
<td>started:</td>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($wardata as $wars) {
|
||||
if ($wars['guild1'] == $gid || $wars['guild2'] == $gid) {
|
||||
$url = url("guildwar.php?warid=". $wars['id']);
|
||||
echo '<tr class="special" onclick="javascript:window.location.href=\'' . $url . '\'">';
|
||||
echo '<td>'. $wars['name1'] .'</td>';
|
||||
echo '<td>'. $wars['name2'] .'</td>';
|
||||
echo '<td>'. $config['war_status'][$wars['status']] .'</td>';
|
||||
echo '<td>'. getClock($wars['started'], true) .'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php } ?>
|
||||
<!-- leave guild with character -->
|
||||
<?php
|
||||
$bool = false;
|
||||
if (user_logged_in() === true) {
|
||||
for ($i = 0; $i < $char_count; $i++) {
|
||||
foreach ($players as $player) {
|
||||
if ($player['name'] == $characters[$i]) $bool = true;
|
||||
}
|
||||
}
|
||||
if ($bool) {
|
||||
$forumExist = mysql_select_single("SELECT `id` FROM `znote_forum` WHERE `guild_id`='$gid' LIMIT 1;");
|
||||
if ($forumExist !== false) {
|
||||
?> - <font size="4"><a href="forum.php?cat=<?php echo $forumExist['id']; ?>">Visit Guild Board</a></font><br><br><br><?php
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>
|
||||
Leave Guild:<br>
|
||||
<select name="leave_guild">
|
||||
<option disabled>With...</option>
|
||||
<?php
|
||||
for ($i = 0; $i < $char_count; $i++) {
|
||||
foreach ($players as $player) {
|
||||
if ($player['name'] == $characters[$i]) {
|
||||
$data = get_player_guild_data(user_character_id($player['name']));
|
||||
if ($data['rank_level'] != 3) echo '<option value="'. $characters[$i] .'">'. $characters[$i] .'</option>';
|
||||
else echo '<option disabled>'. $characters[$i] .' [disabled:Leader]</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<input type="submit" value="Leave Guild">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<?php
|
||||
} // display form if user has a character in guild
|
||||
} // user logged in
|
||||
} // if warname as $_GET
|
||||
include 'layout/overall/footer.php'; ?>
|
185
guildwar.php
Normal file
185
guildwar.php
Normal file
@ -0,0 +1,185 @@
|
||||
<?php require_once 'engine/init.php';
|
||||
if ($config['require_login']['guildwars']) protect_page();
|
||||
if ($config['log_ip']) znote_visitor_insert_detailed_data(3);
|
||||
if ($config['guildwar_enabled'] === false) {
|
||||
header('Location: guilds.php');
|
||||
exit();
|
||||
}
|
||||
include 'layout/overall/header.php';
|
||||
|
||||
if (!empty($_GET['warid'])) {
|
||||
$warid = (int)$_GET['warid']; // Sanitizing GET.
|
||||
|
||||
if ($config['TFSVersion'] == 'TFS_02') $war = get_guild_war($warid);
|
||||
else if ($config['TFSVersion'] == 'TFS_03') $war = get_guild_war03($warid);
|
||||
else die("Can't recognize TFS version. It has to be either TFS_02 or TFS_03. Correct this in config.php");
|
||||
|
||||
if ($war != false) {
|
||||
// Kills data for this specific war entry
|
||||
if ($config['TFSVersion'] == 'TFS_02') $kills = get_war_kills($warid);
|
||||
else if ($config['TFSVersion'] == 'TFS_03') $kills = get_war_kills03($warid);
|
||||
// XDXD
|
||||
|
||||
?>
|
||||
<h1><?php echo $war['name1']; ?> - VERSUS - <?php echo $war['name2']; ?></h1>
|
||||
|
||||
<?php
|
||||
// Collecting <ul> data:
|
||||
$guild1 = $war['guild1'];
|
||||
$g1c = 0; // kill count
|
||||
|
||||
$guild2 = $war['guild2'];
|
||||
$g2c = 0; // kill count
|
||||
|
||||
if ($config['TFSVersion'] == 'TFS_02') {
|
||||
foreach ($kills as $kill) {
|
||||
if ($kill[killerguild] == $guild1) ++$g1c;
|
||||
if ($kill[killerguild] == $guild2) ++$g2c;
|
||||
}
|
||||
|
||||
$green = false;
|
||||
if ($g1c > $g2c) {
|
||||
$leading = $war['name1'];
|
||||
$green = true;
|
||||
} else if ($g2c > $g1c) $leading = $war['name2'];
|
||||
else $leading = "Tie";
|
||||
}
|
||||
?>
|
||||
<ul class="war_list">
|
||||
<li>
|
||||
War status: <?php echo $config['war_status'][$war['status']]; ?>.
|
||||
</li>
|
||||
<?php if ($config['TFSVersion'] == 'TFS_02') { ?>
|
||||
<li>
|
||||
Leading guild: <?php echo $leading; ?>.
|
||||
</li>
|
||||
<li>
|
||||
<?php
|
||||
if ($green) echo 'Score: <font color="green">'. $g1c .'</font>-<font color="red">'. $g2c .'</font>';
|
||||
else if ($g1c = $g2c) echo 'Score: <font color="orange">'. $g1c .'</font>-<font color="orange">'. $g2c .'</font>';
|
||||
else echo 'Score: <font color="red">'. $g1c .'</font>-<font color="green">'. $g2c .'</font>';
|
||||
?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<?php
|
||||
if ($config['TFSVersion'] == 'TFS_02') {
|
||||
?>
|
||||
<table id="guildwarTable" class="table table-striped table-hover">
|
||||
<tr class="yellow">
|
||||
<th>Killer's guild:</th>
|
||||
<th>Killer:</th>
|
||||
<th>Victim:</th>
|
||||
<th>Time:</th>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($kills as $kill) {
|
||||
echo '<tr>';
|
||||
//echo '<td>'. get_guild_name($kill['killerguild']) .'</td>';
|
||||
echo '<td><a href="guilds.php?name='. get_guild_name($kill['killerguild']) .'">'. get_guild_name($kill['killerguild']) .'</a></td>';
|
||||
echo '<td><a href="characterprofile.php?name='. $kill['killer'] .'">'. $kill['killer'] .'</a></td>';
|
||||
echo '<td><a href="characterprofile.php?name='. $kill['target'] .'">'. $kill['target'] .'</a></td>';
|
||||
echo '<td>'. getClock($kill['time'], true) .'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
if ($config['TFSVersion'] == 'TFS_03') {
|
||||
// BORROWED FROM GESIOR (and ported to work on Znote AAC).
|
||||
$main_content = "";
|
||||
$deaths = gesior_sql_death($warid);
|
||||
if($deaths !== false)
|
||||
{
|
||||
//die(print_r($deaths));
|
||||
foreach($deaths as $death)
|
||||
{
|
||||
$killers = gesior_sql_killer((int)$death['id']);
|
||||
$count = count($killers); $i = 0;
|
||||
|
||||
$others = false;
|
||||
$main_content .= date("j M Y, H:i", $death['date']) . " <span style=\"font-weight: bold; color: " . ($death['enemy'] == $war['guild_id'] ? "red" : "lime") . ";\">+</span>
|
||||
<a href=\"characterprofile.php?name=" . urlencode($death['name']) . "\"><b>".$death['name']."</b></a> ";
|
||||
foreach($killers as $killer)
|
||||
{
|
||||
$i++;
|
||||
if($killer['is_war'] != 0)
|
||||
{
|
||||
if($i == 1)
|
||||
$main_content .= "killed at level <b>".$death['level']."</b> by ";
|
||||
else if($i == $count && $others == false)
|
||||
$main_content .= " and by ";
|
||||
else
|
||||
$main_content .= ", ";
|
||||
if($killer['player_exists'] == 0)
|
||||
$main_content .= "<a href=\"characterprofile.php?name=".urlencode($killer['player_name'])."\">";
|
||||
|
||||
$main_content .= $killer['player_name'];
|
||||
if($killer['player_exists'] == 0)
|
||||
$main_content .= "</a>";
|
||||
}
|
||||
else
|
||||
$others = true;
|
||||
|
||||
if($i == $count)
|
||||
{
|
||||
if($others == true)
|
||||
$main_content .= " and few others";
|
||||
$main_content .= ".<br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
$main_content .= "<center>There were no frags on this war so far.</center>";
|
||||
echo $main_content;
|
||||
// END BORROWED FROM GESIOR
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// Display current wars.
|
||||
|
||||
// Fetch list of wars
|
||||
if ($config['TFSVersion'] == 'TFS_02') $wardata = get_guild_wars();
|
||||
else if ($config['TFSVersion'] == 'TFS_03') $wardata = get_guild_wars03();
|
||||
else die("Can't recognize TFS version. It has to be either TFS_02 or TFS_03. Correct this in config.php");
|
||||
//echo $wardata[0]['name1'];
|
||||
//die(var_dump($wardata));
|
||||
if ($wardata != false) {
|
||||
|
||||
// kills data
|
||||
$killsdata = array(); // killsdata[guildid] => array(warid) => array info about the selected war entry
|
||||
foreach ($wardata as $wars) {
|
||||
if ($config['TFSVersion'] == 'TFS_02') $killsdata[$wars['id']] = get_war_kills($wars['id']);
|
||||
else if ($config['TFSVersion'] == 'TFS_03') $killsdata[$wars['id']] = get_war_kills03($wars['id']);
|
||||
}
|
||||
?>
|
||||
|
||||
<table id="guildwarViewTable" class="table table-striped table-hover">
|
||||
<tr class="yellow">
|
||||
<th>Attacking Guild:</th>
|
||||
<th>Death Count:</th>
|
||||
<th>Defending Guild:</th>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($wardata as $wars) {
|
||||
$url = url("guildwar.php?warid=". $wars['id']);
|
||||
echo '<tr class="special" onclick="javascript:window.location.href=\'' . $url . '\'">';
|
||||
echo '<td>'. $wars['name1'] .'</td>';
|
||||
echo '<td>'. count($killsdata[$wars['id']]) .'</td>';
|
||||
echo '<td>'. $wars['name2'] .'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
echo 'There have not been any pending wars on this server.';
|
||||
}
|
||||
}
|
||||
// GET links sample:
|
||||
// guildwar.php?warid=1
|
||||
include 'layout/overall/footer.php'; ?>
|
110
highscores.php
Normal file
110
highscores.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||
if ($config['log_ip']) {
|
||||
znote_visitor_insert_detailed_data(3);
|
||||
}
|
||||
if (empty($_POST) === false) {
|
||||
|
||||
#if ($_POST['token'] == $_SESSION['token']) {
|
||||
|
||||
/* Token used for cross site scripting security */
|
||||
if (isset($_POST['token']) && Token::isValid($_POST['token'])) {
|
||||
|
||||
$skillid = (int)$_POST['selected'];
|
||||
$cache = new Cache('engine/cache/highscores');
|
||||
|
||||
if ($cache->hasExpired()) {
|
||||
if ($config['TFSVersion'] != 'TFS_10') $tmp = highscore_getAll();
|
||||
else $tmp = highscore_getAll_10(0, 30);
|
||||
|
||||
$cache->setContent($tmp);
|
||||
$cache->save();
|
||||
|
||||
$array = isset($tmp[$skillid]) ? $tmp[$skillid] : $tmp[7];
|
||||
} else {
|
||||
$tmp = $cache->load();
|
||||
$array = $tmp[$skillid];
|
||||
}
|
||||
|
||||
if ($skillid < 9) {
|
||||
// Design and present the list
|
||||
if ($array) {
|
||||
?>
|
||||
<h2>
|
||||
<?php echo ucfirst(skillid_to_name($skillid)); ?> scoreboard. Next update:
|
||||
<?php
|
||||
if ($cache->remainingTime() > 0) {
|
||||
$hours = seconds_to_hours($cache->remainingTime());
|
||||
$minutes = ($hours - (int)$hours) * 60;
|
||||
$seconds = ($minutes - (int)$minutes) * 60;
|
||||
if ($hours >= 1) {
|
||||
echo (int)$hours .'h';
|
||||
}
|
||||
if ($minutes >= 1) {
|
||||
echo ' '. (int)$minutes .'m';
|
||||
}
|
||||
if ($seconds >= 1) {
|
||||
echo ' '. (int)$seconds .'s';
|
||||
}
|
||||
} else {
|
||||
echo '0s';
|
||||
}
|
||||
|
||||
?>. <?php echo remaining_seconds_to_clock($cache->remainingTime());?>
|
||||
</h2>
|
||||
<table id="highscoresTable" class="table table-striped table-hover">
|
||||
<tr class="yellow">
|
||||
<th>Name:</th>
|
||||
<?php
|
||||
if ($skillid == 7) echo '<th>Level:</th><th>Experience:</th>';
|
||||
else {
|
||||
?>
|
||||
<th>Value:</th>
|
||||
<?php
|
||||
}
|
||||
if ($skillid == 7 || $skillid == 6 || $skillid == 5) {
|
||||
echo '<th>Vocation:</th>';
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($array as $value) {
|
||||
// start foreach
|
||||
if ($value['group_id'] < 2) {
|
||||
echo '<tr>';
|
||||
echo '<td><a href="characterprofile.php?name='. $value['name'] .'">'. $value['name'] .'</a></td>';
|
||||
if ($skillid == 7) echo '<td>'. $value['level'] .'</td>';
|
||||
echo '<td>'. $value['value'] .'</td>';
|
||||
if ($skillid == 7 || $skillid == 6 || $skillid == 5) {
|
||||
echo '<td>'. $value['vocation'] .'</td>';
|
||||
}
|
||||
echo '</tr>';
|
||||
}
|
||||
// end foreach
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
} else {
|
||||
echo 'Empty list, it appears all players have less than 500 experience points.';
|
||||
}
|
||||
//Done.
|
||||
}
|
||||
} else {
|
||||
echo 'Token appears to be incorrect.<br><br>';
|
||||
//Token::debug($_POST['token']);
|
||||
echo 'Please clear your web cache/cookies <b>OR</b> use another web browser<br>';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
0 fist: SELECT (SELECT `name` from `players` WHERE `player_id`=`id`) AS `name`, `value` FROM `player_skills` WHERE `skillid`=0
|
||||
1 club:
|
||||
2 sword:
|
||||
3 axe:
|
||||
4 dist:
|
||||
5 Shield:
|
||||
6 Fish
|
||||
7 Hardcoded experience
|
||||
8 Hardcoded maglevel
|
||||
*/
|
||||
include 'layout/overall/footer.php'; ?>
|
145
houses.php
Normal file
145
houses.php
Normal file
@ -0,0 +1,145 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||
if ($config['log_ip']) {
|
||||
znote_visitor_insert_detailed_data(3);
|
||||
}
|
||||
if (empty($_POST) === false && $config['TFSVersion'] === 'TFS_03') {
|
||||
|
||||
#if ($_POST['token'] == $_SESSION['token']) {
|
||||
|
||||
/* Token used for cross site scripting security */
|
||||
if (isset($_POST['token']) && Token::isValid($_POST['token'])) {
|
||||
|
||||
$townid = (int)$_POST['selected'];
|
||||
$cache = new Cache('engine/cache/houses');
|
||||
$array = array();
|
||||
if ($cache->hasExpired()) {
|
||||
$tmp = fetchAllHouses_03();
|
||||
$cache->setContent($tmp);
|
||||
$cache->save();
|
||||
|
||||
foreach ($tmp as $t) {
|
||||
if ($t['town'] == $townid) $array[] = $t;
|
||||
}
|
||||
$array = isset($array) ? $array : false;
|
||||
} else {
|
||||
$tmp = $cache->load();
|
||||
foreach ($tmp as $t) {
|
||||
if ($t['town'] == $townid) $array[] = $t;
|
||||
}
|
||||
$array = isset($array) ? $array : false;
|
||||
}
|
||||
|
||||
// Design and present the list
|
||||
if ($array) {
|
||||
?>
|
||||
<h2>
|
||||
<?php echo ucfirst(town_id_to_name($townid)); ?> house list.
|
||||
</h2>
|
||||
<table id="housesTable" class="table table-striped">
|
||||
<tr class="yellow">
|
||||
<th>Name:</th>
|
||||
<th>Size:</th>
|
||||
<th>Doors:</th>
|
||||
<th>Beds:</th>
|
||||
<th>Price:</th>
|
||||
<th>Owner:</th>
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($array as $value) {
|
||||
// start foreach
|
||||
echo '<tr>';
|
||||
echo "<td>". $value['name'] ."</td>";
|
||||
echo "<td>". $value['size'] ."</td>";
|
||||
echo "<td>". $value['doors'] ."</td>";
|
||||
echo "<td>". $value['beds'] ."</td>";
|
||||
echo "<td>". $value['price'] ."</td>";
|
||||
if ($value['owner'] == 0) echo "<td>None</td>";
|
||||
else {
|
||||
$data = user_character_data($value['owner'], 'name');
|
||||
echo '<td><a href="characterprofile.php?name='. $data['name'] .'">'. $data['name'] .'</a></td>';
|
||||
}
|
||||
echo '</tr>';
|
||||
// end foreach
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
} else {
|
||||
echo 'Empty list, it appears no houses are listed in this town.';
|
||||
}
|
||||
//Done.
|
||||
} else {
|
||||
echo 'Token appears to be incorrect.<br><br>';
|
||||
//Token::debug($_POST['token']);
|
||||
echo 'Please clear your web cache/cookies <b>OR</b> use another web browser<br>';
|
||||
}
|
||||
} else {
|
||||
if (empty($_POST) === true && $config['TFSVersion'] === 'TFS_03') {
|
||||
if ($config['allowSubPages']) header('Location: sub.php?page=houses');
|
||||
else echo 'Sub page system disabled.';
|
||||
} else if ($config['TFSVersion'] === 'TFS_02') {
|
||||
$house = $config['house'];
|
||||
if (!is_file($house['house_file'])) {
|
||||
echo("<h3>House file not found</h3><p>FAILED TO LOCATE/READ FILE AT:<br><font color='red'>". $house['house_file'] ."</font><br><br>LINUX users: Make sure www-data have read access to file.<br>WINDOWS users: Learn to write correct file path.</p>");
|
||||
exit();
|
||||
}
|
||||
|
||||
// Load and cache SQL house data:
|
||||
$cache = new Cache('engine/cache/houses/sqldata');
|
||||
if ($cache->hasExpired()) {
|
||||
$house_query = mysql_select_multi('SELECT `players`.`name`, `houses`.`id` FROM `players`, `houses` WHERE `houses`.`owner` = `players`.`id`;');
|
||||
|
||||
$cache->setContent($house_query);
|
||||
$cache->save();
|
||||
} else {
|
||||
$house_query = $cache->load();
|
||||
}
|
||||
|
||||
$sqmPrice = $house['price_sqm'];
|
||||
$house_load = simplexml_load_file($house['house_file']);
|
||||
if ($house_query !== false && $house_load !== false) {
|
||||
?>
|
||||
<h2>House list</h2>
|
||||
<table>
|
||||
<tr class="yellow">
|
||||
<td><b>House</b></td>
|
||||
<td><b>Location</b></td>
|
||||
<td><b>Owner</b></td>
|
||||
<td><b>Size</b></td><td><b>Rent</b></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
//execute code.
|
||||
foreach($house_query as $row) {
|
||||
$house_info[(int)$row['id']] = '<a href="characterprofile.php?name='. $row['name'] .'">'. $row['name'] .'</a>';
|
||||
}
|
||||
foreach ($house_load as $house_fetch){
|
||||
$house_price = (int)$house_fetch['size'] * $sqmPrice;
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($house_fetch['name']); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if (isset($config['towns'][(int)$house_fetch['townid']])) echo htmlspecialchars($config['towns'][(int)$house_fetch['townid']]);
|
||||
else echo '(Missing town)';
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
if (isset($house_info[(int)$house_fetch['houseid']])) echo $house_info[(int)$house_fetch['houseid']];
|
||||
else echo 'None [Available]';
|
||||
?>
|
||||
</td>
|
||||
<td><?php echo $house_fetch['size']; ?></td>
|
||||
<td><?php echo $house_price; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
} else echo '<p><font color="red">Something is wrong with the cache.</font></p>';
|
||||
}
|
||||
}
|
||||
include 'layout/overall/footer.php'; ?>
|
51
index.php
Normal file
51
index.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||
if ($config['allowSubPages'] && file_exists("layout/sub/index.php")) include 'layout/sub/index.php';
|
||||
else {
|
||||
$cache = new Cache('engine/cache/news');
|
||||
if ($cache->hasExpired()) {
|
||||
$news = fetchAllNews();
|
||||
|
||||
$cache->setContent($news);
|
||||
$cache->save();
|
||||
} else {
|
||||
$news = $cache->load();
|
||||
}
|
||||
|
||||
// Design and present the list
|
||||
if ($news) {
|
||||
function TransformToBBCode($string) {
|
||||
$tags = array(
|
||||
'[center]{$1}[/center]' => '<center>$1</center>',
|
||||
'[b]{$1}[/b]' => '<b>$1</b>',
|
||||
'[size={$1}]{$2}[/size]' => '<font size="$1">$2</font>',
|
||||
'[img]{$1}[/img]' => '<a href="$1" target="_BLANK"><img src="$1" alt="image" style="width: 100%"></a>',
|
||||
'[link]{$1}[/link]' => '<a href="$1">$1</a>',
|
||||
'[link={$1}]{$2}[/link]' => '<a href="$1" target="_BLANK">$2</a>',
|
||||
'[color={$1}]{$2}[/color]' => '<font color="$1">$2</font>',
|
||||
'[*]{$1}[/*]' => '<li>$1</li>',
|
||||
);
|
||||
foreach ($tags as $tag => $value) {
|
||||
$code = preg_replace('/placeholder([0-9]+)/', '(.*?)', preg_quote(preg_replace('/\{\$([0-9]+)\}/', 'placeholder$1', $tag), '/'));
|
||||
$string = preg_replace('/'.$code.'/i', $value, $string);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
foreach ($news as $n) {
|
||||
?>
|
||||
<table id="news">
|
||||
<tr class="yellow">
|
||||
<td class="zheadline"><?php echo getClock($n['date'], true) .' by <a href="characterprofile.php?name='. $n['name'] .'">'. $n['name'] .'</a> - <b>'. TransformToBBCode($n['title']) .'</b>'; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p><?php echo TransformToBBCode(nl2br($n['text'])); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
echo '<p>No news exist.</p>';
|
||||
}
|
||||
}
|
||||
include 'layout/overall/footer.php'; ?>
|
87
ipn.php
Normal file
87
ipn.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
// Require the functions to connect to database and fetch config values
|
||||
require 'config.php';
|
||||
require 'engine/database/connect.php';
|
||||
|
||||
// Fetch paypal configurations
|
||||
$paypal = $config['paypal'];
|
||||
$prices = $config['paypal_prices'];
|
||||
|
||||
// read the post from PayPal system and add 'cmd'
|
||||
$req = 'cmd=_notify-validate';
|
||||
foreach ($_POST as $key => $value) {
|
||||
$value = urlencode(stripslashes($value));
|
||||
$req .= "&$key=$value";
|
||||
}
|
||||
|
||||
// post back to PayPal system to validate
|
||||
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
|
||||
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
|
||||
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
|
||||
$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
|
||||
|
||||
// assign posted variables to local variables
|
||||
$item_name = $_POST['item_name'];
|
||||
$item_number = $_POST['item_number'];
|
||||
$payment_status = $_POST['payment_status'];
|
||||
$payment_amount = $_POST['mc_gross'];
|
||||
$payment_currency = $_POST['mc_currency'];
|
||||
$txn_id = mysql_real_escape_string($_POST['txn_id']);
|
||||
$receiver_email = $_POST['receiver_email'];
|
||||
$payer_email = mysql_real_escape_string($_POST['payer_email']);
|
||||
$custom = $_POST['custom'];
|
||||
|
||||
if (!$fp) {
|
||||
// HTTP ERROR
|
||||
} else {
|
||||
fputs ($fp, $header . $req);
|
||||
while (!feof($fp)) {
|
||||
$res = fgets ($fp, 1024);
|
||||
if (strcmp ($res, "VERIFIED") == 0) {
|
||||
if ($payment_status == 'Completed') {
|
||||
$txn_id_check = mysql_query("SELECT `txn_id` FROM `znote_paypal` WHERE `txn_id`='$txn_id'");
|
||||
if (mysql_num_rows($txn_id_check) != 1) {
|
||||
if ($receiver_email == $paypal['email']) {
|
||||
|
||||
$status = true;
|
||||
$pieces = explode("!", $custom);
|
||||
// TODO - fix this logic
|
||||
// 0 = user_id, 1 = price, 2 = points
|
||||
$f_user_id = (int)$pieces[0];
|
||||
$f_price = (float)$pieces[1];
|
||||
$f_points = (int)$pieces[2];
|
||||
if ($payment_amount != $f_price) $status = false; // If he paid wrong ammount
|
||||
if ($payment_currency != $paypal['currency']) $status = false; // If he paid using another currency
|
||||
|
||||
// Verify that the user havent messed around with POST data
|
||||
if ($status) {
|
||||
$status = false;
|
||||
foreach ($prices as $price => $points) {
|
||||
if ($price == $f_price && $points == $f_points) $status = true; // data does not appear to be manipulated.
|
||||
}
|
||||
if ($status) {
|
||||
// transaction log
|
||||
$log_query = mysql_query("INSERT INTO `znote_paypal` VALUES ('', '$txn_id', '$payer_email', '$f_user_id', '".(int)$f_price."', '".(int)$f_points."')");
|
||||
|
||||
// Give points to user
|
||||
$old_points = mysql_result(mysql_query("SELECT `points` FROM `znote_accounts` WHERE `account_id`='$f_user_id';"), 0, 'points');
|
||||
$new_points = (int)$f_points;
|
||||
$new_points += $old_points;
|
||||
$update_account = mysql_query("UPDATE `znote_accounts` SET `points`='$new_points' WHERE `account_id`='$f_user_id'");
|
||||
} else mysql_query("INSERT INTO `znote_paypal` VALUES ('', '$txn_id', 'ERROR: HACKER detected: $payer_email', '$f_user_id', '".(int)$f_price."', '".(int)$f_points."')");
|
||||
}
|
||||
} else {
|
||||
$pmail = $paypal['email'];
|
||||
mysql_query("INSERT INTO `znote_paypal` VALUES ('', '$txn_id', 'ERROR: Wrong mail. Received: $receiver_email, configured: $pmail', '0', '0', '0')");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (strcmp ($res, "INVALID") == 0) {
|
||||
// log for manual investigation
|
||||
|
||||
}
|
||||
}
|
||||
fclose ($fp);
|
||||
}
|
||||
?>
|
118
killers.php
Normal file
118
killers.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
|
||||
$cache = new Cache('engine/cache/killers');
|
||||
if ($cache->hasExpired()) {
|
||||
$killers = fetchMurders();
|
||||
|
||||
$cache->setContent($killers);
|
||||
$cache->save();
|
||||
} else {
|
||||
$killers = $cache->load();
|
||||
}
|
||||
$cache = new Cache('engine/cache/victims');
|
||||
if ($cache->hasExpired()) {
|
||||
$victims = fetchLoosers();
|
||||
|
||||
$cache->setContent($victims);
|
||||
$cache->save();
|
||||
} else {
|
||||
$victims = $cache->load();
|
||||
}
|
||||
$cache = new Cache('engine/cache/lastkillers');
|
||||
if ($cache->hasExpired()) {
|
||||
$latests = mysql_select_multi("SELECT `p`.`name` AS `victim`, `d`.`killed_by` as `killed_by`, `d`.`time` as `time` FROM `player_deaths` as `d` INNER JOIN `players` as `p` ON d.player_id = p.id WHERE d.`is_player`='1' LIMIT 20;");
|
||||
if ($latests !== false) {
|
||||
$cache->setContent($latests);
|
||||
$cache->save();
|
||||
}
|
||||
} else {
|
||||
$latests = $cache->load();
|
||||
}
|
||||
if ($killers) {
|
||||
?>
|
||||
<h1>Biggest Murders</h1>
|
||||
<table id="killersTable" class="table table-striped">
|
||||
<tr class="yellow">
|
||||
<th>Name</th>
|
||||
<th>Kills</th>
|
||||
</tr>
|
||||
<?php foreach ($killers as $killer) {
|
||||
echo '<tr>';
|
||||
echo "<td width='70%'><a href='characterprofile.php?name=". $killer['killed_by'] ."'>". $killer['killed_by'] ."</a></td>";
|
||||
echo "<td width='30%'>". $killer['kills'] ."</td>";
|
||||
echo '</tr>';
|
||||
} ?>
|
||||
</table>
|
||||
<?php
|
||||
} else echo 'No player kills exist.';
|
||||
|
||||
if ($victims) {
|
||||
?>
|
||||
<h1>Biggest Victims</h1>
|
||||
<table id="victimsTable" class="table table-striped">
|
||||
<tr class="yellow">
|
||||
<th>Name</th>
|
||||
<th>Deaths</th>
|
||||
</tr>
|
||||
<?php foreach ($victims as $victim) {
|
||||
echo '<tr>';
|
||||
echo "<td width='70%'><a href='characterprofile.php?name=". $victim['name'] ."'>". $victim['name'] ."</a></td>";
|
||||
echo "<td width='30%'>". $victim['Deaths'] ."</td>";
|
||||
echo '</tr>';
|
||||
} ?>
|
||||
</table>
|
||||
<?php
|
||||
} else echo 'No player kills exist.';
|
||||
|
||||
if ($latests) {
|
||||
?>
|
||||
<h1>Latest kills</h1>
|
||||
<table id="killersTable" class="table table-striped">
|
||||
<tr class="yellow">
|
||||
<th>Killer</th>
|
||||
<th>Time</th>
|
||||
<th>Victim</th>
|
||||
</tr>
|
||||
<?php foreach ($latests as $last) {
|
||||
echo '<tr>';
|
||||
echo "<td width='35%'><a href='characterprofile.php?name=". $last['killed_by'] ."'>". $last['killed_by'] ."</a></td>";
|
||||
echo "<td width='30%'>". getClock($last['time'], true) ."</td>";
|
||||
echo "<td width='35%'><a href='characterprofile.php?name=". $last['victim'] ."'>". $last['victim'] ."</a></td>";
|
||||
echo '</tr>';
|
||||
} ?>
|
||||
</table>
|
||||
<?php
|
||||
} else echo 'No player kills exist.';
|
||||
|
||||
} else if ($config['TFSVersion'] == 'TFS_03') {
|
||||
/////////
|
||||
$cache = new Cache('engine/cache/killers');
|
||||
if ($cache->hasExpired()) {
|
||||
$deaths = fetchLatestDeaths_03(30, true);
|
||||
$cache->setContent($deaths);
|
||||
$cache->save();
|
||||
} else {
|
||||
$deaths = $cache->load();
|
||||
}
|
||||
?>
|
||||
|
||||
<h1>Latest Killers</h1>
|
||||
<table id="deathsTable" class="table table-striped">
|
||||
<tr class="yellow">
|
||||
<th>Killer</th>
|
||||
<th>Time</th>
|
||||
<th>Victim</th>
|
||||
</tr>
|
||||
<?php foreach ($deaths as $death) {
|
||||
echo '<tr>';
|
||||
echo "<td><a href='characterprofile.php?name=". $death['killed_by'] ."'>". $death['killed_by'] ."</a></td>";
|
||||
echo "<td>". getClock($death['time'], true) ."</td>";
|
||||
echo "<td>At level ". $death['level'] .": <a href='characterprofile.php?name=". $death['victim'] ."'>". $death['victim'] ."</a></td>";
|
||||
echo '</tr>';
|
||||
} ?>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
/////////
|
||||
}
|
||||
include 'layout/overall/footer.php'; ?>
|
60
login.php
Normal file
60
login.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
require_once 'engine/init.php';
|
||||
logged_in_redirect();
|
||||
include 'layout/overall/header.php';
|
||||
|
||||
if (empty($_POST) === false) {
|
||||
if ($config['log_ip']) {
|
||||
znote_visitor_insert_detailed_data(5);
|
||||
}
|
||||
$username = $_POST['username'];
|
||||
$password = $_POST['password'];
|
||||
data_dump($_POST, false, "POST");
|
||||
if (empty($username) || empty($password)) {
|
||||
$errors[] = 'You need to enter a username and password.';
|
||||
} else if (strlen($username) > 32 || strlen($password) > 64) {
|
||||
$errors[] = 'Username or password is too long.';
|
||||
} else if (user_exist($username) === false) {
|
||||
$errors[] = 'Failed to authorize your account, are the details correct, have you <a href=\'register.php\'>register</a>ed?';
|
||||
} /*else if (user_activated($username) === false) {
|
||||
$errors[] = 'You havent activated your account! Please check your email. <br>Note it may appear in your junk/spam box.';
|
||||
} */else if (!Token::isValid($_POST['token'])) {
|
||||
Token::debug($_POST['token']);
|
||||
$errors[] = 'Token is invalid.';
|
||||
} else {
|
||||
|
||||
// Starting loging
|
||||
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $login = user_login($username, $password);
|
||||
else if ($config['TFSVersion'] == 'TFS_03') $login = user_login_03($username, $password);
|
||||
else $login = false;
|
||||
if ($login === false) {
|
||||
$errors[] = 'Username and password combination is wrong.';
|
||||
} else {
|
||||
$_SESSION['user_id'] = $login;
|
||||
|
||||
// if IP is not set (etc acc created before Znote AAC was in use)
|
||||
$znote_data = user_znote_account_data($_SESSION['user_id']);
|
||||
if ($znote_data['ip'] == 0) {
|
||||
$update_data = array(
|
||||
'ip' => ip2long(getIP()),
|
||||
);
|
||||
user_update_znote_account($update_data);
|
||||
}
|
||||
|
||||
// Send them to myaccount.php
|
||||
header('Location: myaccount.php');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
header('Location: index.php');
|
||||
}
|
||||
|
||||
if (empty($errors) === false) {
|
||||
?>
|
||||
<h2>We tried to log you in, but...</h2>
|
||||
<?php
|
||||
echo output_errors($errors);
|
||||
}
|
||||
include 'layout/overall/footer.php';
|
||||
?>
|
8
logout.php
Normal file
8
logout.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||
|
||||
if (isset($_SESSION)) {
|
||||
session_destroy();
|
||||
header('Location: index.php');
|
||||
}
|
||||
?>
|
3
mailtest.php
Normal file
3
mailtest.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
//mail('TEST', 'Hello!', 'Hello, this is a test email.', 'From: Znote OT AAC.');
|
||||
?>
|
258
myaccount.php
Normal file
258
myaccount.php
Normal file
@ -0,0 +1,258 @@
|
||||
<?php require_once 'engine/init.php';
|
||||
protect_page();
|
||||
include 'layout/overall/header.php';
|
||||
// Change character comment PAGE2 (Success).
|
||||
if (!empty($_POST['comment']) &&!empty($_POST['charn'])) {
|
||||
if (!Token::isValid($_POST['token'])) {
|
||||
exit();
|
||||
}
|
||||
if (user_character_account_id($_POST['charn']) === $session_user_id) {
|
||||
user_update_comment(user_character_id($_POST['charn']), $_POST['comment']);
|
||||
echo 'Successfully updated comment.';
|
||||
}
|
||||
} else {
|
||||
// Hide character
|
||||
if (!empty($_POST['selected_hide'])) {
|
||||
if (!Token::isValid($_POST['token'])) {
|
||||
exit();
|
||||
}
|
||||
$hide_array = explode("!", $_POST['selected_hide']);
|
||||
if (user_character_account_id($hide_array[0]) === $session_user_id) {
|
||||
user_character_set_hide(user_character_id($hide_array[0]), $hide_array[1]);
|
||||
}
|
||||
}
|
||||
// end
|
||||
// DELETE character
|
||||
if (!empty($_POST['selected_delete'])) {
|
||||
if (!Token::isValid($_POST['token'])) {
|
||||
exit();
|
||||
}
|
||||
if (user_character_account_id($_POST['selected_delete']) === $session_user_id) {
|
||||
$charid = user_character_id($_POST['selected_delete']);
|
||||
$chr_data = user_character_data($charid, 'online');
|
||||
if ($chr_data['online'] != 1) {
|
||||
if (guild_leader_gid($charid) === false) user_delete_character($charid);
|
||||
else echo 'Character is leader of a guild, you must disband the guild or change leadership before deleting character.';
|
||||
} else echo 'Character must be offline first.';
|
||||
}
|
||||
}
|
||||
// end
|
||||
// Change character sex
|
||||
if (!empty($_POST['change_gender'])) {
|
||||
if (!Token::isValid($_POST['token'])) {
|
||||
exit();
|
||||
}
|
||||
if (user_character_account_id($_POST['change_gender']) === $session_user_id) {
|
||||
$char_name = sanitize($_POST['change_gender']);
|
||||
$char_id = (int)user_character_id($char_name);
|
||||
$account_id = user_character_account_id($char_name);
|
||||
|
||||
$chr_data = user_character_data($char_id, 'online');
|
||||
if ($chr_data['online'] != 1) {
|
||||
// Verify that we are not messing around with data
|
||||
if ($account_id != $user_data['id']) die("wtf? Something went wrong, try relogging.");
|
||||
|
||||
// Fetch character tickets
|
||||
$tickets = shop_account_gender_tickets($account_id);
|
||||
//$tickets = mysql_result(mysql_query("SELECT `count` FROM `znote_shop_orders` WHERE `account_id`='' AND `type`='3';"), 0, 'count');
|
||||
//$dbid = mysql_result(mysql_query("SELECT `id` FROM `znote_shop_orders` WHERE `account_id`='$account_id' AND `type`='3';"), 0, 'id');
|
||||
if ($tickets !== false || $config['free_sex_change'] == true) {
|
||||
// They are allowed to change gender
|
||||
$last = false;
|
||||
$infinite = false;
|
||||
$tks = 0;
|
||||
// Do we have any infinite tickets?
|
||||
foreach ($tickets as $ticket) {
|
||||
if ($ticket['count'] == 0) $infinite = true;
|
||||
else if ($ticket > 0 && $infinite === false) $tks += (int)$ticket['count'];
|
||||
}
|
||||
if ($infinite === true) $tks = 0;
|
||||
$dbid = (int)$tickets[0]['id'];
|
||||
// If they dont have unlimited tickets, remove a count from their ticket.
|
||||
if ($tickets[0]['count'] > 1) { // Decrease count
|
||||
$tks--;
|
||||
$tkr = ((int)$tickets[0]['count'] - 1);
|
||||
shop_update_row_count($dbid, $tkr);
|
||||
} else if ($tickets[0]['count'] == 1) { // Delete record
|
||||
shop_delete_row_order($dbid);
|
||||
$tks--;
|
||||
}
|
||||
|
||||
// Change character gender:
|
||||
//
|
||||
user_character_change_gender($char_name);
|
||||
echo 'You have successfully changed gender on character '. $char_name .'.';
|
||||
if ($tks > 0) echo '<br>You have '. $tks .' gender change tickets left.';
|
||||
else if ($infinite !== true) echo '<br>You are out of tickets.';
|
||||
} else echo 'You don\'t have any character gender tickets, buy them in the <a href="shop.php">SHOP</a>!';
|
||||
} else echo 'Your character must be offline.';
|
||||
}
|
||||
}
|
||||
// end
|
||||
// Change character comment PAGE1:
|
||||
if (!empty($_POST['selected_comment'])) {
|
||||
if (!Token::isValid($_POST['token'])) {
|
||||
exit();
|
||||
}
|
||||
if (user_character_account_id($_POST['selected_comment']) === $session_user_id) {
|
||||
$comment_data = user_znote_character_data(user_character_id($_POST['selected_comment']), 'comment');
|
||||
?>
|
||||
<!-- Changing comment MARKUP -->
|
||||
<h1>Change comment on:</h1>
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>
|
||||
<input name ="charn" type="text" value="<?php echo $_POST['selected_comment']; ?>" readonly="readonly">
|
||||
</li>
|
||||
<li>
|
||||
<font class="profile_font" name="profile_font_comment">Comment:</font> <br>
|
||||
<textarea name="comment" cols="70" rows="10"><?php echo $comment_data['comment']; ?></textarea>
|
||||
</li>
|
||||
<?php
|
||||
/* Form file */
|
||||
Token::create();
|
||||
?>
|
||||
<li><input type="submit" value="Update Comment"></li>
|
||||
</ul>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
} else {
|
||||
// end
|
||||
$char_count = user_character_list_count($session_user_id);
|
||||
?>
|
||||
<div id="myaccount">
|
||||
<h1>My account</h1>
|
||||
<p>Welcome to your account page, <?php echo $user_data['name']; ?></p>
|
||||
|
||||
<h2>Character List: <?php echo $char_count; ?> characters.</h2>
|
||||
<?php
|
||||
// Echo character list!
|
||||
$char_array = user_character_list($user_data['id']);
|
||||
// Design and present the list
|
||||
if ($char_array) {
|
||||
?>
|
||||
<table id="myaccountTable" class="table table-striped table-hover">
|
||||
<tr class="yellow">
|
||||
<th>NAME</th><th>LEVEL</th><th>VOCATION</th><th>TOWN</th><th>LAST LOGIN</th><th>STATUS</th><th>HIDE</th>
|
||||
</tr>
|
||||
<?php
|
||||
$characters = array();
|
||||
foreach ($char_array as $value) {
|
||||
// characters: [0] = name, [1] = level, [2] = vocation, [3] = town_id, [4] = lastlogin, [5] = online
|
||||
echo '<tr>';
|
||||
echo '<td><a href="characterprofile.php?name='. $value['name'] .'">'. $value['name'] .'</a></td><td>'. $value['level'] .'</td><td>'. $value['vocation'] .'</td><td>'. $value['town_id'] .'</td><td>'. $value['lastlogin'] .'</td><td>'. $value['online'] .'</td><td>'. hide_char_to_name(user_character_hide($value['name'])) .'</td>';
|
||||
echo '</tr>';
|
||||
$characters[] = $value['name'];
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<!-- FORMS TO HIDE CHARACTER-->
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>
|
||||
Character hide:<br>
|
||||
<select name="selected_hide" multiple="multiple">
|
||||
<?php
|
||||
for ($i = 0; $i < $char_count; $i++) {
|
||||
if (user_character_hide($characters[$i]) == 1) {
|
||||
echo '<option value="'. $characters[$i] .'!0">'. $characters[$i] .'</option>';
|
||||
} else {
|
||||
echo '<option value="'. $characters[$i] .'!1">'. $characters[$i] .'</option>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
/* Form file */
|
||||
Token::create();
|
||||
?>
|
||||
<input type="submit" value="Toggle hide" class="btn btn-info">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<!-- FORMS TO CHANGE CHARACTER COMMENT-->
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>
|
||||
Character comment:<br>
|
||||
<select name="selected_comment" multiple="multiple">
|
||||
<?php
|
||||
for ($i = 0; $i < $char_count; $i++) {
|
||||
echo '<option value="'. $characters[$i] .'">'. $characters[$i] .'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
/* Form file */
|
||||
Token::create();
|
||||
?>
|
||||
<input type="submit" value="Change comment" class="btn btn-info">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<!-- FORMS TO CHANGE CHARACTER GENDER-->
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>
|
||||
Change character gender:<br>
|
||||
<select name="change_gender" multiple="multiple">
|
||||
<?php
|
||||
for ($i = 0; $i < $char_count; $i++) {
|
||||
echo '<option value="'. $characters[$i] .'">'. $characters[$i] .'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
/* Form file */
|
||||
Token::create();
|
||||
?>
|
||||
<input type="submit" value="Change gender" class="btn btn-info">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<!-- FORMS TO DELETE CHARACTER-->
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>
|
||||
Delete character:<br>
|
||||
<select id="selected_delete" name="selected_delete" multiple="multiple">
|
||||
<?php
|
||||
for ($i = 0; $i < $char_count; $i++) {
|
||||
echo '<option value="'. $characters[$i] .'">'. $characters[$i] .'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
/* Form file */
|
||||
Token::create();
|
||||
?>
|
||||
<input type="submit" value="Delete Character" class="btn btn-danger needconfirmation">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<script src="engine/js/jquery-1.10.2.min.js" type="text/javascript"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".needconfirmation").each(function(e){
|
||||
$(this).click(function(e){
|
||||
var itemname = $(this).attr("data-item-name");
|
||||
var r = confirm("Do you really want to DELETE character: "+$('#selected_delete').find(":selected").text()+"?")
|
||||
if(r == false){
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
} else {
|
||||
echo 'You don\'t have any characters. Why don\'t you <a href="createcharacter.php">create one</a>?';
|
||||
}
|
||||
//Done.
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
include 'layout/overall/footer.php'; ?>
|
31
onlinelist.php
Normal file
31
onlinelist.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
|
||||
|
||||
<h1>Who is online?</h1>
|
||||
<?php
|
||||
$array = online_list();
|
||||
if ($array) {
|
||||
?>
|
||||
|
||||
<table id="onlinelistTable" class="table table-striped table-hover">
|
||||
<tr class="yellow">
|
||||
<th>Name:</th>
|
||||
<th>Level:</th>
|
||||
<th>Vocation:</th>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($array as $value) {
|
||||
echo '<tr>';
|
||||
echo '<td><a href="characterprofile.php?name='. $value['name'] .'">'. $value['name'] .'</a></td>';
|
||||
echo '<td>'. $value['level'] .'</td>';
|
||||
echo '<td>'. vocation_id_to_name($value['vocation']) .'</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
echo 'Nobody is online.';
|
||||
}
|
||||
?>
|
||||
<?php include 'layout/overall/footer.php'; ?>
|
85
paygol_ipn.php
Normal file
85
paygol_ipn.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
// Require the functions to connect to database and fetch config values
|
||||
require 'config.php';
|
||||
require 'engine/database/connect.php';
|
||||
|
||||
// Fetch paygol configurations
|
||||
$paygol = $config['paygol'];
|
||||
|
||||
// check that the request comes from PayGol server
|
||||
if(!in_array($_SERVER['REMOTE_ADDR'],
|
||||
array('109.70.3.48', '109.70.3.146', '109.70.3.58', '31.45.23.9'))) {
|
||||
header("HTTP/1.0 403 Forbidden");
|
||||
die("Error: Unknown IP");
|
||||
}
|
||||
|
||||
// get the variables from PayGol system
|
||||
$message_id = $_GET['message_id'];
|
||||
$service_id = $_GET['service_id'];
|
||||
$shortcode = $_GET['shortcode'];
|
||||
$keyword = $_GET['keyword'];
|
||||
$message = $_GET['message'];
|
||||
$sender = $_GET['sender'];
|
||||
$operator = $_GET['operator'];
|
||||
$country = $_GET['country'];
|
||||
$custom = $_GET['custom'];
|
||||
$points = $_GET['points'];
|
||||
$price = $_GET['price'];
|
||||
$currency = $_GET['currency'];
|
||||
|
||||
// FUNCTIONS
|
||||
function sanitize($data)/* Security reasons */ {
|
||||
return htmlentities(strip_tags(mysql_real_escape_string($data)));
|
||||
}
|
||||
function user_data($user_id)/* account data */ {
|
||||
$data = array();
|
||||
$user_id = sanitize($user_id);
|
||||
|
||||
$func_num_args = func_num_args();
|
||||
$func_get_args = func_get_args();
|
||||
|
||||
if ($func_num_args > 1) {
|
||||
unset($func_get_args[0]);
|
||||
|
||||
$fields = '`'. implode('`, `', $func_get_args) .'`';
|
||||
$data = mysql_fetch_assoc(mysql_query("SELECT $fields FROM `accounts` WHERE `id` = $user_id;"));
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
// Since only paygol.com is able to communicate with this script, we will blindly trust them until proven othervise.
|
||||
if ($service_id == $paygol['serviceID']) {
|
||||
$new_points = (int)$paygol['points'];
|
||||
|
||||
$data = user_data($custom, 'name');
|
||||
if ($data['name']) {
|
||||
// Sanitize all data: (ok, we do not completely trust them blindly. D:)
|
||||
$message_id = sanitize($message_id);
|
||||
$service_id = sanitize($service_id);
|
||||
$shortcode = sanitize($shortcode);
|
||||
$keyword = sanitize($keyword);
|
||||
$message = sanitize($message);
|
||||
$sender = sanitize($sender);
|
||||
$operator = sanitize($operator);
|
||||
$country = sanitize($country);
|
||||
$custom = sanitize($custom);
|
||||
$points = sanitize($points);
|
||||
$price = sanitize($price);
|
||||
$currency = sanitize($currency);
|
||||
|
||||
// Update logs:
|
||||
$log_query = mysql_query("INSERT INTO `znote_paygol` VALUES ('', '$custom', '$price', '$new_points', '$message_id', '$service_id', '$shortcode', '$keyword', '$message', '$sender', '$operator', '$country', '$currency')")or die("Log paygol SQL ERROR");
|
||||
|
||||
// Give points to user
|
||||
$old_points = mysql_result(mysql_query("SELECT `points` FROM `znote_accounts` WHERE `account_id`='$custom';"), 0, 'points');
|
||||
echo 'Custom: '. $custom .'<br>';
|
||||
echo "Query: SELECT `points` FROM `znote_accounts` WHERE `account_id`='$custom';<br>";
|
||||
echo 'Old points: '. $old_points .'<br>';
|
||||
$new_points += $old_points;
|
||||
echo 'New points: '. $new_points .'<br>';
|
||||
$update_account = mysql_query("UPDATE `znote_accounts` SET `points`='$new_points' WHERE `account_id`='$custom'")or die(mysql_error());
|
||||
echo 'Account id 2 shold be updated now!';
|
||||
|
||||
} else echo ' character data false';
|
||||
|
||||
} else echo 'service id wrong';
|
||||
?>
|
20
protected.php
Normal file
20
protected.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
require_once 'engine/init.php';
|
||||
// To direct users here, add: protect_page(); Here before loading header.
|
||||
include 'layout/overall/header.php';
|
||||
if (user_logged_in() === true) {
|
||||
?>
|
||||
|
||||
<h1>STOP!</h1>
|
||||
<p>Ummh... Why are you sniffing around here?</p>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
||||
<h1>Sorry, you need to be logged in to do that!</h1>
|
||||
<p>Please register or log in.</p>
|
||||
|
||||
<?php
|
||||
}
|
||||
include 'layout/overall/footer.php'; ?>
|
54
queststatus.php
Normal file
54
queststatus.php
Normal file
@ -0,0 +1,54 @@
|
||||
<table id="questTable">
|
||||
<?php
|
||||
$completed = '<font color="green">[Completed]</font>';
|
||||
$notstarted = '';
|
||||
function Progress($min, $max, $design = '<font color="orange">[x%]</font>') {
|
||||
$design = explode("x%",$design);
|
||||
$percent = ($min / $max) * 100;
|
||||
return $design[0] . $percent . $design[1];
|
||||
}
|
||||
$quests = array(
|
||||
// Simple quests
|
||||
'Bearslayer' => 1050,
|
||||
'Sword Quest' => 1337,
|
||||
|
||||
// Advanced quest with progress par:
|
||||
'Postman Quest' => array(
|
||||
1338,
|
||||
3,
|
||||
),
|
||||
);
|
||||
?>
|
||||
<tr class="yellow">
|
||||
<td>Quest Name</td>
|
||||
<td>Status</td>
|
||||
</tr>
|
||||
<?php
|
||||
// Rolling through quests
|
||||
foreach ($quests as $key => $quest) {
|
||||
|
||||
// Is quest NOT an array (advanced quest?)
|
||||
if (!is_array($quest)) {
|
||||
// Query to find quest results
|
||||
$query = mysql_select_single("SELECT `value` FROM `player_storage` WHERE `key`='$quest' AND `player_id`='$user_id' AND `value`='1' LIMIT 1;");
|
||||
|
||||
if ($query !== false) $quest = $completed;
|
||||
else $quest = $notstarted;
|
||||
|
||||
} else {
|
||||
$query = mysql_select_single("SELECT `value` FROM `player_storage` WHERE `key`='".$quest[0]."' AND `player_id`='$user_id' AND `value`>'0' LIMIT 1;");
|
||||
if (!$query) $quest = $notstarted;
|
||||
else {
|
||||
if ($query['value'] >= $quest[1]) $quest = $completed;
|
||||
else $quest = Progress($query['value'], $quest[1]);
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $key; ?></td>
|
||||
<td><?php echo $quest; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table>
|
92
recovery.php
Normal file
92
recovery.php
Normal file
@ -0,0 +1,92 @@
|
||||
<?php require_once 'engine/init.php';
|
||||
logged_in_redirect();
|
||||
include 'layout/overall/header.php'; ?>
|
||||
|
||||
<h1>Account Recovery</h1>
|
||||
<!-- Success markup -->
|
||||
<?php
|
||||
$mode_allowed = array('username', 'password');
|
||||
if (isset($_GET['mode']) === true && in_array($_GET['mode'], $mode_allowed) === true) {
|
||||
if (isset($_POST['email']) === true && empty($_POST['email']) === false) {
|
||||
if (user_email_exist($_POST['email']) === true) {
|
||||
znote_visitor_insert_detailed_data(5);
|
||||
$mail = $_POST['email'];
|
||||
$acc_id = user_id_from_email($mail);
|
||||
if (isset($_POST['character']) === true && empty($_POST['character']) === false) {
|
||||
if (user_character_exist($_POST['character']) === true) {
|
||||
// EDOM
|
||||
if ($_GET['mode'] === 'username') { // Recover password, edom == username
|
||||
// edom == password
|
||||
if (isset($_POST['edom']) === true && empty($_POST['edom']) === false) {
|
||||
if (user_password_match($_POST['edom'], $acc_id) === true) {
|
||||
// User exist, email exist, character exist. Lets start the recovery function
|
||||
user_recover($_GET['mode'], $_POST['edom'], $_POST['email'], $_POST['character'], ip2long(getIP()));
|
||||
//echo 'password';
|
||||
} else {
|
||||
echo 'That password is incorrect.';
|
||||
}
|
||||
} else { echo 'You forgot to write password.'; }
|
||||
//echo 'username';
|
||||
} else {
|
||||
if (isset($_POST['edom']) === true && empty($_POST['edom']) === false) {
|
||||
if (user_exist($_POST['edom']) === true) {
|
||||
// User exist, email exist, character exist. Lets start the recovery function
|
||||
user_recover($_GET['mode'], $_POST['edom'], $_POST['email'], $_POST['character'], ip2long(getIP()));
|
||||
//echo 'password';
|
||||
} else { echo 'That username ['. $_POST['edom'] .'] is incorrect.'; }
|
||||
} else { echo 'You forgot to write username.'; }
|
||||
}
|
||||
// end EDOM
|
||||
} else { echo 'That character name does not exist.'; }
|
||||
} else { echo 'You need to type in a character name from your account.'; }
|
||||
|
||||
} else {
|
||||
echo 'We couldn\'t find that email address!';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>
|
||||
Please enter your email address:<br>
|
||||
<input type="text" name="email">
|
||||
</li>
|
||||
<li>
|
||||
Please enter your <?php
|
||||
if (isset($_GET['mode']) === true && in_array($_GET['mode'], $mode_allowed) === true) {
|
||||
if ($_GET['mode'] === 'username') {
|
||||
echo 'password';
|
||||
} else {
|
||||
echo 'username';
|
||||
}
|
||||
} else { echo'[Error: Mode not recognized.]'; exit(); }
|
||||
?>:<br>
|
||||
<input type="<?php
|
||||
if (isset($_GET['mode']) === true && in_array($_GET['mode'], $mode_allowed) === true) {
|
||||
if ($_GET['mode'] === 'username') {
|
||||
echo 'password';
|
||||
} else {
|
||||
echo 'text';
|
||||
}
|
||||
} else { echo'[Error: Mode not recognized.]'; }
|
||||
?>" name="edom">
|
||||
</li>
|
||||
<li>
|
||||
Character name on your account:<br>
|
||||
<input type="text" name="character">
|
||||
</li>
|
||||
<li>
|
||||
<input type="submit" value="Recover">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
header('Location: index.php');
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
|
||||
<?php include 'layout/overall/footer.php'; ?>
|
171
register.php
Normal file
171
register.php
Normal file
@ -0,0 +1,171 @@
|
||||
<?php
|
||||
require_once 'engine/init.php';
|
||||
logged_in_redirect();
|
||||
include 'layout/overall/header.php';
|
||||
|
||||
if (empty($_POST) === false) {
|
||||
// $_POST['']
|
||||
$required_fields = array('username', 'password', 'password_again', 'email', 'selected');
|
||||
foreach($_POST as $key=>$value) {
|
||||
if (empty($value) && in_array($key, $required_fields) === true) {
|
||||
$errors[] = 'You need to fill in all fields.';
|
||||
break 1;
|
||||
}
|
||||
}
|
||||
|
||||
// check errors (= user exist, pass long enough
|
||||
if (empty($errors) === true) {
|
||||
/* Token used for cross site scripting security */
|
||||
if (!Token::isValid($_POST['token'])) {
|
||||
$errors[] = 'Token is invalid.';
|
||||
}
|
||||
|
||||
if ($config['use_captcha']) {
|
||||
include_once 'captcha/securimage.php';
|
||||
$securimage = new Securimage();
|
||||
if ($securimage->check($_POST['captcha_code']) == false) {
|
||||
$errors[] = 'Captcha image verification was submitted wrong.';
|
||||
}
|
||||
}
|
||||
|
||||
if (user_exist($_POST['username']) === true) {
|
||||
$errors[] = 'Sorry, that username already exist.';
|
||||
}
|
||||
|
||||
// Don't allow "default admin names in config.php" access to register.
|
||||
$isNoob = in_array(strtolower($_POST['username']), $config['page_admin_access']) ? true : false;
|
||||
if ($isNoob) {
|
||||
$errors[] = 'This account name is blocked for registration.';
|
||||
}
|
||||
if (strtolower($_POST['username']) === true) {
|
||||
$errors[] = 'Sorry, that username already exist.';
|
||||
}
|
||||
if (preg_match("/^[a-zA-Z0-9]+$/", $_POST['username']) == false) {
|
||||
$errors[] = 'Your account name can only contain characters a-z, A-Z and 0-9.';
|
||||
}
|
||||
// name restriction
|
||||
$resname = explode(" ", $_POST['username']);
|
||||
foreach($resname as $res) {
|
||||
if(in_array(strtolower($res), $config['invalidNameTags'])) {
|
||||
$errors[] = 'Your username contains a restricted word.';
|
||||
}
|
||||
else if(strlen($res) == 1) {
|
||||
$errors[] = 'Too short words in your name.';
|
||||
}
|
||||
}
|
||||
// end name restriction
|
||||
if (strlen($_POST['password']) < 6) {
|
||||
$errors[] = 'Your password must be at least 6 characters.';
|
||||
}
|
||||
if (strlen($_POST['password']) > 33) {
|
||||
$errors[] = 'Your password must be less than 33 characters.';
|
||||
}
|
||||
if ($_POST['password'] !== $_POST['password_again']) {
|
||||
$errors[] = 'Your passwords do not match.';
|
||||
}
|
||||
if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false) {
|
||||
$errors[] = 'A valid email address is required.';
|
||||
}
|
||||
if (user_email_exist($_POST['email']) === true) {
|
||||
$errors[] = 'That email address is already in use.';
|
||||
}
|
||||
if ($_POST['selected'] != 1) {
|
||||
$errors[] = 'You are only allowed to have an account if you accept the rules.';
|
||||
}
|
||||
if (validate_ip(getIP()) === false && $config['validate_IP'] === true) {
|
||||
$errors[] = 'Failed to recognize your IP address. (Not a valid IPv4 address).';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<h1>Register Account</h1>
|
||||
<?php
|
||||
if (isset($_GET['success']) && empty($_GET['success'])) {
|
||||
echo 'Congratulations! Your account has been created. You may now login to create a character.';
|
||||
} else {
|
||||
if (empty($_POST) === false && empty($errors) === true) {
|
||||
if ($config['log_ip']) {
|
||||
znote_visitor_insert_detailed_data(1);
|
||||
}
|
||||
//Register
|
||||
$register_data = array(
|
||||
'name' => $_POST['username'],
|
||||
'password' => $_POST['password'],
|
||||
'email' => $_POST['email'],
|
||||
'ip' => ip2long(getIP()),
|
||||
'created' => time()
|
||||
);
|
||||
|
||||
user_create_account($register_data);
|
||||
header('Location: register.php?success');
|
||||
exit();
|
||||
//End register
|
||||
|
||||
} else if (empty($errors) === false){
|
||||
echo '<font color="red"><b>';
|
||||
echo output_errors($errors);
|
||||
echo '</b></font>';
|
||||
}
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>
|
||||
Account Name:<br>
|
||||
<input type="text" name="username">
|
||||
</li>
|
||||
<li>
|
||||
Password:<br>
|
||||
<input type="password" name="password">
|
||||
</li>
|
||||
<li>
|
||||
Password again:<br>
|
||||
<input type="password" name="password_again">
|
||||
</li>
|
||||
<li>
|
||||
Email:<br>
|
||||
<input type="text" name="email">
|
||||
</li>
|
||||
<?php
|
||||
if ($config['use_captcha']) {
|
||||
?>
|
||||
<li>
|
||||
<b>Write the image symbols in the text field to verify that you are a human:</b>
|
||||
<img id="captcha" src="captcha/securimage_show.php" alt="CAPTCHA Image" /><br>
|
||||
<input type="text" name="captcha_code" size="10" maxlength="6" />
|
||||
<a href="#" onclick="document.getElementById('captcha').src = 'captcha/securimage_show.php?' + Math.random(); return false">[ Different Image ]</a><br><br>
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<li>
|
||||
<h2>Server Rules</h2>
|
||||
<p>The golden rule: Have fun.</p>
|
||||
<p>If you get pwn3d, don't hate the game.</p>
|
||||
<p>No <a href='http://en.wikipedia.org/wiki/Cheating' target="_blank">cheating</a> allowed.</p>
|
||||
<p>No <a href='http://en.wikipedia.org/wiki/Internet_bot' target="_blank">botting</a> allowed.</p>
|
||||
<p>The staff can delete, ban, do whatever they want with your account and your <br>
|
||||
submitted information. (Including exposing and logging your IP).</p>
|
||||
<p></p>
|
||||
</li>
|
||||
<li>
|
||||
Do you agree to follow the server rules?<br>
|
||||
<select name="selected">
|
||||
<option value="0">Umh...</option>
|
||||
<option value="1">Yes.</option>
|
||||
<option value="2">No.</option>
|
||||
</select>
|
||||
</li>
|
||||
<?php
|
||||
/* Form file */
|
||||
Token::create();
|
||||
?>
|
||||
<li>
|
||||
<input type="submit" value="Create Account">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
include 'layout/overall/footer.php';
|
||||
?>
|
6
serverinfo.php
Normal file
6
serverinfo.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
|
||||
|
||||
<h1>Server Information</h1>
|
||||
<p>Edit this page for server information.</p>
|
||||
|
||||
<?php include 'layout/overall/footer.php'; ?>
|
69
settings.php
Normal file
69
settings.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
require_once 'engine/init.php';
|
||||
protect_page();
|
||||
include 'layout/overall/header.php';
|
||||
|
||||
if (empty($_POST) === false) {
|
||||
// $_POST['']
|
||||
/* Token used for cross site scripting security */
|
||||
if (!Token::isValid($_POST['token'])) {
|
||||
$errors[] = 'Token is invalid.';
|
||||
}
|
||||
$required_fields = array('new_email');
|
||||
foreach($_POST as $key=>$value) {
|
||||
if (empty($value) && in_array($key, $required_fields) === true) {
|
||||
$errors[] = 'You need to fill in all fields.';
|
||||
break 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($errors) === true) {
|
||||
if (filter_var($_POST['new_email'], FILTER_VALIDATE_EMAIL) === false) {
|
||||
$errors[] = 'A valid email address is required.';
|
||||
} else if (user_email_exist($_POST['new_email']) === true && $user_data['email'] !== $_POST['new_email']) {
|
||||
$errors[] = 'That email address is already in use.';
|
||||
}
|
||||
}
|
||||
|
||||
print_r($errors);
|
||||
}
|
||||
?>
|
||||
<h1>Settings</h1>
|
||||
|
||||
<?php
|
||||
if (isset($_GET['success']) === true && empty($_GET['success']) === true) {
|
||||
echo 'Your settings have been updated.';
|
||||
} else {
|
||||
if (empty($_POST) === false && empty($errors) === true) {
|
||||
$update_data = array(
|
||||
'email' => $_POST['new_email'],
|
||||
);
|
||||
|
||||
user_update_account($update_data);
|
||||
header('Location: settings.php?success');
|
||||
exit();
|
||||
|
||||
} else if (empty($errors) === false) {
|
||||
echo output_errors($errors);
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>
|
||||
email:<br>
|
||||
<input type="text" name="new_email" value="<?php echo $user_data['email']; ?>">
|
||||
</li>
|
||||
<?php
|
||||
/* Form file */
|
||||
Token::create();
|
||||
?>
|
||||
<li>
|
||||
<input type="submit" value="Update settings">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
include 'layout/overall/footer.php';
|
||||
?>
|
129
shop.php
Normal file
129
shop.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?php require_once 'engine/init.php';
|
||||
protect_page();
|
||||
include 'layout/overall/header.php';
|
||||
|
||||
// Import from config:
|
||||
$shop = $config['shop'];
|
||||
$shop_list = $config['shop_offers'];
|
||||
|
||||
if (!empty($_POST['buy'])) {
|
||||
$time = time();
|
||||
$player_points = (int)$user_znote_data['points'];
|
||||
$cid = (int)$user_data['id'];
|
||||
// Sanitizing post, setting default buy value
|
||||
$buy = false;
|
||||
$post = (int)$_POST['buy'];
|
||||
|
||||
foreach ($shop_list as $key => $value) {
|
||||
if ($key === $post) {
|
||||
$buy = $value;
|
||||
}
|
||||
}
|
||||
if ($buy === false) die("Error: Shop offer ID mismatch.");
|
||||
|
||||
// Verify that user can afford this offer.
|
||||
if ($player_points >= $buy['points']) {
|
||||
$old_points = mysql_result(mysql_query("SELECT `points` FROM `znote_accounts` WHERE `account_id`='$cid';"), 0, 'points');
|
||||
if ((int)$old_points != (int)$player_points) die("1: Failed to equalize your points.");
|
||||
// Remove points if they can afford
|
||||
// Give points to user
|
||||
$expense_points = $buy['points'];
|
||||
$new_points = $old_points - $expense_points;
|
||||
$update_account = mysql_query("UPDATE `znote_accounts` SET `points`='$new_points' WHERE `account_id`='$cid'");
|
||||
|
||||
$verify = mysql_result(mysql_query("SELECT `points` FROM `znote_accounts` WHERE `account_id`='$cid';"), 0, 'points');
|
||||
if ((int)$old_points == (int)$verify) die("2: Failed to equalize your points.". var_dump((int)$old_points, (int)$verify, $new_points, $expense_points));
|
||||
|
||||
// Do the magic (insert into db, or change sex etc)
|
||||
// If type is 2 or 3
|
||||
if ($buy['type'] == 2) {
|
||||
// Add premium days to account
|
||||
user_account_add_premdays($cid, $buy['count']);
|
||||
echo '<font color="green" size="4">You now have '.$buy['count'].' additional days of premium membership.</font>';
|
||||
} else if ($buy['type'] == 3) {
|
||||
// Character sex
|
||||
mysql_query("INSERT INTO `znote_shop_orders` (`account_id`, `type`, `itemid`, `count`, `time`) VALUES ('$cid', '". $buy['type'] ."', '". $buy['itemid'] ."', '". $buy['count'] ."', '$time')") or die(mysql_error());
|
||||
echo '<font color="green" size="4">You now have access to change character gender on your characters. Visit <a href="myaccount.php">My Account</a> to select character and change the gender.</font>';
|
||||
} else {
|
||||
mysql_query("INSERT INTO `znote_shop_orders` (`account_id`, `type`, `itemid`, `count`, `time`) VALUES ('$cid', '". $buy['type'] ."', '". $buy['itemid'] ."', '". $buy['count'] ."', '$time')") or die(mysql_error());
|
||||
echo '<font color="green" size="4">Your order is ready to be delivered. Write this command in-game to get it: [!shop].<br>Make sure you are in depot and can carry it before executing the command!</font>';
|
||||
}
|
||||
|
||||
// No matter which type, we will always log it.
|
||||
mysql_query("INSERT INTO `znote_shop_logs` (`account_id`, `player_id`, `type`, `itemid`, `count`, `points`, `time`) VALUES ('$cid', '0', '". $buy['type'] ."', '". $buy['itemid'] ."', '". $buy['count'] ."', '". $buy['points'] ."', '$time')") or die(mysql_error());
|
||||
|
||||
} else echo '<font color="red" size="4">You need more points, this offer cost '.$buy['points'].' points.</font>';
|
||||
//var_dump($buy);
|
||||
//echo '<font color="red" size="4">'. $_POST['buy'] .'</font>';
|
||||
}
|
||||
|
||||
if ($shop['enabled']) {
|
||||
?>
|
||||
|
||||
<h1>Shop Offers</h1>
|
||||
<?php
|
||||
if (!empty($_POST['buy'])) {
|
||||
if ($user_znote_data['points'] >= $buy['points']) {
|
||||
?><td>You have <?php echo (int)($user_znote_data['points'] - $buy['points']); ?> points. (<a href="buypoints.php">Buy points</a>).</td><?php
|
||||
} else {
|
||||
?><td>You have <?php echo $user_znote_data['points']; ?> points. (<a href="buypoints.php">Buy points</a>).</td><?php
|
||||
}
|
||||
} else {
|
||||
?><td>You have <?php echo $user_znote_data['points']; ?> points. (<a href="buypoints.php">Buy points</a>).</td><?php
|
||||
}
|
||||
if ($config['shop_auction']['characterAuction']) {
|
||||
?>
|
||||
<p>Interested in buying characters? View the <a href="auctionChar.php">character auction page!</a></p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<table>
|
||||
<tr class="yellow">
|
||||
<td>Describtion:</td>
|
||||
<?php if ($config['shop']['showImage']) { ?><td>Image:</td><?php } ?>
|
||||
<td>Count/duration:</td>
|
||||
<td>Points:</td>
|
||||
<td>Action:</td>
|
||||
</tr>
|
||||
<?php
|
||||
foreach ($shop_list as $key => $offers) {
|
||||
echo '<tr class="special">';
|
||||
echo '<td>'. $offers['describtion'] .'</td>';
|
||||
if ($config['shop']['showImage']) echo '<td><img src="http://'. $config['shop']['imageServer'] .'/'. $offers['itemid'] .'.'. $config['shop']['imageType'] .'" alt="img"></td>';
|
||||
if ($offers['type'] == 2) echo '<td>'. $offers['count'] .' Days</td>';
|
||||
else if ($offers['type'] == 3 && $offers['count'] == 0) echo '<td>Unlimited</td>';
|
||||
else echo '<td>'. $offers['count'] .'x</td>';
|
||||
echo '<td>'. $offers['points'] .'</td>';
|
||||
echo '<td>';
|
||||
?>
|
||||
<form action="" method="POST">
|
||||
<input type="hidden" name="buy" value="<?php echo (int)$key; ?>">
|
||||
<input type="submit" value=" PURCHASE " class="needconfirmation" data-item-name="<?php echo $offers['describtion']; ?>" data-item-cost="<?php echo $offers['points']; ?>">
|
||||
</form>
|
||||
<?php
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
<?php if ($shop['enableShopConfirmation']) { ?>
|
||||
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$(".needconfirmation").each(function(e){
|
||||
$(this).click(function(e){
|
||||
var itemname = $(this).attr("data-item-name");
|
||||
var itemcost = $(this).attr("data-item-cost");
|
||||
var r = confirm("Do you really want to purchase "+itemname+" for "+itemcost+" points?")
|
||||
if(r == false){
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php }
|
||||
} else echo '<h1>Buy Points system disabled.</h1><p>Sorry, this functionality is disabled.</p>';
|
||||
include 'layout/overall/footer.php'; ?>
|
||||
|
6
sub.php
Normal file
6
sub.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||
|
||||
if ($config['allowSubPages']) include 'layout/sub.php';
|
||||
else echo '<h2>System disabled.</h2><p>The sub page system is disabled.</p>';
|
||||
|
||||
include 'layout/overall/footer.php'; ?>
|
3
success.php
Normal file
3
success.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; ?>
|
||||
<h1>Success!</h1>
|
||||
<?php include 'layout/overall/footer.php'; ?>
|
52
support.php
Normal file
52
support.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||
?><h1>Support in-game</h1><?php
|
||||
$cache = new Cache('engine/cache/support');
|
||||
if ($cache->hasExpired()) {
|
||||
// Fetch all staffs in-game.
|
||||
$staffs = support_list();
|
||||
// Fetch group ids and names from config.php
|
||||
$groups = $config['ingame_positions'];
|
||||
// Loops through groups, separating each group element into an ID variable and name variable
|
||||
foreach ($groups as $group_id => $group_name) {
|
||||
// Loops through list of staffs
|
||||
if (!empty($staffs))
|
||||
foreach ($staffs as $staff) {
|
||||
if ($staff['group_id'] == $group_id) $srtGrp[$group_name][] = $staff;
|
||||
}
|
||||
}
|
||||
if (!empty($srtGrp)) {
|
||||
$cache->setContent($srtGrp);
|
||||
$cache->save();
|
||||
}
|
||||
} else {
|
||||
$srtGrp = $cache->load();
|
||||
}
|
||||
$writeHeader = true;
|
||||
if (!empty($srtGrp)) {
|
||||
foreach (array_reverse($srtGrp) as $grpName => $grpList) {
|
||||
?>
|
||||
<table id="supportTable" class="table table-striped">
|
||||
<?php if ($writeHeader) {
|
||||
$writeHeader = false; ?>
|
||||
<tr class="yellow">
|
||||
<th width="30%">Group</th>
|
||||
<th width="40%">Name</th>
|
||||
<th width="30%">Status</th>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
foreach ($grpList as $char) {
|
||||
if ($char['name'] != $config['website_char']) {
|
||||
echo '<tr>';
|
||||
echo "<td width='30%'>". $grpName ."</td>";
|
||||
echo '<td width="40%"><a href="characterprofile.php?name='. $char['name'] .'">'. $char['name'] .'</a></td>';
|
||||
echo "<td width='30%'>". online_id_to_name($char['online']) ."</td>";
|
||||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
echo'</table>'; include 'layout/overall/footer.php'; ?>
|
10
twtrNews.php
Normal file
10
twtrNews.php
Normal file
@ -0,0 +1,10 @@
|
||||
<a class="twitter-timeline" href="https://twitter.com/ZnoteAAC" data-widget-id="353297614114021376">Tweets from @ZnoteAAC</a>
|
||||
<script>
|
||||
!function(d,s,id){
|
||||
var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';
|
||||
if(!d.getElementById(id)){
|
||||
js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";
|
||||
fjs.parentNode.insertBefore(js,fjs);
|
||||
}
|
||||
}(document,"script","twitter-wjs");
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user