Exemplo n.º 1
0
<?php

$timeStart = microtime(true);
session_start();
if (empty($_SESSION)) {
    exit(header("Location: ../../index.php"));
}
require_once $_SESSION['File_Root'] . '/Kernel/Include.php';
require_once $_SESSION['File_Root'] . '/HTML/Header.php';
redirectToLogin($accountID, $linkRoot);
redirectToBattle($verifyBattle, $linkRoot);
hasAdmin($accountAccess);
$newsTitle = htmlspecialchars(addslashes($_POST['newsTitle']));
$newsMessage = htmlspecialchars(addslashes($_POST['newsMessage']));
$newsAccountPseudo = htmlspecialchars(addslashes($_POST['newsAccountPseudo']));
addNews($bdd, $newsTitle, $newsMessage, $newsAccountPseudo);
?>

<?php 
echo $anews13;
?>

<br>
<form method="POST" action="index.php">
	<input class="btn btn-success" type="submit" value="Ok">
</form>
<br/>

<?php 
require_once $_SESSION['File_Root'] . '/HTML/Footer.php';
Exemplo n.º 2
0
<?php

include 'adminheader.php';
?>

<html>

	<div id="formdiv">

<?php 
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    print '<div class="msg" style="width: 90%">';
    if (isset($_POST['addNews'])) {
        addNews();
    }
    print '</div>';
}
?>

	<h1>lägg till en ny nyhet</h1>
	<form method="post" enctype="multipart/form-data">
		
		<div class="inputdiv">
			<input type="text" name="news_title" placeholder="Titel"
			value="<?php 
if (isset($_POST['news_title'])) {
    echo htmlentities($_POST['news_title']);
}
?>
"><br>
		</div>
						INNER JOIN $table[playerfleet_ships] ON $table[playerfleet].id = $table[playerfleet_ships].fleet_id
						WHERE ($table[playerfleet].action = 'attack' OR $table[playerfleet].action = 'defend')
							OR ($table[playerfleet].action = 'home' AND $table[playerfleet].action_start > '0')
						GROUP BY $table[playerfleet].id";

$res_emptyfleets = mysql_query($sql_emptyfleets);
$num_emptyfleets = @mysql_num_rows($res_emptyfleets);
if ($num_emptyfleets > 0) {
	while ($rec_emptyfleets = mysql_fetch_array($res_emptyfleets)) {
		if (($rec_emptyfleets['amount'] == 0)) {
			$sql_delfleet = "DELETE FROM $table[playerfleet] WHERE `id` = '$rec_emptyfleets[id]'";
			$sql_delfleetships = "DELETE FROM $table[playerfleet_ships] WHERE `fleet_id` = '$rec_emptyfleets[id]'";
			mysql_query($sql_delfleet) or die(mysql_error());
			mysql_query($sql_delfleetships) or die(mysql_error());
			addNews($rec_emptyfleets['player_id'], 'Combat', 'Lost fleet',
			'Staff from the intelligence center reports a lost fleet.<br />
			The fleets identification number was '.$rec_emptyfleets['id'].'.');
			appendPlayerLog($rec_emptyfleets['player_id'], 'Found empty fleet ('.$rec_emptyfleets['id'].'), and removed it.', '');
		}
	}
}

/* find empty fleetship entrys, and delete them.. */
$sql_fleetshipe = "DELETE FROM $table[playerfleet_ships] WHERE `amount` <= '0'";
mysql_query($sql_fleetshipe);

/* find fleets which should already be returning, but aint doing it.. */
$slowest_traveltime = 0;

$sql_findreturning = "SELECT `id`, `player_id`, `target_id`, `action`, `action_start`, `action_time`, `sent_tick`
						FROM `$table[playerfleet]` 
Exemplo n.º 4
0
        $date = time() - $_SESSION["timediff"];
        if (empty($title)) {
            $title = "No Title";
        }
        if (empty($text)) {
            $text = "No Text";
        }
        $message = array();
        if ($news_id) {
            $message["id"] = $news_id;
        }
        $message["username"] = $username;
        if ($username == $GEDCOM) {
            $_SESSION['clearcache'] = true;
        }
        $message["date"] = $date;
        $message["title"] = $title;
        $message["text"] = $text;
        if (addNews($message)) {
            print $pgv_lang["news_saved"];
        }
    } else {
        if ($action == "delete") {
            if (deleteNews($news_id)) {
                print $pgv_lang["news_deleted"];
            }
        }
    }
}
print "<center><br /><br /><a href=\"javascript:;\" onclick=\"if (window.opener.refreshpage) window.opener.refreshpage(); window.close();\">" . $pgv_lang["close_window"] . "</a><br /></center>";
print_simple_footer();
Exemplo n.º 5
0
					$target_xyz = getXYZ($target_id);
					$player_xyz = getXYZ($playerdata['id']);
					$eta_bonus = 0;
					if (($target_xyz[0] == $player_xyz[0]) && ($target_xyz[1] == $player_xyz[1])) { $eta_bonus = 10; }
					elseif ($target_xyz[0] == $player_xyz[0]) { $eta_bonus = 5; }
					$traveltime -= $eta_bonus;
					$starttick = $current_tick + $traveltime;

					$sql_sendfleet = "UPDATE $table[playerfleet] SET `action` = '$action', `target_id` = '$target_id', `action_start` = '$starttick', `action_time` = '$action_time', `sent_tick` = '$current_tick' WHERE `id` = '$fleet_id'";
					if ($action == 'attack') {
						$xyz = getXYZ($playerdata['id']);
						addNews($target_id, 'Combat', 'Incoming hostile fleet', getRulernameById($playerdata['id']).' of '.getPlanetnameById($playerdata['id']).' from '.$xyz[0].':'.$xyz[1].':'.$xyz[2].' is sending a hostile fleet to your planet.<br>The ETA for this fleet is '.$traveltime.'.');
					}
					if ($action == 'defend') {
						$xyz = getXYZ($playerdata['id']);
						addNews($target_id, 'Combat', 'Incoming friendly fleet', getRulernameById($playerdata['id']).' of '.getPlanetnameById($playerdata['id']).' from '.$xyz[0].':'.$xyz[1].':'.$xyz[2].' is sending a friendly fleet to your planet.<br>The ETA for this fleet is '.$traveltime.'.');
					}
				}
				mysql_query($sql_sendfleet) or die(mysql_error());
				switch ($action) {
					case 'attack':
					$error = 1;
					break;
					case 'defend':
					$error = 2;
					break;
					case 'home';
					$error = 3;
					break;
				}
			}
