![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Web Design & Programming Discussion of web design, and server-side & client-side scripting |
![]() |
|
|
Thread Tools |
|
|
#1 (permalink) |
|
Registered User
|
Hello, I'm Working On A Project With My Own Server I Built A Few Days Ago And This Is My Code:
----regstp1.html---- __________________ ----START---- <title>TBCH Registration Step 1 - Query</title> <center> <form action="regstp2.php" method="post"> Username: <input type="text" name="user" maxlength="10" size="10" /> </br> </br> Password: <input type="password" name="pass" maxlength="10" size="10" /> </br> </br> <input type="submit" value="Submit" /> </form> </center> ----END--- ----regstp2.php---- __________________ ----START---- <?php $user = $_POST['user']; $pass = $_POST['pass']; $epass = hash("sha256", $pass); mysql_connect("localhost", "root", "Not_Giving_It_Out") or die(mysql_error()); mysql_select_db("mysql") or die(mysql_error()); mysql_query("INSERT INTO members (username, password) VALUES('$user', '$epass' ) ") or die(mysql_error()); ?> ----END--- I'm Wanting To Make It Check & Prevent Registration If That Current User Exists. Any Suggestions? ![]() Last edited by XP On CD : 06-07-2008 at 06:27 PM. |
|
|
|
|
|
#2 (permalink) |
|
Design Team Member
|
Re: PHP 5.2.6 & MySQL 5.0 Help
Before you enter the new username, just make another query that checks if they exist.
PHP Code:
Also, take note that I initialized a variable for the query. You should always do this for your queries AND connection strings (so you can kill the connection when you're through with it - good practice). Hope this helps :)
__________________
Free Resources PC Protection - Comodo Firewall | AVG Anti-Virus | WinPatrol | Ad-Aware | Spybot S&D | SpywareBlaster |Web Design/Programming - KompoZer (Editor) | Paint.NET (Graphic) | GIMP+GIMPShop (Graphic) | FileZilla (FTP Client) | Free Hosting | |
|
|
|
![]() |
| Thread Tools | |
|
|