Jump to content
xisto Community
Sign in to follow this  

Need Feedback On A Function

Recommended Posts

I'm working hard on a fully self-coded community (after tons of errors you get depressed i know...but i need to see what i can), so i need some feedback on a Function i made (wich is basically reguser.php), here it is:


Function regresult($uname, $pword, $cword, $rname, $country, $day, $month, $year, $gender, $email, $email2){Global $db;$datab="Users";if(empty($uname or $pword or $rname or $country or $day or $month or $year or $gender or $email)){exit("Please fill in every field."); }if($pword=!$cword){exit("Your passwords do not match."); }if($email=!$email2){exit("Your emails do not match."); }print "Have you inserted the correct information?<br>";print "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"white\" width=\"400\" height=\"500\" align=\"center\" valign=\"top\">";print "<tr><td align=\"left\">$uname<br>$pword<br>$rname<br>$country<br>$day-$month-$year<br>$gender<br>$email<br>";print "<center><a href=\"home.php?module=regresult&answer=yes\">Yes</a> | <a href=\"home.php?module=regresult&answer=no\">No</a></td></tr></table>";if($answer==yes){$regtime=date();$regqry=mysql_query("INSERT INTO Users (username,password,real_name,country,day,month,year,gender,email,registration) VALUES('$uname','$pword','$rname','$country','$day','$month','$year','$gender','$email','$regtime')") or die("Problem occured when accessing database")";$db->Execute($regqry); }if($answer==no){print "<script language=\"javascript\">history.back()</script>";}}

I need to know if there's a problem with this script, any potential errors, maybe potential bugs..the security such as hashing and stripping will be inserted once this script is...approved...:P )


Thanks in advance..



P.S. My god, the

 tagging is depressing in this forum version...bit tougher to read..

Share this post

Link to post
Share on other sites

// [...]if($answer==yes){    // [...]}if($answer==no){    // [...]}// [...]


When comparing strings you should encapsulate them with single or double quotes, in this situation I would recommend single-quotes, as in:

// [...]if($answer=='yes'){    // [...]}if($answer=='no'){    // [...]}// [...]

As far as the logic goes, well there are many different ways to do what you want, so yours may suite your needs.. And security? Well, I don't see much there, but you said you were gonna add that after so..


I hope that helps..

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.