Exemplo n.º 6
0
	$galaxy_data = mysql_fetch_array(mysql_query($sql_galaxydata));

	$res_type = secureData($_POST['res_type']);
	$donate_to = securedata($_POST['donate_to']);
	$amount = secureData($_POST['amount']);

	$fund_arrkey = 'fund_'.$res_type;
	$player_arrkey = 'res_'.$res_type;
	if (($playerdata['id'] != $galaxy_data['commander_id']) && ($playerdata['id'] != $galaxy_data['moe_id'])) { $error = 106; }
	if ($amount <= 0) { $error = 103; }
	if ($galaxy_data[$fund_arrkey] < $amount) { $error = 104; }
	if ($donate_to <= 0) { $error = 105; }
	if ($error < 100) {
		$sql_donateplayer = "UPDATE $table[players] SET `$player_arrkey` = `$player_arrkey` + '$amount' WHERE `id` = '$donate_to'";
		mysql_query($sql_donateplayer) or die(mysql_error());
		addNews($donate_to, 'Donation', 'Recieved donation', 'You recieved a donation from the galactic fund.<br />The donation is '.$amount.' of '.$res_type.'.');
		$sql_updatefund = "UPDATE $table[galaxy] SET `$fund_arrkey` = `$fund_arrkey` - '$amount' WHERE `id` = '$playerdata[galaxy_id]'";
		mysql_query($sql_updatefund) or die(mysql_error());
	}
}
setCommander($galaxy_id);

$sql_galaxydata = "SELECT `id`, `x`, `y`, `topic`, `image_url`, `commander_id`, `moc_id`, `mow_id`, `moe_id`,
						`fund_steel`, `fund_crystal`, `fund_erbium`, `fund_titanium`, `private`, `password` 
					FROM $table[galaxy] 
					WHERE `id` = '$galaxy_id'";
