Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Topics

Recent Status Updates

View All Updates

- - - - -

PHP code having some issue

php pdo mysql

This topic has been archived. This means that you cannot reply to this topic.
No replies to this topic

#1 dennypaul


    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 09 March 2019 - 12:37 AM

My code is working fine and inserting data to the database without any issue, except that the md5 password is getting inserted as the plain text. Echo ing out the md5 password is showing the hashed password. Please see the code below. I'm not able to find the issue.

	$email = $_POST['email'];
	$pass = $_POST['password'];
	$screenname = $_POST['screenName'];

	if(empty($email) || empty($pass) || empty($screenname)){
		$error.="Please fill all the fields";
		//Sanitize the data
		$email = $getFromUsers->checkVar($email);
		$pass = md5($getFromUsers->checkVar($pass));
		echo $pass;
		$screenname = $getFromUsers->checkVar($screenname);

		//Check if email format i correct
			$error.="Please provide valid email";
		}else if(strlen($screenname)>20 || strlen($screenname)<6){
			$error.="Screen Name should have 6-20 Charaters";
		}else if(strlen($pass)<5){
			$error.="Password too weak";
			//If all ok, then check if email is available
			}else $error.="Email not available";

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