include('includes/headers.php'); include('includes/auth_0.php'); //include('header.inc'); ?>
$CheckSecurity = new auth(); $username = $_SESSION['username']; $check = $CheckSecurity->page_check($username, $_SESSION['password']); mysql_query("set names latin1"); //---------------------------- först Handlare Nr ----------------- $resultat = mysql_query("select id,uname,status from authuser where uname='$username'") or die (mysql_error()); while ($row = mysql_fetch_array($resultat)) { $HandlareNr = sprintf("%04d", $row['id'] ); } $nyheter = 'nyheter'; if ($HandlareNr <= '1') { //---- Inte inloggad, visa nyheterna ---- echo "';
echo "Nyheter! / Meddelanden: "; $result = mysql_query("SELECT * FROM $nyheter") or die('Fel, hittar inte snabb-knapp texter ' . mysql_error()); $i = 0; while ($row = mysql_fetch_array($result)){ $kid[$i] =$row["id"]; $rubrik[$i] =$row["rubrik"]; $text[$i] =$row["text"]; $datum[$i] =$row["datum"]; $visas[$i] =$row["visas"]; echo " " . $rubrik[$i] . " "; echo $text[$i] . " "; $i++; } mysql_free_result($result); echo ' |
'; print_r($_POST); echo ''; //$data = $_POST; //echo $_POST['BUTTS0']; //die(); echo $_POST['visas3']; $q = "REPLACE INTO $nyheter ( id, rubrik, text, datum, visas ) VALUES"; for ($index = 0; $index <= 3; $index++) { //echo $_POST['visas'.$index]; $q .= " ( '". ($index + 1) ."', '" . $_POST['rubr'.$index] . "', '" . $_POST['butts'.$index] . "', '" . $_POST['button'.$index] . "', '" . $_POST['visas'.$index] . "' )"; if ($index < 3) $q .= ", "; } //echo $q; $rs = mysql_query($q) or die(mysql_error()); //die(); } $result = mysql_query("SELECT * FROM $nyheter") or die('Fel, hittar inte snabb-knapp texter ' . mysql_error()); $i = 0; while ($row = mysql_fetch_array($result)){ $kid[$i] =$row["id"]; $rubrik[$i]=$row["rubrik"]; $text[$i]=$row["text"]; $datum[$i]=$row["datum"]; $visas[$i]=$row["visas"]; //echo $rubrik[$i] . "