$GALAXY_INFO = mysql_fetch_array(mysql_query($sql_galaxydata));
switch($error) {
	case 1:
	$msg = "Succesfully sent massmail to $num_galmembers players.";
	break;
		$playerdata[$arrkey] -= $amount;
		if ($donate_to == 'fund') {
			$gal_colname = 'fund_'.$res_type;
			$sql_donategfund = "UPDATE $table[galaxy] SET `$gal_colname` = `$gal_colname` + '$amount' WHERE `id` = '$playerdata[galaxy_id]'";
			mysql_query($sql_donategfund) or die(mysql_error());
			if ($moe_id = getMOE($playerdata['galaxy_id'])) {
				$c = getXYZ($playerdata['id']);
				addNews($moe_id, 'Donation','Galactic fund donation', 'The galactic fund recieved a donation from '.$playerdata['rulername'].' of '.$playerdata['planetname'].' ('.$c[0].':'.$c[1].':'.$c[2].').<br />The donation is '.parseInteger($amount).' of '.$res_type.'.');
			}
			$error = 3;
		}
		if ($donate_to > 0) {
			$sql_donateplayer = "UPDATE $table[players] SET `$arrkey` = `$arrkey` + '$amount' WHERE `id` = '$donate_to'";
			mysql_query($sql_donateplayer) or die(mysql_error());
			$c = getXYZ($playerdata['id']);
			addNews($donate_to, 'Donation', 'Recieved donation', 'You recieved a donation from '.$playerdata['rulername'].' of '.$playerdata['planetname'].' ('.$c[0].':'.$c[1].':'.$c[2].').<br />The donation is '.parseInteger($amount).' of '.$res_type.'.');
			$error = 4;
		}
		if ($error == 0) { $error = 103; }
		updatePlayerData($playerdata['id'], $playerdata);
	}
}
switch($error) {
	case 1:
	$msg = "Succesfully altered the titanium factory production process.";
	break;
	case 2:
	/* Msg was set above. */
	break;
	case 3:
	$msg = 'Donated resources to the galactic fund.';
    $editscs = "Event has been successfully updated in the database !";
}
if (isset($_POST['deleteevent'])) {
    $evntid = $_POST['eventname'];
    $modified_by = $_SESSION['admin'];
    deleteevent($evntid, $modified_by);
    $dltdscs = "Event has been successfully deleted !";
}
if (isset($_POST['addnews'])) {
    $content = $_POST['content'];
    $heading = $_POST['heading'];
    $link = $_POST['link'];
    $added_by = $_SESSION['admin'];
    $eventid = $_POST['event_id_news'];
    if ($heading && $content) {
        addNews($content, $heading, $link, $eventid, $added_by);
        $newsmsg = "News has been successfully added to the database!";
    } else {
        $newsmsg = "Content and Heading both fields are required!";
    }
}
if (isset($_POST['deletenews'])) {
    deleteNews($_POST['news_heading'], $_SESSION['admin']);
    $newsdelmsg = "News has been deleted!";
}
//footer
flush();
ob_flush();
ob_end_clean();
?>
	<script type ="text/javascript" src="css/jquery.js"></script>
