- Home
- Categorie
- Coding e Sistemistica
- Coding
- Contaclick - gestire i miei utenti con login
- 
							
							
							
							
							
Contaclick - gestire i miei utenti con loginCiao a tutti, 
 spero che mi possiate trovare una soluzione, visto che è da due settimane che ci sto sbattendo la testa.
 Allora, cominciamo:
 Sto provando a fare un contaclick con database dove a ciascun utente loggato nella mia pagina ha dei link o pulsanti dove cliccare.Ogni click aumenta di +1 sul database.
 Potrete capire meglio se andate su
 .giorgiotave.it/forum/php-mysql/25925-facciamo-sul-serio-gestire-i-miei-utenti.htmlHo seguito questa discussione, ho risolto il problema che ha riscontrato "fre2004" ma mi è comparso un altro: 
 if(!$_GET['id'] || !is_numeric($_GET['id'])) {echo 'L'i deve essere numerico'; return 0;Sulla browser continua a dirmi che "L'i deve essere numerico" Non capisco il motivo, ho provato di tutto ma continuo a non capire.. Vi posto anche login.php..<?php include 'dbc.php'; $err = array(); foreach($_GET as $key => $value) { 
 $get[$key] = filter($value); //get variables are filtered.
 }if ($_POST['doLogin']=='Login') 
 {foreach($_POST as $key => $value) { 
 $data[$key] = filter($value); // post variables are filtered
 }$user_email = $data['usr_email']; 
 $pass = $data['pwd'];if (strpos($user_email,'@') === false) { 
 $user_cond = "user_name='$user_email'";
 } else {
 $user_cond = "user_email='$user_email'";} $result = mysql_query("SELECT id,pwd,full_name,approved,user_levelFROM users WHERE
 $user_cond
 ANDbanned= '0'
 ") or die (mysql_error());
 $num = mysql_num_rows($result);// Match row found with more than 1 results - the user is authenticated. 
 if ( $num > 0 ) {list($id,$pwd,$full_name,$approved,$user_level) = mysql_fetch_row($result); if(!$approved) { //$msg = urlencode("Account not activated. Please check your email for activation code"); $err[] = "Account not activated. Please check your email for activation code"; //header("Location: login.php?msg=$msg"); //exit(); } //check against salt if ($pwd === PwdHash($pass,substr($pwd,0,9))) { if(empty($err)){ // this sets session and logs user in session_start(); session_regenerate_id (true); //prevent against session fixation attacks. // this sets variables in the session $_SESSION['user_id']= $id; $_SESSION['user_name'] = $full_name; $_SESSION['user_level'] = $user_level; $_SESSION['HTTP_USER_AGENT'] = md5($_SERVER['HTTP_USER_AGENT']); //update the timestamp and key for cookie $stamp = time(); $ckey = GenKey(); mysql_query("update users set `ctime`='$stamp', `ckey` = '$ckey' where id='$id'") or die(mysql_error()); //set a cookie if(isset($_POST['remember'])){ setcookie("user_id", $_SESSION['user_id'], time()+60*60*24*COOKIE_TIME_OUT, "/"); setcookie("user_key", sha1($ckey), time()+60*60*24*COOKIE_TIME_OUT, "/"); setcookie("user_name",$_SESSION['user_name'], time()+60*60*24*COOKIE_TIME_OUT, "/"); } header("Location: myaccount.php"); } } else { //$msg = urlencode("Invalid Login. Please try again with correct user email and password. "); $err[] = "Invalid Login. Please try again with correct user email and password."; //header("Location: login.php?msg=$msg"); } } else { $err[] = "Error - Invalid login. No such user exists"; }} ?> Vi prego, per un neofita come me essere arrivato fin qui con le proprie mani è stato un miracolo. 
 Spero di trovare una soluzione.
 Grazie a tutti in anticipo!
 Ciao!
 
- 
							
							
							
							
							
Sono di nuovo io 
 Qualcuno riuscirebbe a sistemarmelo?
 Sono anche disposto ad offrire una ricompensa $$$ a chi riesce a sistemarlo, credo che sia il minimo per il vostro aiuto.A ciascuno il suo, insomma
 Grazie ragazzi!