hjælp til community / nyhedsystem
Hej jeg har fundet et community, men jeg vil godt ligge et nyhedsystem ind i det. men der skal være lvl på så den der har rank: bruger ikke kan gå ind og skrive nyheder, men dem som har rank: Admin godt kan. så jeg vil godt havde lidt hjælp tak. er få i nogen koder..Det er så fra community scriptet
________________________________________________________________
Indbakke.php
<?php
session_start();
include_once("check.php");
include_once("connect.php");
include("menu.php");
if($_GET['do'] == "send"){
if($_POST['til'] == "Alle" && $_SESSION['Rang'] !== "Admin"){
echo "Du er ikke admin, og kan derfor ikke, sende beskeder til alle medlemmer<br>";
echo "<a href=indbakke.php>Tilbage</a>";
exit();
}
$dato = date("d/m-Y H:i:s");
mysql_query("insert into nickin_indbakke set
Dato = '$dato',
Til = '$_POST[til]',
Fra = '$_SESSION[Brugernavn]',
Emne = '$_POST[emne]',
Tekst ='$_POST[tekst]'");
}
if($_GET['do'] == "skriv"){
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<p style="tekst"><strong>Private beskeder!!!</strong></p>
<p>Her kan du se og sende beskeder (MSM) til andre brugere.</p>
<table width="75%" border="0" align="center">
<tr bgcolor="#D4D0C8">
<td><div align="center"><a href="indbakke.php">Indbakke</a></div></td>
<td><div align="center"><a href="indbakke.php?do=laesudbakke">Udbakke</a></div></td>
</tr>
</table>
<table width="50%" border="0" align="center">
<form method="POST" action="indbakke.php?do=send">
<tr>
<td width="25%" align="left" valign="top"> <p> Til:</p></td>
<td width="75%" align="left" valign="top"> <p>
<input type="textfield" name="til">
</p>
<tr>
<td align="left" valign="top">Emne:</td>
<td width="75%" align="left" valign="top"><input type="textfield" name="emne"></td>
</tr>
<tr>
<td align="left" valign="top">Tekst: </td>
<td width="75%" align="left" valign="top"><textarea name="tekst" cols="50" rows="10"></textarea></td>
</tr>
<tr>
<td align="left" valign="top"> </td>
<td width="75%" align="left" valign="top"><input type="submit" name="submit" value="Send"></td>
</tr>
</form>
</table>
<p> </p>
</body>
</html>
<?php
exit;
}
if($_GET['do'] == "svar"){
$sql = mysql_query("select * from nickin_indbakke where
id = '$_GET[id]'");
$data = mysql_fetch_array($sql);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<p style="tekst"><strong>Private beskeder!!!</strong></p>
<p>Her kan du se og sende beskeder (MSM) til andre brugere.</p>
<table width="75%" border="0" align="center">
<tr bgcolor="#D4D0C8">
<td><div align="center"><a href="indbakke.php">Indbakke</a></div></td>
<td><div align="center"><a href="indbakke.php?do=laesudbakke">Udbakke</a></div></td>
</tr>
</table>
<?php
if($data['Fra'] == "Alle"){
?>
<table width="50%" border="0" align="center">
<form method="POST" action="indbakke.php?do=send">
<tr>
<td width="25%" align="left" valign="top"> <p> Til:</p></td>
<td width="75%" align="left" valign="top"> <p>
<input type="textfield" name="til" value="Admin">
</p>
<tr>
<td align="left" valign="top">Emne:</td>
<td width="75%" align="left" valign="top"><input type="textfield" name="emne" value="Re: <?php print $data['Emne'] ?>"></td>
</tr>
<tr>
<td align="left" valign="top">Tekst: </td>
<td width="75%" align="left" valign="top"><textarea name="tekst" cols="50" rows="10"></textarea></td>
</tr>
<tr>
<td align="left" valign="top"> </td>
<td width="75%" align="left" valign="top"><input type="submit" name="submit" value="Send"></td>
</tr>
</form>
</table>
<?php
}else{
?>
<table width="50%" border="0" align="center">
<form method="POST" action="indbakke.php?do=send">
<tr>
<td width="25%" align="left" valign="top"> <p> Til:</p></td>
<td width="75%" align="left" valign="top"> <p>
<input type="textfield" name="til" value="<?php print $data['Fra'] ?>">
</p>
<tr>
<td align="left" valign="top">Emne:</td>
<td width="75%" align="left" valign="top"><input type="textfield" name="emne" value="Re: <?php print $data['Emne'] ?>"></td>
</tr>
<tr>
<td align="left" valign="top">Tekst: </td>
<td width="75%" align="left" valign="top"><textarea name="tekst" cols="50" rows="10"></textarea></td>
</tr>
<tr>
<td align="left" valign="top"> </td>
<td width="75%" align="left" valign="top"><input type="submit" name="submit" value="Send"></td>
</tr>
</form>
</table>
<?php
}
?>
<p> </p>
</body>
</html>
<?php
exit;
}
if($_GET['do'] == "laes"){
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<p style="tekst"><strong>Private beskeder!!!</strong></p>
<p>Her kan du se og sende beskeder (MSM) til andre brugere.</p>
<table width="75%" border="0" align="center">
<tr bgcolor="#D4D0C8">
<td><div align="center"><a href="indbakke.php">Indbakke</a></div></td>
<td><div align="center"><a href="indbakke.php?do=udbakke">Udbakke</a></div></td>
</tr>
</table>
<table width="50%" border="0" align="center">
<tr>
<td width="25%" align="left" valign="top">
<p>Dato:<br>
Fra:<br>
Emne:<br>
Tekst: </p>
</td>
<?php
$sql = mysql_query("select * from nickin_indbakke where
id = '$_GET[id]'");
$data = mysql_fetch_array($sql);
if($data['Til'] == "Alle"){
$sql = mysql_query("select * from nickin_indbakke where
Til = 'Alle' and
id = '$_GET[id]'");
$data = mysql_fetch_array($sql);
?>
<td width="75%" align="left" valign="top">
<p><?php print $data['Dato'] ?><br>
<?php print $data['Fra'] ?><br>
<?php print $data['Emne'] ?><br>
<?php print nl2br($data['Tekst']) ?></p>
</td>
<?php
}else{
$sql = mysql_query("select * from nickin_indbakke where
Til = '$_SESSION[Brugernavn]' and
id = '$_GET[id]'");
$data = mysql_fetch_array($sql);
?>
<td width="75%" align="left" valign="top">
<p><?php print $data['Dato'] ?><br>
<?php print $data['Fra'] ?><br>
<?php print $data['Emne'] ?><br>
<?php print nl2br($data['Tekst']) ?></p>
</td>
<?php
}
?>
</tr>
</table>
<table width="75%" border="0" align="center">
<tr>
<td><div align="center"><a href="indbakke.php?do=svar&id=<?php print $data['id'] ?>">Svar tilbage</a></div></td>
</tr>
</table>
<p> </p>
</body>
</html>
<?php
exit;
}
if($_GET['do'] == "laesudbakke"){
$sql = mysql_query("select * from nickin_indbakke where
Fra = '$_SESSION[Brugernavn]' and
id = '$_GET[id]'");
$data = mysql_fetch_array($sql);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<p style="tekst"><strong>Private beskeder!!!</strong></p>
<p>Her kan du se og sende beskeder (MSM) til andre brugere.</p>
<table width="75%" border="0" align="center">
<tr bgcolor="#D4D0C8">
<td><div align="center"><a href="indbakke.php">Indbakke</a></div></td>
<td><div align="center"><a href="indbakke.php?do=udbakke">Udbakke</a></div></td>
</tr>
</table>
<table width="50%" border="0" align="center">
<tr>
<td width="25%" align="left" valign="top">
<p>Dato:<br>
Fra:<br>
Emne:<br>
Tekst: </p>
</td>
<?php
if($_GET['id'] !== ""){
?>
<td width="75%" align="left" valign="top">
<p><?php print $data['Dato'] ?><br>
<?php print $data['Fra'] ?><br>
<?php print $data['Emne'] ?><br>
<?php print nl2br($data['Tekst']) ?></p>
</td>
<?php
}else{
$sql = mysql_query("select * from nickin_indbakke where
Fra = '$_SESSION[Brugernavn]'");
while($msm = mysql_fetch_array($sql)){
?>
<td width="75%" align="left" valign="top">
<p><?php print $msm['Dato'] ?>
Fra: <?php print $msm['Fra'] ?>
Emne: <?php print $msm['Emne'] ?></p>
</td>
<?php
}
}
?>
</tr>
</table>
<p> </p>
</body>
</html>
<?php
exit;
}
if($_GET['do'] == "udbakke"){
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<p style="tekst"><strong>Private beskeder!!!</strong></p>
<p>Her kan du se og sende beskeder (MSM) til andre brugere.</p>
<table width="75%" border="0" align="center">
<tr bgcolor="#D4D0C8">
<td><div align="center"><a href="indbakke.php">Indbakke</a></div></td>
<td><div align="center"><a href="indbakke.php?do=udbakke">Udbakke</a></div></td>
</tr>
</table>
<table width="75%" border="0" align="center">
<tr bgcolor="#666666">
<td width="33%">
<div align="left">Dato:</div></td>
<td width="33%">
<div align="left">Til:</div></td>
<td width="34%">
<div align="left">Emne:</div></td>
</tr>
</table>
<table width="75%" border="0" align="center">
<?php
$sql = mysql_query("select * from nickin_indbakke where
Fra = '$_SESSION[Brugernavn]' order by id desc");
while($msm = mysql_fetch_array($sql)){
?>
<tr>
<td width="33%" align="left" valign="top"><?php print $msm['Dato'] ?></td>
<td width="33%" align="left" valign="top"><?php print $msm['Til'] ?></td>
<td width="33%" align="left" valign="top"><a href="indbakke.php?do=laesudbakke&id=<?php print $msm['id'] ?>"><?php print $msm['Emne'] ?></a></td>
</tr>
<?php
}
?>
</table>
<table width="75%" border="0" align="center">
<tr>
<td bgcolor="#666666">
<div align="center"><a href="indbakke.php?do=skriv">Skriv Ny</a></div></td>
</tr>
</table>
<p> </p>
</body>
</html>
<?php
exit();
}
?>
<?php
//Selve Indbakken
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<p style="tekst"><strong>Private beskeder!!!</strong></p>
<p>Her kan du se og sende beskeder (MSM) til andre brugere.</p>
<table width="75%" border="0" align="center">
<tr bgcolor="#D4D0C8">
<td><div align="center"><a href="indbakke.php">Indbakke</a></div></td>
<td><div align="center"><a href="indbakke.php?do=udbakke">Udbakke</a></div></td>
</tr>
</table>
<table width="75%" border="0" align="center">
<tr bgcolor="#666666">
<td width="33%">
<div align="left">Dato:</div></td>
<td width="33%">
<div align="left">Fra:</div></td>
<td width="34%">
<div align="left">Emne:</div></td>
</tr>
</table>
<table width="75%" border="0" align="center">
<?php
$sql = mysql_query("select * from nickin_indbakke where
Til = 'Alle' order by id desc");
while($msm = mysql_fetch_array($sql)){
?>
<tr>
<td width="33%" align="left" valign="top"><?php print $msm['Dato'] ?></td>
<td width="33%" align="left" valign="top"><strong><?php print $msm['Fra'] ?></strong></td>
<td width="33%" align="left" valign="top"><a href="indbakke.php?do=laes&id=<?php print $msm['id'] ?>"><?php print $msm['Emne'] ?></a></td>
</tr>
<?php
}
?>
<?php
$sql = mysql_query("select * from nickin_indbakke where
Til = '$_SESSION[Brugernavn]' order by id desc");
while($msm = mysql_fetch_array($sql)){
?>
<tr>
<td width="33%" align="left" valign="top"><?php print $msm['Dato'] ?></td>
<td width="33%" align="left" valign="top"><?php print $msm['Fra'] ?></td>
<td width="33%" align="left" valign="top"><a href="indbakke.php?do=laes&id=<?php print $msm['id'] ?>"><?php print $msm['Emne'] ?></a></td>
</tr>
<?php
}
?>
</table>
<table width="75%" border="0" align="center">
<tr>
<td bgcolor="#666666">
<div align="center"><a href="indbakke.php?do=skriv">Skriv Ny</a></div></td>
</tr>
</table>
<p> </p>
</body>
</html>
_________________________________________
der skal i lige ligge mærke til if($_POST['til'] == "Alle" && $_SESSION['Rang'] !== "Admin")
Men på mit nyhedsystem er, det kun lavet til 1 bruger. men du kan da se koden her..
_________________________________________
Nyhedsystem
<?php
session_start();
if (!isset($_SESSION['laccess'])) {
header("Location: index.php?f=needlogin");
exit;
}
?>
_________________________________________
kan jeg ikke lave den her om til at man skal havde rank: admin for at komme der ind ?
Thx