Exemplo n.º 9
0
        echo '<input type="hidden" name="gedcom_id" value="' . $news['gedcom_id'] . '">';
        echo '<input type="hidden" name="date" value="' . $news['date'] . '">';
        echo '<table>';
        echo '<tr><th style="text-align:left;font-weight:900;" dir="auto;">' . WT_I18N::translate('Title:') . '</th><tr>';
        echo '<tr><td><input type="text" name="title" size="50" dir="auto" autofocus value="' . $news['title'] . '"></td></tr>';
        echo '<tr><th valign="top" style="text-align:left;font-weight:900;" dir="auto;">' . WT_I18N::translate('Entry text:') . '</th></tr>';
        echo '<tr><td>';
        echo '<textarea name="text" class="html-edit" cols="80" rows="10" dir="auto">' . WT_Filter::escapeHtml($news['text']) . '</textarea>';
        echo '</td></tr>';
        echo '<tr><td><input type="submit" value="' . WT_I18N::translate('save') . '"></td></tr>';
        echo '</table>';
        echo '</form>';
        break;
    case 'save':
        $message = array();
        if ($news_id) {
            $message['id'] = $news_id;
        }
        $message['user_id'] = $user_id;
        $message['gedcom_id'] = $gedcom_id;
        $message['date'] = $date;
        $message['title'] = $title;
        $message['text'] = $text;
        addNews($message);
        $controller->addInlineJavascript('window.opener.location.reload();window.close();');
        break;
    case 'delete':
        deleteNews($news_id);
        $controller->addInlineJavascript('window.opener.location.reload();window.close();');
        break;
}
Exemplo n.º 10
0
 /**
  * Import users etc. from index files
  *
  */
 function import()
 {
     global $INDEX_DIRECTORY, $TBLPREFIX, $pgv_lang, $GEDCOMS, $GEDCOM, $gBitDb;
     if (file_exists($INDEX_DIRECTORY . "authenticate.php") == false) {
         $this->impSuccess = false;
         return;
     } else {
         require $INDEX_DIRECTORY . "authenticate.php";
         $countold = count($users);
         $gBitDb->query("DELETE FROM {$TBLPREFIX}users");
         foreach ($users as $username => $user) {
             if ($user["editaccount"] == "1") {
                 $user["editaccount"] = "Y";
             } else {
                 $user["editaccount"] = "N";
             }
             //-- make sure fields are set for v4.0 DB
             if (!isset($user["firstname"])) {
                 if (isset($user["fullname"])) {
                     $parts = explode(' ', trim($user["fullname"]));
                     $user["lastname"] = array_pop($parts);
                     $user["firstname"] = implode(" ", $parts);
                 } else {
                     $user["firstname"] = '';
                     $user["lastname"] = '';
                 }
             }
             if (!isset($user["comment"])) {
                 $user["comment"] = '';
             }
             if (!isset($user["comment_exp"])) {
                 $user["comment_exp"] = '';
             }
             if (!isset($user["sync_gedcom"])) {
                 $user["sync_gedcom"] = 'N';
             }
             if (!isset($user["relationship_privacy"])) {
                 $user["relationship_privacy"] = 'N';
             }
             if (!isset($user["max_relation_path"])) {
                 $user["max_relation_path"] = '2';
             }
             if (!isset($user["auto_accept"])) {
                 $user["auto_accept"] = 'N';
             }
             if ($user_id = create_user($user['username'], $user['password'])) {
                 set_user_setting($user_id, 'firstname', $user["firstname"]);
                 set_user_setting($user_id, 'lastname', $user["lastname"]);
                 set_user_setting($user_id, 'email', $user["email"]);
                 set_user_setting($user_id, 'theme', $user["theme"]);
                 set_user_setting($user_id, 'language', $user["language"]);
                 set_user_setting($user_id, 'contactmethod', $user["contactmethod"]);
                 set_user_setting($user_id, 'defaulttab', $user["defaulttab"]);
                 set_user_setting($user_id, 'comment', $user["comment"]);
                 set_user_setting($user_id, 'comment_exp', $user["comment_exp"]);
                 set_user_setting($user_id, 'pwrequested', $user["pwrequested"]);
                 set_user_setting($user_id, 'reg_timestamp', $user["reg_timestamp"]);
                 set_user_setting($user_id, 'reg_hashcode', $user["reg_hashcode"]);
                 set_user_setting($user_id, 'loggedin', $user["loggedin"]);
                 set_user_setting($user_id, 'sessiontime', $user["sessiontime"]);
                 set_user_setting($user_id, 'max_relation_path', $user["max_relation_path"]);
                 set_user_setting($user_id, 'sync_gedcom', $user["sync_gedcom"] ? 'Y' : 'N');
                 set_user_setting($user_id, 'relationship_privacy', $user["relationship_privacy"] ? 'Y' : 'N');
                 set_user_setting($user_id, 'auto_accept', $user["auto_accept"] ? 'Y' : 'N');
                 set_user_setting($user_id, 'canadmin', $user["canadmin"] ? 'Y' : 'N');
                 set_user_setting($user_id, 'visibleonline', $user["visibleonline"] ? 'Y' : 'N');
                 set_user_setting($user_id, 'editaccount', $user["editaccount"] ? 'Y' : 'N');
                 set_user_setting($user_id, 'verified', $user["verified"] ? 'yes' : 'no');
                 set_user_setting($user_id, 'verified_by_admin', $user["verified_by_admin"] ? 'yes' : 'no');
                 foreach (array('gedcomid', 'rootid', 'canedit') as $var) {
                     if ($user[$var]) {
                         foreach (unserialize(stripslashes($user[$var])) as $gedcom => $id) {
                             set_user_gedcom_setting($user_id, $gedcom, $var, $id);
                         }
                     }
                 }
                 AddToLog("added user -> {$user['username']} <-");
             }
         }
         if ($countold == get_user_count()) {
             $this->impSuccess = true;
         } else {
             $this->impSuccess = false;
         }
     }
     if (file_exists($INDEX_DIRECTORY . "messages.dat") == false) {
         $this->msgSuccess = false;
     } else {
         $gBitDb->query("DELETE FROM {$TBLPREFIX}messages");
         $messages = array();
         $fp = fopen($INDEX_DIRECTORY . "messages.dat", "rb");
         $mstring = fread($fp, filesize($INDEX_DIRECTORY . "messages.dat"));
         fclose($fp);
         $messages = unserialize($mstring);
         foreach ($messages as $newid => $message) {
             $gBitDb->query("INSERT INTO {$TBLPREFIX}messages (m_id, m_from, m_to, m_subject, m_body, m_created) VALUES (?, ? ,? ,? ,? ,?)", array($newid, $message["from"], $message["to"], $message["subject"], $message["body"], $message["created"]));
         }
         $this->msgSuccess = true;
     }
     if (file_exists($INDEX_DIRECTORY . "favorites.dat") == false) {
         $this->favSuccess = false;
         print $pgv_lang["um_nofav"] . "<br /><br />";
     } else {
         $gBitDb->query("DELETE FROM {$TBLPREFIX}favorites");
         $favorites = array();
         $fp = fopen($INDEX_DIRECTORY . "favorites.dat", "rb");
         $mstring = fread($fp, filesize($INDEX_DIRECTORY . "favorites.dat"));
         fclose($fp);
         $favorites = unserialize($mstring);
         foreach ($favorites as $newid => $favorite) {
             $res = addFavorite($favorite);
             if (!$res || DB::isError($res)) {
                 $this->errorMsg = "<span class=\"error\">Unable to update <i>Favorites</i> table.</span><br />\n";
                 return;
             }
         }
         $this->favSuccess = true;
     }
     if (file_exists($INDEX_DIRECTORY . "news.dat") == false) {
         $this->newsSuccess = false;
     } else {
         $gBitDb->query("DELETE FROM {$TBLPREFIX}news");
         $allnews = array();
         $fp = fopen($INDEX_DIRECTORY . "news.dat", "rb");
         $mstring = fread($fp, filesize($INDEX_DIRECTORY . "news.dat"));
         fclose($fp);
         $allnews = unserialize($mstring);
         foreach ($allnews as $newid => $news) {
             $res = addNews($news);
             if (!$res) {
                 $this->errorMsg = "<span class=\"error\">Unable to update <i>News</i> table.</span><br />\n";
                 return;
             }
         }
         $this->newsSuccess = true;
     }
     if (file_exists($INDEX_DIRECTORY . "blocks.dat") == false) {
         $this->blockSuccess = false;
     } else {
         $gBitDb->query("DELETE FROM {$TBLPREFIX}blocks");
         $allblocks = array();
         $fp = fopen($INDEX_DIRECTORY . "blocks.dat", "rb");
         $mstring = fread($fp, filesize($INDEX_DIRECTORY . "blocks.dat"));
         fclose($fp);
         $allblocks = unserialize($mstring);
         foreach ($allblocks as $bid => $blocks) {
             $username = $blocks["username"];
             $gBitDb->query("INSERT INTO {$TBLPREFIX}blocks (b_id, b_username, b_location, b_order, b_name, b_config) VALUES (?, ? ,? , ?, ?, ?)", array($bid, $blocks["username"], $blocks["location"], $blocks["order"], $blocks["name"], serialize($blocks["config"])));
         }
         $this->blockSuccess = true;
     }
 }
