Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Register

registration registering

  • Please log in to reply
4 replies to this topic

#1 Nik22

Nik22

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 27 June 2012 - 02:44 PM

Please help me!

Make reģister/login user db table


<?
include('../data/config.php');
if(empty($_POST['username'])){echo"<span style='color:red;'>Enter Username</span><br /><br />";die();}
if(strlen($_POST['username']) < 4){echo"<span style='color:red;'>Usernames is short</span><br /><br />";die();}
if(strlen($_POST['username']) > 16){echo"<span style='color:red;'>Usernames is too long</span><br /><br />";die();}
$x = mysql_num_rows(mysql_query("SELECT id FROM users WHERE username=".quote_smart($_POST['username']).""));
if($x > 0){echo"<span style='color:red;'> username is already taken /span><br /><br />";die();}
if(empty($_POST['password'])){echo"<span style='color:red;'>Enter password</span><br /><br />";die();}
if(strlen($_POST['password']) < 4){echo"<span style='color:red;'>Password is short</span><br /><br />";die();}
if(strlen($_POST['password']) > 16){echo"<span style='color:red;'>Password is too long/span><br /><br />";die();}
if(empty($_POST['password2'])){echo"<span style='color:red;'>e-entered password</span><br /><br />";die();}
if($_POST['password2'] != $_POST['password']){echo"<span style='color:red;'>passwords do not match</span><br /><br />";die();}
if(empty($_POST['email'])){echo"<span style='color:red;'>Enter email/span><br /><br />";die();}
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $_POST['email'])){echo"<span style='color:red;'>E-mail is not correct</span><br /><br />";die();}
$x = mysql_num_rows(mysql_query("SELECT id FROM users WHERE email=".quote_smart($_POST['email']).""));
if($x > 0){echo"<span style='color:red;'> E-mail is already in use</span><br /><br />";die();}
if(empty($_POST['country'])){echo"<span style='color:red;'>State to choose</span><br /><br />";die();}
mysql_query("INSERT INTO users (username, password, email, country, status) VALUES (".quote_smart($_POST['username']).", ".quote_smart(md5($_POST['password'])).", ".quote_smart($_POST['email']).", ".quote_smart($_POST['country']).", 'user')");
?>
<span style='color:yellowgreen;'>Registration completed</span><br />Log in

  • 0

#2 tavich

tavich

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 399 posts
  • Location:Delaware
  • Programming Language:C#
  • Learning:C++, PHP, JavaScript

Posted 27 June 2012 - 04:57 PM

Are you getting an error?
  • 0
Send a like my way if I helped you or if you found my post useful or even just enjoyed reading my post.
Thank you :)

#3 papabear

papabear

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 472 posts
  • Location:DarkSide

Posted 28 June 2012 - 05:18 AM

Please check this tutorials on a way on how to create what you need

Creating Login/Registration forms with php


Creating A Simple Yet Secured Login/registration With Php5


Happy Coding
  • 0
Life has no CTRL+Z
Never Forget To HIT "LIKE" If I Helped

#4 Nik22

Nik22

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 29 June 2012 - 07:37 AM

Why help me?
  • 0

#5 Orjan

Orjan

    CC Mentor

  • Moderator
  • 2918 posts
  • Location:Karlstad, Sweden
  • Programming Language:C, Java, C++, C#, PHP, JavaScript, Pascal
  • Learning:Java, C#

Posted 05 July 2012 - 01:26 PM

what is it you want help with?
  • 0

I'm a System developer at XLENT Consultant Group mainly working with SugarCRM.
Please DO NOT send mail or PM to me with programming questions, post them in the appropriate forum instead, where I and others can answer you.






Also tagged with one or more of these keywords: registration, registering

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download