Benvenuto Ospite Cerca | Topic Attivi | Utenti | | Log In | Registra

AREA PRIVATA Opzioni
dylandog73
Inviato: Sunday, August 12, 2007 2:38:49 PM

Rank: AiutAmico

Iscritto dal : 1/12/2006
Posts: 283
Ciao,qualcuno sa dirmi come posso rendere privata(facendo cioe' accedere solo utenti registrati con user e password)una sezione del mio sito?
E' necessario l'utilizzo di un programma specifico o è una cosa che viene impostata tramite l'editor HTML?(nel mio caso front page).
Grazie sicuro di una esauriente risposta(come sempre).
http://www.sangennarolucca.altervista.org
Sponsor
Inviato: Sunday, August 12, 2007 2:38:49 PM

 
a.roselli
Inviato: Sunday, August 12, 2007 7:56:00 PM

Rank: Admin

Iscritto dal : 10/4/2000
Posts: 19,044
Se vuoi far scaricare file solo a persone autorizzate l'unico modo che posso consigliarti e di prendere uno spazio web su http://www.virtuale.org/ è più o meno come altervista ma con minor spazio a disposizione

questa e la mia pagina di prova
http://volontariweb.virtuale.org/

se clicchi sul primo link puoi scaricare il giochino Tetris solo se conosci la password

il secondo link invece ti permette di entrare nella pagina web sempre se conosci la password, insomma qualsiasi cosa inserisci nella cartella PRIVATE già presente nello spazio web, sarà accessibile solo con username e password da te forniti

puoi anche dare username e password diverse per ogni utente dal pannello di controllo, il servizio è gratuito e in italiano

La username e password per provare nel mio sito di prova è <font color=red>alfonso</font id=red> inseriscilo in entrambe le caselle, ma prova prima a cliccare senza inserirla o a inserirla diversamente.

Puoi quindi mettere un link al tuo sito per accedere ai file che ti interessano.

alfonso_aiutamici@hotmail.it

dylandog73
Inviato: Sunday, August 12, 2007 11:47:43 PM

Rank: AiutAmico

Iscritto dal : 1/12/2006
Posts: 283
Quello che intendevo io è fare accedere a una parte del sito solo persone registrate,come si fa ad esempio x il forum di aiutamici,in modo che dal momento che si registrano accettino di ricevere newsletter ecc....come si fa anche in aiutamici(anche se non è obbligatorio)...come posso fare?(un altro esempio è altervista che x farti accedere a certi servizi chiede la registrazione).
Grazie...spero di essermi spiegato bene...non è facile quando si condensa il proprio pensiero in10 righe!!!
dylandog73
Inviato: Sunday, August 12, 2007 11:48:03 PM

Rank: AiutAmico

Iscritto dal : 1/12/2006
Posts: 283
Quello che intendevo io è fare accedere a una parte del sito solo persone registrate,come si fa ad esempio x il forum di aiutamici,in modo che dal momento che si registrano accettino di ricevere newsletter ecc....come si fa anche in aiutamici(anche se non è obbligatorio)...come posso fare?(un altro esempio è altervista che x farti accedere a certi servizi chiede la registrazione).
Grazie...spero di essermi spiegato bene...non è facile quando si condensa il proprio pensiero in10 righe!!!
dylandog73
Inviato: Monday, August 13, 2007 12:09:47 AM

Rank: AiutAmico

Iscritto dal : 1/12/2006
Posts: 283
X spiegarmi meglio:
La registrazione x accedere ai contenuti di aiutamici non è obbligatoria...ma poniamo il caso che non fosse cosi':
come faresti x darmi la possibilita' di registrarmi ai servizi?(in modo da potermi permettere di usufruire di tutti gli utilissimi servizi che metti a disposizione).
ciao
a.roselli
Inviato: Monday, August 13, 2007 8:48:26 PM

Rank: Admin

Iscritto dal : 10/4/2000
Posts: 19,044
In quel caso devi studiare la programmazione in ASP o PHP, in HTML non si puà fare.

alfonso_aiutamici@hotmail.it

dylandog73
Inviato: Monday, August 13, 2007 10:47:34 PM

Rank: AiutAmico

Iscritto dal : 1/12/2006
Posts: 283
Grazie..esauriente come sempre...puoi consigliarmi dove trovare qualche rudimentale nozione di: "php"?
A presto
a.roselli
Inviato: Monday, August 13, 2007 10:57:28 PM

Rank: Admin

Iscritto dal : 10/4/2000
Posts: 19,044
Cerca "GUIDA PHP" nei motori di ricerca e troverai molte indicazioni.

alfonso_aiutamici@hotmail.it

dylandog73
Inviato: Tuesday, August 14, 2007 10:56:24 AM

Rank: AiutAmico

Iscritto dal : 1/12/2006
Posts: 283
Ciao,ho seguito il tuo consiglio...ho trovato degli script in php da inserire nel sito.Da qui
http://www.mrwebmaster.it/script/php/

ne ho trovato uno che serve per creare un database x memorizzare le password.
Pero' dopo avere trasferito lo script sul server e digitato l'indirizzo preciso dell'index.php si visualizza un messaggio del tipo: impossibile trovare il database.
Sbaglio in qualche cosa?
Potresti dirmi se forse altervista non supporta questo servizio?
Se invece lo supporta sono io che sbaglio a trasferire lo script sul server?
Grazie.
dylandog73
Inviato: Tuesday, August 14, 2007 11:02:11 AM

Rank: AiutAmico

Iscritto dal : 1/12/2006
Posts: 283
Scusa Alfonso...di nuovo io...questa cosa(anche se non capisco cosa sia)puo' essere la causa del messaggio di errore?

http://www.mrwebmaster.it/database/mysql/guida_mysql/lezione301.htm

Grazie di nuovo e scusa se rompo...
a.roselli
Inviato: Tuesday, August 14, 2007 2:53:26 PM

Rank: Admin

Iscritto dal : 10/4/2000
Posts: 19,044
Su ASP e PHP non ti posso aiutare, l'unica cosa che so di ASP è quello inserito nella lezione 24, la programmazione di aiutamici non è opera mia.

alfonso_aiutamici@hotmail.it

dylandog73
Inviato: Thursday, August 16, 2007 12:21:43 AM

Rank: AiutAmico

Iscritto dal : 1/12/2006
Posts: 283
Scusami,anche se mi hai detto che il php non è il tuo forte ho pensato che forse mi pui aiutare lostesso:sono riuscito a installare il db,riesco a registrarmi,ma dopo vengo reindirizzato sulla pagina di ben venuto.Ho cercato in tutti i modi di reindirizzare il collegamento su una pagina da me voluta...ma niente.Ho provato dal pannello admin di altervista e da quello che a cui posso accedere direttamente da una pagina php presente nello script che ho scaricato.Non c'e' modo...Io credo che si possa fare solo modificando iltesto...e qui entri in gioco tu:
(?PHP
###########################################
#-----------Users login system------------#
###########################################
/*=========================================Author : Mohammed Ahmed(M@@king) \Version : 1.1 \Date Created: Aug 20 2005 \---------------------------- \Last Update: 18-SEP-2006 \---------------------------- \Country : Palestine \City : Gaza \E-mail : m@maaking.com \WWW : http://www.maaking.com \Mobile/SMS : 00972-599-622235 \ \===========================================------------------------------------------*/
include ("functions.php");

// the Default function.
//note for functions: if you want to include a value of some variables inside the funtions,
//then you have to GLOBAL it first.
function index($user) {
global $db, $prefix;

//check if the user is logged in or not.
if (is_logged_in($users)) {
include("header.php");

//get_my_info($user);
$cookie_read = explode("|", base64_decode($user));
//define variables to hold cookie values.
$userid = $cookie_read[0];
$username = $cookie_read[1];
$password = $cookie_read[2];
$ipaddress = $cookie_read[3];
$lastlogin_date = $cookie_read[4];
$lastlogin_time = $cookie_read[5];
if($ipaddress == "") $ipaddress = ""._NOT_YET."";

//print wilcome message
echo ""._WELCOME." (b)$username(/b), "._LAST_LOGIN." "._FROM.": [$ipaddress] "._ON." [$lastlogin_date @ $lastlogin_time] ((a href=privato/users.php?maa=Logout)"._LOGOUT."(/a))";
echo "(br)(br)(br)(br)";
navigation_menu();

include("footer.php");
}else{
//if the user is not logged in then show the login form.
// header("Location: users.php?maa=Login"); die();
include("header.php");
login_form();
include("footer.php");
}
}
################################################################################
#------------------------------------------------------------------------------#
# navigation menu
#------------------------------------------------------------------------------#
################################################################################
function navigation_menu(){
echo " (center)"
." [ (a href=\"users.php\")"._HOME."(/a) ] "
." [ (a href=\"users.php\")"._MY_ACCOUNT."(/a) ] "
." [ (a href=\"users.php?maa=EditMyInfo\")"._CHANGE_MY_INFO."(/a) ]"
." [ (a href=\"users.php?maa=ChangePWD\")"._CHANGE_MY_PASSWORD."(/a) ]"
." [ (a href=\"users.php?maa=Logout\")"._LOGOUT."(/a) ]"
." (/center)(br)";
}
################################################################################
#------------------------------------------------------------------------------#
# login
#------------------------------------------------------------------------------#
################################################################################
//the login form
// in this form there is hidden field ((input type=\"hidden\" name=\"maa\" value=\"do_login\"))
//this used to do the login process
function login_form(){
global $username,$user_err,$pass_err,$error_msg;

echo "(center)(font class=\"title\")"._PLEASE_ENTER_YOUR_USER."(/font)(/center)\n";
echo "
(center)
(form method=\"POST\" action=\"users.php\" name=\"loginform\")
(table border=\"0\" cellspacing=\"2\" cellpadding=\"4\")
(tr)
(td bgcolor=\"#E2E2E2\")"._USERNAME." : (/td)
(td bgcolor=\"#E2E2E2\")(input type=\"text\" name=\"username\" value=\"$username\" size=\"11\") $user_err(/td)
(/tr)
(tr)
(td bgcolor=\"#E2E2E2\")"._PASSWORD." : (/td)
(td bgcolor=\"#E2E2E2\")(input type=\"password\" name=\"password\" size=\"11\") $pass_err(/td)
(/tr)
(tr)
(td colspan=2)"._REMEBER_ME." (input type=\"checkbox\" name=\"remember\" value=\"ON\")(/td)
(/tr)
(tr)
(td)andnbsp;(/td)
(td) (input type=\"hidden\" name=\"maa\" value=\"do_login\")
(input type=\"submit\" value=\""._LOGIN."\")(/p)
(/td)
(/tr)
(/table) $error_msg
(/form)[(a href=\"index.php\")"._HOME."(/a)] [ (a href=\"users.php?maa=Register\")"._REGISTER."(/a) (img src=\"images/register.gif\") ] [ (a href=\"users.php?maa=Forgot_pwd\")"._FORGOT_PASSWORD."(/a) (img src=\"images/forgot_pwd.gif\") ](br)(br)";
}

//a login function to call the login form.
function Login(){
include("header.php");
login_form();
include("footer.php");
}

//this function will do the login porcess for you.
function do_login(){
// define the values from the form.
//note for functions: if you want to include a value of some variables inside the funtions,
//then you have to GLOBAL it first.
global $prefix,$db,$username,$password, $remember, $user_err,$pass_err,$error_msg,$REMOTE_ADDR;

//check username and password fields.
if((!$username) || (!$password)){
include("header.php");

$reqmsg= "((font class=\"error\")"._REQUIRED."(/font))";
if(trim(empty($username))){
$user_err= $reqmsg;
}
if(empty($password)){
$pass_err= $reqmsg;
}

//load the login form again.
login_form();
include("footer.php");
exit();
}

##--nothing empty? lets do the login
//encyrpt password for more Security
$md5_pass = md5($password);
$sql = $db-)sql_query("SELECT * FROM ".$prefix."_users WHERE username='$username' AND password='$md5_pass'");
$login_check = $db-)sql_numrows($sql);
///////////////////////////////////////////////////////////////////////
//if the entered informations are correct, then login and create the cookies.
if($login_check ) 0){
while($row = $db-)sql_fetchrow($sql)){

$userid = $row['userid'];
$username = $row['username'];
$password = $row['password'];
$ipaddress = $row['ipaddress'];

$lastlogin = explode(" ", $row['lastlogin']);
$lastlogin_date = $lastlogin[0];
$lastlogin_time = $lastlogin[1];

$info = base64_encode("$userid|$username|$password|$ipaddress|$lastlogin_date|$lastlogin_time");
if (isset($remember)){
setcookie("user","$info",time()+1209600);
}else{
setcookie("user","$info",0);
}
$db-)sql_query("UPDATE ".$prefix."_users SET ipaddress='$REMOTE_ADDR', lastlogin=NOW() WHERE userid='$userid'");

//print success message and redirect browser
msg_redirect(""._LOGIN_SUCCESS."","users.php","5");
}
//if the entered informations are wrong, then print error message.
}else{
//include("header.php");
$error_msg = "(font class=\"error\")"._LOGIN_ERROR."(/font)";
unset($username);
unset($password);

include("header.php");
login_form();
include("footer.php");
exit();
}
}


################################################################################
#------------------------------------------------------------------------------#
# logout
#------------------------------------------------------------------------------#
################################################################################
function Logout($user) {
global $db, $prefix;

unset($user);
setcookie("user", false);
$user = "";
header("Location: users.php");

}
################################################################################
#------------------------------------------------------------------------------#
# Register
#------------------------------------------------------------------------------#
################################################################################
function Register(){

include("header.php");
register_form();
include("footer.php");
}

function register_form(){
global $username, $password, $password2, $email, $fullname, $user_taken_err, $email_taken_err;
echo "(center)(font class=\"title\")"._REG_FORM."(/font)(/center)(br)\n";
//onsubmit='return CheckRegisterForm(RegisterForm)'
echo "(center)"._FILED_STAR_REQUIRED."
(form name=\"RegisterForm\" method=\"POST\" action=\"users.php\")
(table align=\"center\" border=\"1\" width=\"400\" id=\"table1\" cellpadding=\"2\" bordercolor=\"#C0C0C0\")
(tr)
(td width=\"150\" align=\"right\")"._USERNAME." :(/td)
(td)(input type=\"text\" name=\"username\" size=\"18\" value=\"$username\") * $user_taken_err(/td)
(/tr)
(tr)
(td align=\"right\")"._PASSWORD." :(/td)
(td)(input type=\"password\" name=\"password\" size=\"18\" value=\"$password\") *(/td)
(/tr)
(tr)
(td align=\"right\")"._RETYPE_PASSWORD." :(/td)
(td)(input type=\"password\" name=\"password2\" size=\"18\" value=\"$password2\") *(/td)
(/tr)
(tr)
(td align=\"right\")"._EMAIL." :(/td)
(td)(input type=\"text\" name=\"email\" size=\"27\" value=\"$email\") * $email_taken_err(/td)
(/tr)
(tr)
(td align=\"right\")"._FULLNAME." :(/td)
(td)(input type=\"text\" name=\"fullname\" size=\"27\" value=\"$fullname\")(/td)
(/tr)
(tr)
(td)&nbsp;(/td)
(td) (input type=\"hidden\" name=\"maa\" value=\"do_Register\")
(input type=\"submit\" value=\""._REGISTER."\")(/td)
(/tr)
(/table)
(/form)
(center)"._GOBACK." "._GOHOME."(/center)";
}
function do_Register(){
global $db, $prefix, $username, $password, $password2, $email, $fullname, $user_taken_err, $email_taken_err;
global $site_name, $site_email, $site_url;

//this function will check fields incase of javascript not working.
if((!$username) || (!$password) || (!$password2) || (!$email)){

if(trim(empty($username))){

}
if(empty($password)){

}
if(empty($password2)){

}
if(trim(empty($email))){

}
//print the error message and load the form.
include("header.php");


echo "(center)(font class=\"error\")"._ERROR_PLEASE_FILL_FIELDS."(/font)(/center)\n";
register_form();
include("footer.php");
exit();
}
//this code will check if the 2 passwords are match or not.
if($password != $password2){
//print the error message and load the form.
include("header.php");

register_form();
echo "(center)(font class=\"error\")"._ERROR_PASSWORD_DOESNT_MATCH."(/font)(/center)\n";

include("footer.php");
exit();
}
//this code will check if the email is correct or not
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){
//print the error message and load the form.
include("header.php");

register_form();
echo "(center)(font class=\"error\")"._ERROR_INVALID_EMAIL."(/font)(/center)\n";

include("footer.php");
exit();
}


//--nothing empty? everything is okay? lets do the register.
$sql_email_check = $db-)sql_query("SELECT email FROM ".$prefix."_users WHERE email='$email'");
$sql_username_check = $db-)sql_query("SELECT username FROM ".$prefix."_users WHERE username='$username'");
$email_check = $db-)sql_numrows($sql_email_check);
$username_check = $db-)sql_numrows($sql_username_check);

if(($email_check ) 0) || ($username_check ) 0)){

//define error message for usage in multi plces.
$exist_msg= "(font class=\"error\")"._ALREADY_TAKEN."(/font)";

if($email_check ) 0){
$email_taken_err = $exist_msg;
unset($email);
}

if($username_check ) 0){
$user_taken_err = $exist_msg;
unset($username);
}

//if the username or email already been taken load the form and print errors.
include("header.php");
register_form();
include("footer.php");
exit();
}
$md5_password = md5($password);
$result = $db-)sql_query("INSERT INTO ".$prefix."_users ( username,password,email,fullname,regdate)
VALUES('$username','$md5_password','$email','$fullname',NOW())");
$subject = ""._YOUR_INFO_AT." $site_name";
$message = "\n";
$message .= ""._WELCOME_TO." $site_name \n";
$message .= "\n";
$message .= ""._PLZ_KEEP_THIS_EMAIL." \n";
$message .= "\n";
$message .= "---------------------------- \n";
$message .= ""._USERNAME.": $username \n" ;
$message .= ""._PASSWORD.": $password \n";
$message .= "---------------------------- \n";
$message .= "\n" ;
$message .= ""._YOUR_ACCOUNT_IS_CURRENTLY_ACTIVE." \n";
$message .= "\n" ;
$message .= "$site_url \n";
$message .= "\n";
$message .= ""._PLZ_DONT_FORGOT_PWD." \n";
$message .= " \n";
$message .= ""._THANKS_FOR_REGISTERING." \n";
$message .= "\n";
$message .= "-- \n";
$message .= "- $site_name \n";
$message .= "$site_url \n";
$message .= "\n";
$message .= "\n";
$message .= ""._THIS_EMAIL_AUTO_GENERATED." \n" ;
$message .= ""._DONT_RESPOND_WILL_IGNORED." \n";

if(!mail($email,$subject,$message, "FROM: $site_name ($site_email)")){
die (""._EMAIL_DIE."");
}else{
include("header.php");
echo "(div align=\"center\" class=\"div\")"._REG_SUCCESS."(/div)";
login_form();
include("footer.php");
}
}

################################################################################
#------------------------------------------------------------------------------#
# Forgot Password
#------------------------------------------------------------------------------#
################################################################################
function Forgot_pwd_form(){
global $error_msg;

echo "(center)(font class=\"title\")"._SEND_NEW_PASSWORD."(/font)
(form method='POST' action='users.php')
(table border='0' cellpadding='4')
(tr)
(td bgcolor='#E2E2E2')"._USERNAME." :(/td)
(td bgcolor='#E2E2E2')(input type='text' name='username' size='11')(/td)
(/tr)
(tr)
(td bgcolor='#E2E2E2')"._EMAIL." :(/td)
(td bgcolor='#E2E2E2')(input type='text' name='email' size='11')(/td)
(/tr)
(tr)
(td)&nbsp;(/td)
(td)
(input type='hidden' name='maa' value='do_Forgot_pwd')
(input type='submit' value='"._SEND_PASSWORD."')(/p)
(/td)
(/tr)
(/table)(center)$error_msg(/center)
(/form)";
}

function Forgot_pwd(){
global $user, $prefix, $db;

include("header.php");
Forgot_pwd_form();
include("footer.php");
}

function do_Forgot_pwd(){
global $user, $prefix, $db, $email, $username, $error_msg, $site_name ,$site_email, $site_url;

$result = $db-)sql_query("SELECT * FROM ".$prefix."_users WHERE username='$username' AND email='$email'");
$check = $db-)sql_numrows($result);
if($check == 1){

function new_pwd() {
$chars = "abchefghjkmnpqrstuvwxyz0123456789";
srand((double)microtime()*1000000);
$i = 0;
while ($i (= 7) {
$num = rand() : 33;
$tmp = substr($chars, $num, 1);
$pwd = $pwd . $tmp;
$i++;
}
return $pwd;
}
$new_pwd = new_pwd();
$md5_password = md5($new_pwd);
$sql = $db-)sql_query("UPDATE ".$prefix."_users SET password='$md5_password' WHERE email='$email'");

$subject = ""._NEW_PASSWORD."";
$message = " \n";
$message .= ""._HELLO." $username, \n";
$message .= " \n";
$message .= ""._YOU_ARE_RECEIVING_EMAIL." $site_name. \n";
$message .= " \n";
$message .= ""._HERE_ISIT_BELOW." \n";
$message .= "-------------------------- \n";
$message .= ""._USERNAME.": $username \n";
$message .= ""._PASSWORD.": $new_pwd \n";
$message .= "-------------------------- \n";
$message .= ""._YOU_MAY_LOGIN_BELOW." \n";
$message .= "$site_url \n";
$message .= " \n";
$message .= ""._YOU_CAN_OFCOURSE_CHANGE_PWS." \n";
$message .= " \n";
$message .= "-- \n";
$message .= "-"._THANKS." \n";
$message .= "$site_name \n";
$message .= " \n";
$message .= ""._THIS_EMAIL_AUTO_GENERATED." \n";
$message .= ""._DONT_RESPOND_WILL_IGNORED." \n";

if(!mail($email,$subject,$message, "FROM: $site_name ($site_email)")){
die (""._EMAIL_DIE."");
}

//print success message and redirect browser
msg_redirect(""._NEW_PWD_SENT_TO_YOUR_EMAIL."","users.php","10");

//this else for : if($check == 1){
}else{
include("header.php");
Forgot_pwd_form();
echo "(center)(font class=\"error\")"._WRONG_USEREMAIL."(/font)(/center)(br)";
include("footer.php");
}
}

################################################################################
#------------------------------------------------------------------------------#
# Change Password
#------------------------------------------------------------------------------#
################################################################################
function change_pwd_form(){
global $user;
if (is_logged_in($user)) {
navigation_menu();

echo "(center)(font class=\"title\")"._CHANGE_MY_PWD."(/font)
(br) "._ONCE_CHANGED_LOGOUT."
(form method='POST' action='users.php')
(table border='0' cellpadding='4')
(tr)
(td bgcolor='#E2E2E2')"._OLD_PWD." :(/td)
(td bgcolor='#E2E2E2')(input type='password' name='old_pwd' size='11')(/td)
(/tr)
(tr)
(td bgcolor='#E2E2E2')"._NEW_PWD." :(/td)
(td bgcolor='#E2E2E2')(input type='password' name='new_pwd1' size='11')(/td)
(/tr)
(tr)
(td bgcolor='#E2E2E2')"._CONFIRM_NEW_PWD." :(/td)
(td bgcolor='#E2E2E2')(input type='password' name='new_pwd2' size='11')(/td)
(/tr)
(tr)
(td align=center colspan=2)
(input type='hidden' name='maa' value='do_ChangePWD')
(input type='submit' value='"._CHANGE_PWD."')(/p)
(/td)
(/tr)
(/table)
(/form)";
}else{
echo "(br /)(center)(font class=\"title\")"._NOT_AUTHORIZED."(/font)";
}
}
function ChangePWD(){
global $user, $prefix, $db;

include("header.php");
change_pwd_form();
include("footer.php");
}
function do_ChangePWD(){
global $user, $prefix, $db, $old_pwd, $new_pwd1, $new_pwd2;

if (is_logged_in($user)) {

//check empty fields
if((empty($old_pwd)) or (empty($new_pwd1)) or (empty($new_pwd2))){
include("header.php");
change_pwd_form();
echo "(center)(font class=\"error\")"._ERROR_PLEASE_FILL_FIELDS."(/font)";
include("footer.php");
exit();
}

$cookie_read = explode("|", base64_decode($user));
$userid = $cookie_read[0];

$old_pwd_md5 = md5($old_pwd);
$result = $db-)sql_query("SELECT userid,password FROM ".$prefix."_users WHERE userid='$userid' AND password='$old_pwd_md5'");

if($db-)sql_numrows($result) == 0){

include("header.php");
change_pwd_form();
echo "(center)(font class=\"error\")"._OLD_PWD_DONT_MATCH."(/font)(/center)(br)";
include("footer.php");
exit();

}else{

if($new_pwd1 != $new_pwd2){

include("header.php");
change_pwd_form();
echo "(center)(font class=\"error\")"._ERROR_NEW_PWD_DOESNT_MATCH."(/font)(/center)(br)";
include("footer.php");
exit();

}else{

$md5_password = md5($new_pwd1);
$sql = $db-)sql_query("UPDATE ".$prefix."_users SET password='$md5_password' WHERE userid='$userid'");

$msg = ""._SUCCESS_PWD_CHANGED." (br) "._PLZ_REMEBER_NEW_PWS." ";
//print success message and redirect browser
msg_redirect("$msg","users.php","10");
}
}
}else{
echo "(br /)(center)(font class=\"title\")"._NOT_AUTHORIZED."(/font)";
}

}
################################################################################
#------------------------------------------------------------------------------#
# Change MyInfo
#------------------------------------------------------------------------------#
################################################################################
function EditMyInfo(){

include("header.php");
EditMyInfo_form();
include("footer.php");
}

function EditMyInfo_form(){
global $user, $db, $prefix, $username, $password, $email, $fullname, $user_taken_err, $email_taken_err;

if (is_logged_in($user)) {
navigation_menu();

$cookie_read = explode("|", base64_decode($user));
$userid = $cookie_read[0];
$result = $db-)sql_query("SELECT * FROM ".$prefix."_users WHERE userid='$userid'");
$row = $db-)sql_fetchrow($result);

echo "(center)(font class=\"title\")"._CHANGE_MY_INFORMATION."(/font)(/center)(br)\n";
echo "(center)"._FILED_STAR_REQUIRED."
(form name=\"EditMyInfoForm\" method=\"POST\" action=\"users.php\")
(table align=\"center\" border=\"1\" width=\"500\" id=\"table1\" cellpadding=\"2\" bordercolor=\"#C0C0C0\")
(tr)
(td width=\"100\" align=\"right\")"._USERNAME." :(/td)
(td)(input type=\"text\" disabled=\"true\" name=\"username\" size=\"18\" value=\"$row[username]\")(/td)
(/tr)
(tr)
(td align=\"right\")"._EMAIL." :(/td)
(td)(input type=\"text\" name=\"email\" size=\"27\" value=\"$row[email]\") * $email_taken_err(/td)
(/tr)
(tr)
(td align=\"right\")"._FULLNAME." :(/td)
(td)(input type=\"text\" name=\"fullname\" size=\"27\" value=\"$row[fullname]\")(/td)
(/tr)
(tr)
(td align=\"right\")"._WEBSITE." :(/td)
(td)(input type=\"text\" name=\"site\" size=\"27\" value=\"$row[site]\") "._EG." http://www.site.com(/td)
(/tr)
(tr)
(td align=\"right\")"._COUNTRY." :(/td)
(td)(input type=\"text\" name=\"country\" size=\"27\" value=\"$row[country]\")(/td)
(/tr)
(tr)
(td align=\"right\")"._CITY.":(/td)
(td)(input type=\"text\" name=\"city\" size=\"27\" value=\"$row[city]\")(/td)
(/tr)
(tr)
(td align=\"right\")"._TEL_MOBILE." :(/td)
(td)(input type=\"text\" name=\"tel\" size=\"27\" value=\"$row[tel]\")(/td)
(/tr)
(tr)
(td align=\"right\")"._PROFILE.":(/td)
(td)(textarea rows=\"5\" name=\"profile\" cols=\"30\")$row[profile](/textarea)(/td)
(/tr)
(tr)
(td)&nbsp;(/td)
(td) (input type=\"hidden\" name=\"maa\" value=\"do_EditMyInfo\">
(input type=\"submit\" value=\""._SAVE_CHANGES."\">(/td>
(/tr>
(/table>(/form>";

}else{
echo "(br />(center>(font class=\"title\">"._NOT_AUTHORIZED."(/font>";
}

}
function do_EditMyInfo(){
global $user, $db, $prefix, $email, $fullname, $email_taken_err;
global $site, $country, $city, $tel, $profile;
global $site_name, $site_email, $site_url;

if (is_logged_in($user)) {
//this function will check fields incase of javascript not working.
if(trim(empty($email))){
//print the error message and load the form.
include("header.php");

EditMyInfo_form();
echo "(center>(font class=\"error\">"._ERROR_PLEASE_FILL_FIELDS."(/font>(/center>\n";
include("footer.php");
exit();
}

$cookie_read = explode("|", base64_decode($user));
$userid = $cookie_read[0];

/*--nothing empty? everything is okay? lets do the changes--*/
$sql_email_check = $db->sql_query("SELECT email FROM ".$prefix."_users WHERE email='$email' AND userid!='$userid'");
$email_check = $db->sql_numrows($sql_email_check);
//define error message for usage in multi plces.
$exist_msg= "(font class=\"error\">("._THE_EMAIL." $email: "._ALREADY_TAKEN.")(/font>";

if($email_check > 0){
$email_taken_err = $exist_msg;
unset($email);
//if the email already been taken load the form and print errors.
include("header.php");
EditMyInfo_form();
include("footer.php");
exit();
}

$result = $db->sql_query("UPDATE ".$prefix."_users
SET email='$email',
fullname='$fullname',
site='$site',
country='$country',
city='$city',
tel='$tel',
profile='$profile'
WHERE userid='$userid'");

//print success message and redirect browser
msg_redirect(""._YOUR_INFO_HAS_BEEN_CHANGES."","users.php","5");
}else{
echo "(br />(center>(font class=\"title\">"._NOT_AUTHORIZED."(/font>";
}


}

################################################################################
#------------------------------------------------------------------------------#
# a switch for switching between functions
#------------------------------------------------------------------------------#
################################################################################
switch ($maa){

case "EditMyInfo":
EditMyInfo();
break;

case "do_EditMyInfo":
do_EditMyInfo();
break;

case "ChangePWD":
ChangePWD();
break;

case "do_ChangePWD":
do_ChangePWD();
break;

case "Forgot_pwd":
Forgot_pwd();
break;

case "do_Forgot_pwd":
do_Forgot_pwd();
break;

case "Register":
Register();
break;

case "do_Register":
do_Register();
break;

case "Logout":
Logout($user);
break;

case "Login":
Login();
break;

case "do_login":
do_login();
break;
//load the default function.
Default:
index($user);
Break;
}
//update No. 0.0.2
//last update DEC 03, 2005 @ 9:30 PM Gaza time. (+2 GMT)
?>

Riesci a capire dove posso inserire l'indirizzo x il redirect dopo il login?
Grazie(senza impegno..non voglio complicarti la vita.)
http://www.sangennarolucca.altervista.org/login/index.php
a.roselli
Inviato: Saturday, August 18, 2007 8:50:03 AM

Rank: Admin

Iscritto dal : 10/4/2000
Posts: 19,044
Te lo ripeto ASP e PHP per me è arabo, devi seguire i corsi che trovi nei motori di ricerca, cerca la parola "GUIDA PHP" oppure i forum dove trattano la programmazione PHP.

alfonso_aiutamici@hotmail.it

Utenti presenti in questo topic
Guest


Salta al Forum
Aggiunta nuovi Topic disabilitata in questo forum.
Risposte disabilitate in questo forum.
Eliminazione tuoi Post disabilitata in questo forum.
Modifica dei tuoi post disabilitata in questo forum.
Creazione Sondaggi disabilitata in questo forum.
Voto ai sondaggi disabilitato in questo forum.

Main Forum RSS : RSS

Aiutamici Theme
Powered by Yet Another Forum.net versione 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.