Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Need Feedback On A Function
HmmZ
post Jun 19 2005, 09:38 PM
Post #1


Super Member
*********

Group: Members
Posts: 362
Joined: 2-March 05
From: The Netherlands
Member No.: 4,097



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:

CODE
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...wink.gif )

Thanks in advance..


[b]P.S. My god, the [code] tagging is depressing in this forum version...bit tougher to read..sad.gif
Go to the top of the page
 
+Quote Post
SystemWisdom
post Jun 20 2005, 02:29 AM
Post #2


Advanced Member
*******

Group: Members
Posts: 117
Joined: 3-May 05
From: A Canadian South of the 49th Parallel
Member No.: 6,544



QUOTE(HmmZ @ Jun 19 2005, 05:38 PM)
CODE

// [...]

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:
CODE

// [...]

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..
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. My Minimalist Wordpress Theme(7)
  2. Search Engine/ Function(0)
  3. Feedback On Webdesign ( Political Art Video Gallery )(6)
  4. Disabling Right Click Function(10)
  5. PHP Function To Add Previous and Next Page Feature(5)
  6. New Sig(2)
  7. Question Regarding Php Function(12)
  8. First Design Feedback(18)
  9. New Guy Here(0)
  10. Getting List Of Directories And Files Using Php(6)
  11. How To Use A Link To Call Function In Php?(8)
  12. Include File.php?id=something(13)
  13. Soccer Prediction Game Site(8)
  14. How Good Is This Data Cleaning Function?(2)
  15. Feedback On The Website -- Www.computerkindness.org(6)
  1. Genuine Help With Smtp And Php Mail() Function(3)
  2. Endif function?(6)
  3. Php - Forms, Date And Include(0)
  4. User Permission Function [php](3)
  5. How To Check If Fsockopen Function Is Enabled?(2)
  6. Feedback Needed Please On My Website(11)
  7. Www.liamssite.uni.cc, My Website(10)
  8. Add A Javascript Feedback Form On Your Web Page(6)
  9. Mail() Clone(5)
  10. Help: Disable All Buttons Inside A Div Element(8)
  11. Delphi(1)
  12. Inkscape, A Open Source Vector App That Support Lot Function.(0)
  13. Arrays Outside A Function(3)
  14. The Best Zip Function(1)
  15. Converting To Unix Timestamp(1)


 



- Lo-Fi Version Time is now: 22nd November 2008 - 06:03 PM