<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Contaclick - gestire i miei utenti con login]]></title><description><![CDATA[<p dir="auto">Ciao a tutti,<br />
spero che mi possiate trovare una soluzione, visto che è da due settimane che ci sto sbattendo la testa.<br />
Allora, cominciamo:<br />
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.<br />
Potrete capire meglio se andate su<br />
.giorgiotave.it/forum/php-mysql/25925-facciamo-sul-serio-gestire-i-miei-utenti.html</p>
<p dir="auto">Ho seguito questa discussione, ho risolto il problema che ha riscontrato "fre2004" ma mi è comparso un altro:<br />
if(!$_GET['id'] || !is_numeric($_GET['id'])) {echo 'L'i deve essere numerico'; return 0;</p>
<p dir="auto">Sulla browser continua a dirmi che "L'i deve essere numerico"</p>
<p dir="auto">Non capisco il motivo, ho provato di tutto ma continuo a non capire..</p>
<h2>Vi posto anche login.php..</h2>
<p dir="auto">&lt;?php</p>
<p dir="auto">include 'dbc.php';</p>
<p dir="auto">$err = array();</p>
<p dir="auto">foreach($_GET as $key =&gt; $value) {<br />
$get[$key] = filter($value); //get variables are filtered.<br />
}</p>
<p dir="auto">if ($_POST['doLogin']=='Login')<br />
{</p>
<p dir="auto">foreach($_POST as $key =&gt; $value) {<br />
$data[$key] = filter($value); // post variables are filtered<br />
}</p>
<p dir="auto">$user_email = $data['usr_email'];<br />
$pass = $data['pwd'];</p>
<p dir="auto">if (strpos($user_email,'@') === false) {<br />
$user_cond = "user_name='$user_email'";<br />
} else {<br />
$user_cond = "user_email='$user_email'";</p>
<p dir="auto">}</p>
<p dir="auto">$result = mysql_query("SELECT <code>id</code>,<code>pwd</code>,<code>full_name</code>,<code>approved</code>,<code>user_level</code> FROM users WHERE<br />
$user_cond<br />
AND <code>banned</code> = '0'<br />
") or die (mysql_error());<br />
$num = mysql_num_rows($result);</p>
<p dir="auto">// Match row found with more than 1 results  - the user is authenticated.<br />
if ( $num &gt; 0 ) {</p>
<pre><code>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";
  }		
</code></pre>
<p dir="auto">}</p>
<p dir="auto">?&gt;</p>
<p dir="auto">Vi prego, per un neofita come me essere arrivato fin qui con le proprie mani è stato un miracolo.<br />
Spero di trovare una soluzione.<br />
Grazie a tutti in anticipo!<br />
Ciao!</p>
]]></description><link>https://dev.connect.gt/topic/145441/contaclick-gestire-i-miei-utenti-con-login</link><generator>RSS for Node</generator><lastBuildDate>Sun, 29 Nov 2026 02:22:47 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/145441.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 12 Feb 2011 16:24:56 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Contaclick - gestire i miei utenti con login on Sun, 13 Feb 2011 03:11:26 GMT]]></title><description><![CDATA[<p dir="auto">Sono di nuovo io<br />
Qualcuno riuscirebbe a sistemarmelo?<br />
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<br />
Grazie ragazzi!</p>
]]></description><link>https://dev.connect.gt/post/974087</link><guid isPermaLink="true">https://dev.connect.gt/post/974087</guid><dc:creator><![CDATA[smanio87]]></dc:creator><pubDate>Sun, 13 Feb 2011 03:11:26 GMT</pubDate></item></channel></rss>