salve a tutti,
ho un problema:
l'esempio degli script è su www.lavoroprova.altervista.org (per il login, nome:azz ; password:wazzabalubi).
ho questo file dove postare delle news:
index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it">
<head>
<title>Risultato news</title>
<style type="text/css">
body {
background-color: #000;
}
cod {
text-align: center;
font-family: verdana;
font-size: 20px;
position: absolute;
top: 100px;
margin-left: 50%;
left: -400px;
color: #f00;
width: 800px;
}
.titolone {
text-align: center;
font-family: verdana;
font-size: 25px;
position: absolute;
top: 0px;
margin-left: 50%;
left: -100px;
color: #f00;
width: 200px;
}
code {
text-align: center;
font-family: verdana;
font-size: 10px;
position: absolute;
top: 150px;
margin-left: 50%;
left: -250px;
color: #fff;
width: 500px;
}
#log {
text-align: justify;
font-family: verdana;
font-size: 10px;
position: absolute;
top: 0px;
margin-left: 10px;
width: 200px;
}
a:link {
text-decoration: none;
color: #fff;
}
a:visited {
text-decoration: none;
color: #fff
a:hover, a:active {
text-decoration: none;
color: #f00;
}
</style>
</head>
<body>
<div class="titolone">
NEWS
</div>
<?php
$stringa = implode(" ",$_POST);
$stringa=htmlspecialchars($_POST['testo']);
echo "<cod>";
echo $_POST['titolo'];
echo "</cod>
<code>";
echo $_POST['testo'];
echo "</code>";
?>
</body>
</html>
<div id="log">
login
</div>
lo si fa attraverso un login:
login.php
<body style="color: #fff; background-color: #000; font-family: thaoma; text-align: center;"><form method="post" action="login.php">
Username
<input type="text" name="username">
Password
<input type="password" name="password">
<input type="submit" name="login" value="Login">
</form>
<?
if ($_POST["login"] != "")
{
$username = $_POST["username"];
$password = $_POST["password"];
if ($username == "azz" && $password == "wazzabalubi")
{
setcookie("login", "OK");
echo "Benvenuto!
";
echo "ENTRA";
}
else
{
echo "Accesso negato!";
}
}
?>
</body>
si accede cosi ad una pagina privata dove poter modificare le news:
privata.php
<?
if ($_COOKIE["login"] == "")
{
header("location: /login.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="it" xml:lang="it">
<head>
<title>Scrivi News</title>
<style type="text/css">
body {
background-color: #000;
color: #fff;
font-family: thaoma;
font-size:14px;
margin:50px;
}
label {
font-weight:bold;
}
.titolo {
height:20px;
width:200px;
}
textarea {
height:300px;
width:450px;
}
.invia {
width:60px;
}
</style>
</head>
<body>
<form action="index.php" style="text-align:center" method="post">
<label>Titolo:</label>
<input type="text" name="titolo" class="titolo"/>
<label>Testo:</label>
<textarea name="testo"></textarea>
<input type="submit" name="submit" class="invia" />
</form>
</body>
</html>
Ora, come posso far si che le modifiche che faccio alla news resti alla successiva visualizzazione della pagina?
e come posso far si che si possano inserire nuove news senza cancellare le precedenti?
grazie mille in anticipo a tutti!
ciao