Exemplo n.º 11
0
    $mainimagesrc = trim($_FILES['news_mainimagesrc']['name']);
    $mainimagedesc = trim($_POST['imagedesc']);
    $summary = trim($_POST['summary']);
    $content = trim($_POST['content']);
    $keywords = trim($_POST['keywords']);
    $required = array("title", "author", "summary", "content");
    foreach ($required as $require) {
        $value = trim($_POST[$require]);
        if (!has_value($value)) {
            $errors[$require] = ucfirst($require) . " can't be blank.";
        }
    }
    $max_lengths = array("title" => 100, "author" => 30, "summary" => 200, "keywords" => 20);
    max_length($max_lengths);
    if (empty($errors)) {
        $uploadNewsPost = addNews($title, $author, $mainimagesrc, $mainimagedesc, $summary, $content, $keywords);
        $message = $uploadNewsPost;
    }
}
?>

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>EDFC | Admin - Add a News Post</title>
<link rel="stylesheet" href="../css/normalize.css"/>
  <link rel="stylesheet" href="../css/foundation.css" />
<link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
  <link rel="stylesheet" href="css/main.css"/></head>
<body>
Exemplo n.º 12
0
function generateBattleReports($target_id, $shipdata, $af, $df) {
	$af_pids = $af->getPlayerIds();
	foreach ($af_pids as $pid) {
		$br_a = "";
		$br_a = getBRHtmlStart($target_id, 'Attackers', true);
		$br_d = "";
		$br_d = getBRHtmlStart($target_id, 'Defenders', false);
		for ($i = 0; $i < count($shipdata); $i++) {
			$total_amount = $af->getTotalShipOldAmount($shipdata[$i]['id']);
			$total_losses = $af->getTotalShipLosses($shipdata[$i]['id']);

			$shipcol = $af->getPlayerShipCollection($shipdata[$i]['id'], $pid);
			if ($shipcol) {
				if ($shipcol->getLostShips() == 0) {
					$your_amount  = $shipcol->getAmount();
				} else {
					$your_amount  = $shipcol->getOldAmount();
				}
				$your_losses = $shipcol->getLostShips();
			} else {
				$your_amount  = 0;
				$your_losses = 0;
			}
			$br_a .= getBRHtml($shipdata[$i]['name'], true, $total_amount, $total_losses, $your_amount, $your_losses);
			if ($df) {
				$total_amount = $df->getTotalShipOldAmount($shipdata[$i]['id']);
				$total_losses = $df->getTotalShipLosses($shipdata[$i]['id']);
				$br_d .= getBRHtml($shipdata[$i]['name'], false, $total_amount, $total_losses, 0, 0);
			}
		}
		$br_a .= getBRHtmlEnd();
		$br_d .= getBRHtmlEnd();
		$complete_battlereport = $br_a.'<br />'.$br_d;
		addNews($pid, 'Combat', 'Battle report', $complete_battlereport);
	}


	if ($df) {
		$df_pids = $df->getPlayerIds();
		if (!in_array($target_id, $df_pids)) {
			array_push($df_pids, $target_id);
		}
		foreach ($df_pids as $pid) {
			$br_a = "";
			$br_a = getBRHtmlStart($target_id, 'Attackers', false);
			$br_d = "";
			$br_d = getBRHtmlStart($target_id, 'Defenders', true);
			for ($i = 0; $i < count($shipdata); $i++) {
				$total_amount = $df->getTotalShipOldAmount($shipdata[$i]['id']);
				$total_losses = $df->getTotalShipLosses($shipdata[$i]['id']);

				$shipcol = $df->getPlayerShipCollection($shipdata[$i]['id'], $pid);
				if ($shipcol) {
					if ($shipcol->getLostShips() == 0) {
						$your_amount  = $shipcol->getAmount();
					} else {
						$your_amount  = $shipcol->getOldAmount();
					}
					$your_losses = $shipcol->getLostShips();
				} else {
					$your_amount  = 0;
					$your_losses = 0;
				}
				$br_d .= getBRHtml($shipdata[$i]['name'], true, $total_amount, $total_losses, $your_amount, $your_losses);
				if ($af) {
					$total_amount = $af->getTotalShipOldAmount($shipdata[$i]['id']);
					$total_losses = $af->getTotalShipLosses($shipdata[$i]['id']);
					$br_a .= getBRHtml($shipdata[$i]['name'], false, $total_amount, $total_losses, 0, 0);
				}
			}
			$br_a .= getBRHtmlEnd();
			$br_d .= getBRHtmlEnd();
			$complete_battlereport = $br_d.'<br />'.$br_a;
			addNews($pid, 'Combat', 'Battle report', $complete_battlereport);
		}
	}
}
Exemplo n.º 13
0
<html>
	<?php 
