select - Update profile in php -


I have a question in PHP to update a person's profile, he needs your ID, did not get.

This is my code to login to members area. '; Session_start (); $ UserName = isset ($ _ POST ["username"])? $ _POST ["user-name"]: ''; $ UserPass = isset ($ _ POST ["user-pass"])? $ _POST ["user-pass"]: ''; If ($ user name! = '0' & amp; user userpass! = '0') {$ criptSen = hash ("Whirlpool", $ userPass); $ Sq = "Select Euseiro, SENYA, rank with users where the user = '$ username' and 'shen =' $ crriptsen '"; $ Query = mysql_query ($ SQL); If (mysql_num_rows ($ query)> 0) {$ row = mysql_fetch_array ($ query); $ _SESSION ['Usuario'] = $ line ['Usuario']; $ _SESSION ['rank'] = $ line ['rank']; Mysql_free_result ($ query); If ($ line ['rank'] == 'ambrows') {header ("location: index_mmff.pp"); } And {if ($ line ['rank'] == 'administrator') {header ("location: admin / index_legard.fp"); }}} Else {if (isset ($ query)} {mysql_free_result ($ query); } Header ("location: index.php? Page = erro"); }} And {header ("location: index.php? Page = erro"); }? & Gt;

Now, this code verifies that the user is logged on to the website when logged in.

  & lt ;? Php $ Usuario = ($ _SESSION ["Usuario"])? $ _SESSION ["Usuario"]: ''; $ Rank = ($ _SESSION ['rank'])? $ _SESSION ['Rank']: ''; If ($ USURI! = '' & Amp; amp; amp; rank == 'ambro') {} else {header ("location: index.php"); Echo "& lt; scripts> alerts (\" area's restrita \ "); "; }? & Gt;   

Now, this is a query on my profile file, but I have not found the user ID. Can you help me get the ID?

  & lt ;? Php $ result = mysql_query ("Choose ID from id = '$ id'") or die (mysql_error ()); While ($ line = mysql_fetch_array ($ result)) {$ id = $ line ["id"]; $ Nom = $ line ["Nom"]; $ Imagem = $ row ["imgPerfil"]; $ Email = $ line ["email"]; $ Usurio = $ line ["Usuario"]; }? & Gt; When registering users, you should ensure that the user names are unique I  

just run a query on the username and check their ID.

Besides, this is a security risk to create your own register / login system. I suggest that you use a built-in ready one and customize some things for your needs. Are you writing mysql_real_escape_string username and password?

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -