scusa ma ci sono quasi ma non sono sicuro se vada bene...
io questo è la pagina privata
Codice PHP:
<?php
// Includo
require_once(dirname(__FILE__) . '/../inc.php');
require_once(dirname(__FILE__) . '/member.php');
require_once(dirname(__FILE__) . "/../template/".$template_client."/header.php");
if(isset($error)){ echo $error;}
if(isset($msg)){ echo $msg;} else {
//Query SQL
$intUtentiID = $_SESSION["_userid"];
$strSQL = "SELECT * FROM utenti"
. " WHERE id = ".$_SESSION["_userid"]."";
//Eseguo la query e recupero i dati
$result = mysql_query($strSQL);
$row = mysql_fetch_array($result);
//recupero dati...
$strName = $row['name'];
$strFirstname = $row['firstname'];
$intSex = $row['sex'];
$strbirthDay = $row['birthDay'];
$strbirthMonth = $row['birthMonth'];
$strbirthYear = $row['birthYear'];
$strbirth = $row['birth'];
$location = $row['location'];
$city = $row['city'];
$tel = $row['tel'];
$cel = $row['cel'];
$fax = $row['fax'];
$skype = $row['skype'];
$msn = $row['msn'];
$website = $row['website'];
$photo_url = $row['photo_url'];
$info= $row['info'];
//Libero la memoria
mysql_free_result($result);
if($_POST["invia"])
{
// Dati Inviati dal modulo
$location = (isset($_POST['location'])) ? trim($_POST['location']) : ''; // Metto nella variabile 'user' il dato inviato dal modulo, se non viene inviato dò di default ''
$city = (isset($_POST['city'])) ? trim($_POST['city']) : ''; // Metto nella variabile 'pass' il dato inviato dal modulo, se non viene inviato dò di default ''
$tel = (isset($_POST['tel'])) ? trim($_POST['tel']) : ''; // Metto nella variabile 'mail' il dato inviato dal modulo, se non viene inviato dò di default ''
$cel = (isset($_POST["cel"])) ? trim($_POST["cel"]): '';
$fax = (isset($_POST["fax"])) ? trim($_POST["fax"]): '';
$skype = (isset($_POST["skype"])) ? trim($_POST["skype"]): '';
$msn = (isset($_POST["msn"])) ? trim ($_POST["msn"]): '';
$website = (isset($_POST["website"])) ? trim($_POST["website"]): '';
$photo_url = (isset($_POST["photo_url"])) ? trim($_POST["photo_url"]): '';
$info = (isset($_POST["info"])) ? trim($_POST["info"]): '';
$birthFull = "".$_POST["birthDay"]."/".$_POST["birthMonth"]."/".$_POST["birthYear"]."";
$birthDay = (isset($_POST["birthDay"])) ? trim($_POST["birthDay"]): '';
$birthMonth = (isset($_POST["birthMonth"])) ? trim($_POST["birthMonth"]): '';
$birthYear = (isset($_POST["birthYear"])) ? trim($_POST["birthYear"]): '';
$name = (isset($_POST["name"])) ? trim ($_POST["name"]): '';
$sex = (isset($_POST["sex"])) ? trim ($_POST["sex"]): '';
$firstname = (isset($_POST["firstname"])) ? trim($_POST["firstname"]): '';
// Filtro i dati inviati se i magic_quotes del server sono disabilitati per motivi di sicurezza
if (!get_magic_quotes_gpc()) {
$location = addslashes($location);
$city = addslashes($city);
$tel = addslashes($tel);
$cel = addslashes($cel);
$fax = addslashes($fax);
$skype = addslashes($skype);
$msn = addslashes($msn);
$website = addslashes($website);
$sex = addslashes($sex);
$birthFull = addslashes($birthFull);
$birthDay = addslashes($birthDay);
$birthMonth = addslashes($birthMonth);
$birthYear = addslashes($birthYear);
$name = addslashes($name);
$firstname = addslashes($firstname);
$photo_url = addslashes($photo_url);
$info = addslashes($info);
}
$strSQL = "UPDATE utenti SET"
. " name = '".$name."',"
. " firstname = '".$firstname."', "
. " sex = '".$sex."', "
. " birthDay = '".$birthDay."', "
. " birthMonth = '".$birthMonth."', "
. " birthYear = '".$birthYear."', "
. " birth = '".$birthFull."', "
. " location = '".$location."',"
. " city = '".$city."', "
. " tel = '".$tel."', "
. " cel = '".$cel."', "
. " fax = '".$fax."', "
. " skype = '".$skype."', "
. " msn = '".$msn."', "
. " website = '".$website."', "
. " photo_url = '".$photo_url."', "
. " info = '".$info."'"
. " WHERE id = ".$_SESSION["_userid"]."";
mysql_query($strSQL) OR die("Errore 003, contattare l'amministratore ".mysql_error());
// Reindirizzo l'utente ad una pagina di conferma della registrazione
// header('Location: registrato.php');
$msg = "fatto, modificato";
}
?>
<h1>Modifica Profilo Utenti</h1>
<?php
if(isset($error)){ echo $error;}
if(isset($msg)){ echo $msg;} else {
?>
<form method="post" action="<?php echo $_SERVER["PHP_SELF"]; ?>">
Nome<input name="name" type="text" id="name" value="<?php if(isset($_POST['name'])){echo $_POST['name'];}else { echo $strName; }?>" />
Cognome<input name="firstname" type="text" id="firstname" value="<?php if(isset($_POST['firstname'])){echo $_POST['firstname'];} else { echo $strFirstname; }?>" />
<select name="sex">
<option selected="selected" value="">SELEZIONA</option>
<option value="0" <?php if($row["sex"]=="0") echo 'selected'?>>Maschio</option>
<option value="1" <?php if($row["sex"]=="1") echo 'selected'?>>Femmina</option>
</select>
Giorno<input name="birthDay" type="text" id="birthDay" value="<?php if(isset($_POST['birthDay'])){echo $_POST['birthDay'];} else { echo $strbirthDay; }?>" />
Mese<input name="birthMonth" type="text" id="birthMonth" value="<?php if(isset($_POST['birthMonth'])){echo $_POST['birthMonth'];} else { echo $strbirthMonth; }?>" />
Giorno<input name="birthYear" type="text" id="birthYear" value="<?php if(isset($_POST['birthYear'])){echo $_POST['birthYear'];} else { echo $strbirthYear; }?>" />
location<input name="location" type="text" id="location" value="<?php if(isset($_POST['location'])){echo $_POST['location'];}else { echo $location; }?>" />
city<input name="city" type="text" id="city" value="<?php if(isset($_POST['city'])){echo $_POST['city'];} else { echo $city; }?>" />
tel<input name="tel" type="text" id="tel" value="<?php if(isset($_POST['tel'])){echo $_POST['tel'];} else { echo $tel; }?>" />
cel<input name="cel" type="text" id="cel" value="<?php if(isset($_POST['cel'])){echo $_POST['cel'];} else { echo $cel; }?>" />
fax<input name="fax" type="text" id="fax" value="<?php if(isset($_POST['fax'])){echo $_POST['fax'];} else { echo $fax; }?>" />
skype<input name="skype" type="text" id="skype" value="<?php if(isset($_POST['skype'])){echo $_POST['skype'];} else { echo $skype; }?>" />
msn<input name="msn" type="text" id="msn" value="<?php if(isset($_POST['msn'])){echo $_POST['msn'];} else { echo $msn; }?>" />
website<input name="website" type="website" id="website" value="<?php if(isset($_POST['website'])){echo $_POST['website'];} else { echo $website; }?>" />
photo_url<input name="photo_url" type="text" id="photo_url" value="<?php if(isset($_POST['photo_url'])){echo $_POST['photo_url'];} else { echo $photo_url; }?>" />
Info <textarea rows="10" cols="10" name="info"><?php if(isset($_POST['info'])){echo $_POST['info'];} else { echo $info; }?></textarea>
<input type="submit" value="Aggiungi Utente" name="invia"><input type="reset" value="Annulla Modifiche">
</form>
<?php
}?><?php
}
require_once(dirname(__FILE__) . "/../template/".$template_client."/footer.php");
?>
e questo il nuovo member.php
Codice PHP:
<?php
$member_id = $_COOKIE["id_user"];
if ($_COOKIE["login_a"] !="" ){
$_SESSION["_userid"] = $member_id;
}elseif($_SESSION['login'] == true)
{
}
else
{
$msg = "Non hai fatto i login";
}
?>
e se non è stato fatto i login mi appare:
$msg = "Non hai fatto i login";
e sono visibile header e footer.
Mi dici se è giusto per un mini cms personale e non distribuibile.
grazie mille.