include 'header.php';
?>
<body>
	<?php 
include 'functions.php';
?>
	<?php 
include 'connectdb.php';
?>
	<?php 
//Getting data from the former page via POST method
$status = $_POST["status"];
$title = $_POST["title"];
$content = $_POST["content"];
//Status of the post translating into a numeric value
if ($status == 'Taslak') {
    $status = 0;
} else {
    $status = 1;
}
//Adding news to the db
addNews($status, $title, $content);
//Redirect to news page
header("Location: news.php");
?>
</body>
</html>
Exemplo n.º 14
0
         $link[] = array('href' => 'weixin.php?act=qiandao', 'text' => '签到管理');
         sys_msg('操作成功', 0, $link);
     } else {
         $sign = $db->getRow("select * from " . $GLOBALS['ecs']->table('weixin_signconf') . " where cid=1");
         $smarty->assign('sign', $sign);
         $smarty->display('weixin/qiandao_add.html');
     }
     break;
 case "addkey":
     $id = intval($_REQUEST['id']);
     if ($_POST) {
         require_once ROOT_PATH . 'includes/cls_image.php';
         $diy_type = intval($_POST['diy_type']) == 2 ? 2 : 1;
         $_POST['description'] = $_POST["description{$diy_type}"];
         $_POST['title'] = $_POST['title'] ? $_POST['title'] : " ";
         $diy_value = "article_" . addNews();
         $key = getstr($_POST['key']);
         $keys = getstr($_POST['keys']);
         $keyname = getstr($_POST['keyname']);
         if ($id > 0) {
             $ret = $db->query("UPDATE " . $GLOBALS['ecs']->table('weixin_keywords') . " SET `diy_value`='{$diy_value}',`key`='{$key}',`keys`='{$keys}',`keyname`='{$keyname}',`diy_type`={$diy_type} WHERE `id`={$id}");
         } else {
             $ret = $db->query("INSERT INTO " . $GLOBALS['ecs']->table('weixin_keywords') . " \r\n\t\t\t\t(`diy_value`,`key`,`keys`,`keyname`,`diy_type`,`jf_type`,`jf_num`,`jf_maxnum`,`clicks`) VALUE \r\n\t\t\t\t('{$diy_value}','{$key}','{$keys}','{$keyname}','{$diy_type}',0,0,0,0)");
         }
         $link[] = array('href' => 'weixin.php?act=addkey', 'text' => '继续添加');
         $link[] = array('href' => 'weixin.php?act=keywords&t=1', 'text' => '关键字管理');
         sys_msg('操作成功', 0, $link);
     } else {
         $smarty->assign('action_link', array('text' => "关键字管理", 'href' => 'weixin.php?act=keywords&t=1'));
         $smarty->assign('ur_here', "添加自定义回复");
         if ($id > 0) {
				if ($lost_ships > 0) {
					$sql_updship1 = "UPDATE $table[playerunit] SET `amount` = `amount` - '$lost_ships' WHERE `unit_id` = '$ship_id' AND `player_id` = '$player_id'";
					appendPlayerLog($player_id, 'Updating ship('.$ship_id.') total amount (dec. with: '.$lost_ships.'). Updated because they where lost in battle (as defender).', '');
					mysql_query($sql_updship1) or die(mysql_error());
				}
				if ($new_amount <> $old_amount) {
					$sql_updship2 = "UPDATE $table[playerfleet_ships] SET `amount` = '$new_amount' WHERE `ship_id` = '$ship_id' AND `player_id` = '$player_id' AND `fleet_id` = '$fleet_id'";
					appendPlayerLog($player_id, 'Updating ship('.$ship_id.') fleet amount (new amount: '.$new_amount.'). Updated because they where lost in battle (as defender).', '');
					mysql_query($sql_updship2) or die(mysql_error());
				}
			}
		}
	}

	$asteroid_report = getARHtmlStart();

	$asteroid_report .= getARHtml('Steel', $p['roid_steel'], ($p['roid_steel'] - $new['roid_steel']));
	$asteroid_report .= getARHtml('Crystal', $p['roid_crystal'], ($p['roid_crystal'] - $new['roid_crystal']));
	$asteroid_report .= getARHtml('Erbium', $p['roid_erbium'], ($p['roid_erbium'] - $new['roid_erbium']));
	$asteroid_report .= getARHtml('Unused', $p['roid_unused'], ($p['roid_unused'] - $new['roid_unused']));
	$ar_total = $p['roid_steel'] + $p['roid_crystal'] + $p['roid_erbium'] + $p['roid_unused'];
	$ar_totalnew = $new['roid_steel'] + $new['roid_crystal'] + $new['roid_erbium'] + $new['roid_unused'];
	$asteroid_report .= getARHtml('Total', $ar_total, ($ar_total - $ar_totalnew));
	$asteroid_report .= getARHtmlEnd();
	addNews($id, 'Battle', 'Asteroid losses', $asteroid_report);

	$time_end = getmicrotime();
	$time = $time_end - $time_start;
	//debug('The battle ran for '.$time.' seconds.');
}
?>
Exemplo n.º 16
0
 }
 //-- delete the cache files for the welcome page blocks
 require_once PGV_ROOT . 'includes/index_cache.php';
 clearCache();
 $logline = AddToLog("Gedcom configuration " . $INDEX_DIRECTORY . $FILE . "_conf.php" . " updated");
 $gedcomconfname = $FILE . "_conf.php";
 check_in($logline, $gedcomconfname, $INDEX_DIRECTORY);
 if (!$errors) {
     $gednews = getUserNews($FILE);
     if (count($gednews) == 0) {
         $news = array();
         $news["title"] = "#default_news_title#";
         $news["username"] = $FILE;
         $news["text"] = "#default_news_text#";
         $news["date"] = client_time();
         addNews($news);
     }
     if ($source == "upload_form") {
         $check = "upload";
     } elseif ($source == "add_form") {
         $check = "add";
     } elseif ($source == "add_new_form") {
         $check = "add_new";
     }
     if (!isset($bakfile)) {
         $bakfile = "";
     }
     if ($source !== "") {
         header("Location: " . encode_url("uploadgedcom.php?action={$source}&check={$check}&step=2&GEDFILENAME={$GEDFILENAME}&path={$path}&verify=verify_gedcom&bakfile={$bakfile}", false));
     } else {
         header("Location: editgedcoms.php");
Exemplo n.º 17
0
 } else {
     $errors[] = 'status';
 }
 // validate tag
 if (isset($_POST['tag'])) {
     $tag = $_POST['tag'];
 } else {
     $errors[] = 'tag';
 }
 if (empty($errors)) {
     $targetava = '../images/news/' . $myAvatar;
     $targetbanner = '../images/news/' . $myBanner;
     move_uploaded_file($_FILES['myAvatar']['tmp_name'], $targetava);
     move_uploaded_file($_FILES['myBanner']['tmp_name'], $targetbanner);
     // add record
     $result = addNews($uid, $type_id, $title, $myAvatar, $myBanner, $content, $status);
     if (mysqli_affected_rows($dbc) == 1) {
         // add tag
         $result = get_last_rc();
         if (mysqli_num_rows($result) == 1) {
             $news = mysqli_fetch_array($result, MYSQLI_ASSOC);
             $news_id = $news['news_id'];
         }
         // split tag
         $tags = explode(',', $tag);
         for ($i = 0; $i < count($tags); $i++) {
             $tag = trim($tags[$i]);
             // check tag exist
             $rs = get_tag_item_by_key($tag);
             // tag not exist
             if (mysqli_num_rows($rs) == 0) {
Exemplo n.º 18
0
$post_method = addslashes($_POST['recipe_method']);
$getRecords = getRecords($post_recipes_name);
if ($_POST['btn-add-recipes'] == "Save Changes" || $_POST['btn-add-recipes'] == "Save Changes & Exit") {
    $checkName = getName($post_recipes_name);
    if ($checkName['rows'] > 0) {
        for ($i = 0; $i <= $getRecords['rows']; $i++) {
            $recipe_name = cleanurl($post_recipes_name . randomchr());
        }
    } else {
        $recipe_name = cleanurl($post_recipes_name);
    }
    $uploads_dir = '../files/uploads/recipes_image/';
    $userfile_name = str_replace(array('(', ')', ' '), '_', $_FILES['upload_recipes_1']['name']);
    $userfile_tmp = $_FILES['upload_recipes_1']['tmp_name'];
    $prefix = 'recipes_image-';
    $prod_img = $uploads_dir . $prefix . $userfile_name;
    move_uploaded_file($userfile_tmp, $prod_img);
    $slider_image = $prefix . $userfile_name;
    $filename = "files/uploads/recipes_image/" . $slider_image;
    addNews($post_category_recipes, $post_recipes_name, $filename, $post_recipes_date, $post_ingredients, $post_sauce, $post_method, cleanurl($recipe_name), 'Visible', 'top');
    if ($_POST['btn-add-recipes'] == "Save Changes & Exit") {
        ?>
      <script>
      location.href = "http://<?php 
        echo $_SERVER['HTTP_HOST'] . get_dirname($_SERVER['PHP_SELF']) . "/recipe-detail/" . cleanurl($recipe_name);
        ?>
";
	  </script>
   <?php 
    }
}
Exemplo n.º 19
0
<!-- Start #main -->
<div id="main">			
	<div class="content">	
	<?php 
if (isset($_GET['action'])) {
    if ($_GET['action'] == 'add') {
        if (isset($_POST['subject'])) {
            addNews($_POST['subject'], $_POST['message'], $user['username']);
        }
        ?>
		<div class="content-header">
			<h4><a href="?p=admin">Main Menu</a> / <a href="?p=admin&sub=news">News</a> / Add News</h4>
		</div> <!-- .content-header -->				
		<div class="main-content">
			<form method="POST" action="?p=admin&sub=news&action=add" class="form label-inline">
			<input type="hidden" name="task" value="addnews">
			
				<table>
					<thead>
						<tr>
							<th><center><?php 
        echo $lang['add_news'];
        ?>
</center></th>
						</tr>
					</thead>
				</table>
				<br />
				
				<!-- Subject -->
				<div class="field">