wolfe
03-19-2003, 11:44 AM
i am using a news system that a friend made but it searches for its own global.php file what would i add to it so its intergrated into the Admin CP and you have to login to use it etc and its got the admin design around it like firstalt etc please help
heres the code
<?php
error_reporting(7);
chdir('./forums');
require('./global.php');
$header = '';
$footer = '';
if ($submit) {
if (!$msg) {
echo "Newsitem was not posted, you did not enter a message text...";
} else {
$today = date("D j M Y G:i:s T ");
$sql = "INSERT INTO news (news_id,poster,newstext,postdate) VALUES ( NULL,'$user','$msg','$today')";
$result = mysql_query($sql)
or die ("Error while entering information into database.");
}
}
if ($deleteid) {
$sql = "DELETE FROM news WHERE news_id=$deleteid";
$result = mysql_query($sql)
or die ("Error while removing newspost from database.");
}
?>
<form method="POST" action="<?php echo $PHP_SELF?>">
Username:<br>
<input name="user" type="text" value="Put Your User Name Here" size="25" maxlength="30">
<br>
Type the newsitem you want to add:<br>
<textarea rows="7" name="msg" cols="50">Type You News Message Here</textarea><br>
<input type="submit" value="Post Newsitem" name="submit">
</form>
<?php
$result = mysql_query("SELECT news_id,poster,postdate,newstext FROM news ORDER BY news_id DESC LIMIT 0,25");
while ($myrow = mysql_fetch_array($result)) {
echo "<table border=0 cellpadding=4 cellspacing=1 bgcolor=#000000 width=50% align=center>";
echo "<tr>";
echo "<td width=50% bgcolor=#324A63><b><font face=Verdana size=2>";
$tmp=$myrow["news_id"];
echo "<a href=$PHP_SELF?deleteid=$tmp>DELETE POST</a> ";
printf("id:%s -", $myrow["news_id"]);
printf("newsposter: %s ", $myrow["poster"]);
echo "</font></b></td>";
echo "<td width=50% bgcolor=#324A63 align=right><font face=Verdana size=1>";
printf("%s</font></td>", $myrow["postdate"]);
echo "</tr>";
echo "<tr>";
echo "<td width=100% colspan=2 bgcolor=#324A63><font face=Arial>";
printf("%s</font></td>", $myrow["newstext"]);
echo "</tr>";
echo "</table>";
echo "<br>";
}
eval("\$lnav = \"".gettemplate('webwelcome_nav')."\";");
eval("\$llinks = \"".gettemplate('webwelcome_links')."\";");
?>
please help
heres the code
<?php
error_reporting(7);
chdir('./forums');
require('./global.php');
$header = '';
$footer = '';
if ($submit) {
if (!$msg) {
echo "Newsitem was not posted, you did not enter a message text...";
} else {
$today = date("D j M Y G:i:s T ");
$sql = "INSERT INTO news (news_id,poster,newstext,postdate) VALUES ( NULL,'$user','$msg','$today')";
$result = mysql_query($sql)
or die ("Error while entering information into database.");
}
}
if ($deleteid) {
$sql = "DELETE FROM news WHERE news_id=$deleteid";
$result = mysql_query($sql)
or die ("Error while removing newspost from database.");
}
?>
<form method="POST" action="<?php echo $PHP_SELF?>">
Username:<br>
<input name="user" type="text" value="Put Your User Name Here" size="25" maxlength="30">
<br>
Type the newsitem you want to add:<br>
<textarea rows="7" name="msg" cols="50">Type You News Message Here</textarea><br>
<input type="submit" value="Post Newsitem" name="submit">
</form>
<?php
$result = mysql_query("SELECT news_id,poster,postdate,newstext FROM news ORDER BY news_id DESC LIMIT 0,25");
while ($myrow = mysql_fetch_array($result)) {
echo "<table border=0 cellpadding=4 cellspacing=1 bgcolor=#000000 width=50% align=center>";
echo "<tr>";
echo "<td width=50% bgcolor=#324A63><b><font face=Verdana size=2>";
$tmp=$myrow["news_id"];
echo "<a href=$PHP_SELF?deleteid=$tmp>DELETE POST</a> ";
printf("id:%s -", $myrow["news_id"]);
printf("newsposter: %s ", $myrow["poster"]);
echo "</font></b></td>";
echo "<td width=50% bgcolor=#324A63 align=right><font face=Verdana size=1>";
printf("%s</font></td>", $myrow["postdate"]);
echo "</tr>";
echo "<tr>";
echo "<td width=100% colspan=2 bgcolor=#324A63><font face=Arial>";
printf("%s</font></td>", $myrow["newstext"]);
echo "</tr>";
echo "</table>";
echo "<br>";
}
eval("\$lnav = \"".gettemplate('webwelcome_nav')."\";");
eval("\$llinks = \"".gettemplate('webwelcome_links')."\";");
?>
please help