|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: |
<?php
// Include the needed file(s)
require_once("require/config.php");
if($isLogged != true) {
core::redir("login.php", "You must be logged in to access this page.", "3", "error");
}
else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Paramount Global Services • News Hub</title>
<link href="news.css" type="text/css" media="all" rel="stylesheet" />
<script type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
elements : "maincontent",
theme : "advanced",
relative_urls : false,
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,link,unlink",
theme_advanced_buttons2 : ",fontselect,fontsizeselect,undo,redo,forecolor,spellchecker",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "bottom",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"
});
</script>
</head>
<div id="container">
<div id="logo"></div>
<?php
// Switch dependant on what the user wants to do
switch($_GET['action']) {
default:
// Echo out welcome etc, with a link to each different item they can do
$username = $userInfo['username'];
echo "<div id=\"maincontent\"><div id=\"welcome\"><h3>Welcome back, {$username}</h3></div><p>This is the news control centre where you can add, edit or delete articles.</p>";
echo "<div id=\"mainoptions\"><ul><li><a href=\"?action=add\">Add a new news article</a></li><li><a href=\"?action=modify\">Modify a news article</a></li><li><a href=\"news-hub.php?action=modify\">View your older news articles</a></li><li><a href=\"logout.php\">Logout</a></li></div>";
// Select top 10 articles
$sqlSel = db::select("articles", "", "0, 10", "id DESC");
while($r = mysql_fetch_array($sqlSel)) {
$title = core::presentString($r['title']);
echo "<ul><li>{$title} - <a href=\"news-hub.php?action=edit&news_id={$r['id']}\">Edit this article</a> / <a href=\"news-hub.php?action=delete&news_id={$r['id']}\">Delete this article</a></li></ul>";
}
echo "</div>";
break;
case 'add':
// Check to see if the item has been posted, if not display a form
if(!$_POST['add_article']) {
?>
<div id="maincontent"><div id="welcome"><h3>Add a new news article</h3></div><p>Please fill out the form below to create your new article, once you have finished please click the 'Submit Article' button at the bottom of the page.</p>
<form method="post" action="news-hub.php?action=add" enctype="multipart/form-data">
<h5>Article Title</h5>
<input type="text" name="title" class="inputboxes" /></p>
<h5>Article Image</h5>
<input type="file" name="file" /></p>
<h5>Article Body</h5>
<textarea name="content" style="width: 100%;"></textarea></p>
<div align="center">
<input type="submit" name="add_article" value="Create your news article" class="formbuttons" />
<input name="reset" type="reset" value="Clear ALL the fields and start over" class="formbuttons" />
</div>
</form>
</div>
<?php
}
else {
// Define some details, clean some fields
$title = core::cleanString($_POST['title']);
$content = core::cleanString($_POST['content']);
$author = $userInfo['username'];
$file = explode('.', $_FILES["file"]["name"]);
$file = $file[0] . '-' . md5(rand(1,10000)) . '.' . $file[1];
if(!move_uploaded_file($_FILES["file"]["tmp_name"], "news/" . $file)) {
echo "<div id=\"maincontent\"><div id=\"welcome\"><h3>Ooops!</h3></div>";
echo '<p>There has been an error uploading the image, please go back and try again.</p></div><br />';
}
chmod($file, 0777);
// Insert into the database
db::insert("articles", "NULL, '$content', '$author', '$title', '$file'");
echo "<div id=\"maincontent\"><div id=\"welcome\"><h3>Good news!</h3></div>";
echo "<p><strong>Your news article was successfully submitted.</strong><br /><br /><a href=\"news-hub.php\">Return to news control centre?</a></p></div>";
}
break;
case 'delete':
// Check to see if an article has been selected for deletion, if not display all articles
if(!$_GET['news_id']) {
$sqlSel = db::select("articles", "", "", "id DESC");
while($r = mysql_fetch_array($sqlSel)) {
$title = core::presentString($r['title']);
echo "<p><a href=\"news-hub.php?action=delete&news_id={$r['id']}\">{$title}</a></p><hr/>";
}
}
else {
$id = core::cleanString($_GET['news_id']);
// Make sure ID is numeric
if(is_numeric($id) == false) {
core::redir("news-hub.php?action=delete", "The article ID has to be numeric.", "3", "error");
}
db::delete("articles", "id = '$id'");
echo "<div id=\"maincontent\"><div id=\"welcome\"><h3>Congratulations</h3></div>";
echo "<p><strong>Your news article has been successfully deleted.</strong></p><p><a href=\"news-hub.php\">Return to news control centre?</a></p></div>";
}
break;
case 'edit':
// Check to see if an article has been selected for editing, if not display all articles
if(!$_GET['news_id']) {
$sqlSel = db::select("articles", "", "", "id DESC");
while($r = mysql_fetch_array($sqlSel)) {
$title = core::presentString($r['title']);
echo "<p><a href=\"news-hub.php?action=edit&news_id={$r['id']}\">{$title}</a></p><hr/>";
}
}
else {
if(!$_POST) {
$id = core::cleanString($_GET['news_id']);
// Make sure ID is numeric
if(is_numeric($id) == false) {
core::redir("news-hub.php?action=edit", "The article ID has to be numeric.", "3", "error");
}
$sqlSel = db::select("articles", "id = '$id'", "", "id DESC");
while($r = mysql_fetch_array($sqlSel)) {
$title = core::presentString($r['title']);
$article = core::presentString($r['content']);
echo "
<div id=\"maincontent\"><div id=\"welcome\"><h3>Edit your news article</h3></div><p>Please edit the sections you wish to below, once you have finished please click the 'Submit Article' button at the bottom of the page.</p>
<form method=\"post\" action=\"news-hub.php?action=edit&news_id={$id}\" enctype=\"multipart/form-data\">
<h5>Article Title</h5>
<input type=\"text\" name=\"title\"/ value=\"{$title}\" class=\"inputboxes\" /></p>
<h5>Article Image (overwrites current image)</h5>
<input type=\"file\" name=\"file\"/>
<h5>Article Body</h5>
<div align=\"center\">
<textarea name=\"content\" style=\"width: 100%;\">{$article}</textarea></p>
<input type=\"submit\" name=\"add_article\" value=\"Create your news article\" class=\"formbuttons\" />
<input name=\"reset\" type=\"reset\" value=\"Clear ALL the fields and start over\" class=\"formbuttons\" />
</div></form></div>";
}
}
else {
$id = core::cleanString($_GET['news_id']);
// Make sure ID is numeric
if(is_numeric($id) == false) {
core::redir("news-hub.php?action=edit", "The article ID has to be numeric.", "3", "error");
}
// Check if there is a file, and if so upload it and rewrite db information
if($_FILES["file"]["name"] != NULL) {
$file = explode('.', $_FILES["file"]["name"]);
$file = $file[0] . '-' . md5(rand(1,10000)) . '.' . $file[1];
if(!move_uploaded_file($_FILES["file"]["tmp_name"], "news/" . $file)) {
echo 'Error uploading the image. Make sure directory \'news\' is set to permission of 0777.';
}
chmod($file, 0777);
db::update("articles", "image = '$file'", "id = '$id'");
}
// Define some details, clean some fields
$title = core::cleanString($_POST['title']);
$content = core::cleanString($_POST['content']);
// Insert into the database
db::update("articles", "content = '$content', title = '$title'", "id = '$id'");
echo "<div id=\"maincontent\"><div id=\"welcome\"><h3>Good news</h3><p>Your article was successfully edited.</p></div>";
echo "<p><a href=\"news-hub.php\">Return to news control centre?</a></p></div>";
}
}
break;
case 'modify':
// Get # of rows
$sqlCount = db::count(db::select("articles", "", "", "id DESC"));
// Select all articles
$sqlSel = db::select("articles", "", "", "id DESC");
echo "<div id=\"maincontent\"><div id=\"welcome\"><h3>Edit your articles</h3><p>Please select which article you would like to edit or delete below.</p></div>";
while($r = mysql_fetch_array($sqlSel)) {
$title = core::presentString($r['title']);
echo "<p>{$title} - <a href=\"news-hub.php?action=edit&news_id={$r['id']}\">Edit</a> / <a href=\"news-hub.php?action=delete&news_id={$r['id']}\">Delete</a></p>";
}
echo "<p><a href=\"news-hub.php\">Return to news control centre?</a></p></div>";
break;
}
}
?>
|
Advertisement
| Hall of Fame |