Page 1 of 1

function related help required

Posted: Tue Aug 25, 2009 9:45 pm
by gimpact
Hello

This looks simple to me but I dont know how to go about it, so any help will be appreciated.

I have a form which when submitted sends firstname,lastname,email and other details to signup.php . Now to make my codes more secure, i have dont this;

signup.php would accept the values of the user input and send the value to a php class file located at secure location like this

http://www.z.com/account/index.html // not secure
http://www.z.com/account/[b]signup.php[/b] // secure
http://www.z.com/account/[b]secure/SignupClass.php[/b] // secure

the SignupClass.php has datbase access codes and other secure stuff. Now the problem is when I use this code in signup.php

Code: Select all

include ("secure/SignupClass.php");
        $signupclass = new SignupClass();
        $signupclass ->signupClass($first_name, $last_name, $email, $password);
It is giving me this error:

Code: Select all

Warning: Missing argument 1 for signupclass()
What I think is after i retrieve the value using this

Code: Select all

$first_name = $_REQUEST['first_name'];
    $last_name = $_REQUEST['last_name'];
    $email1 = $_REQUEST['email1'];
    $email2 = $_REQUEST['email2'];
    $password1 = $_REQUEST['password1'];
    $password2 = $_REQUEST['password2'];
I need to convert or truncate the data of $first_name to string or some thing else.

Please tell me how to go about this.
Thank you,

Re: function related help required

Posted: Tue Aug 25, 2009 11:32 pm
by gimpact
okie, I added a "public" before the function and it stopped giving the old error for the new error

Code: Select all

class SignupClass {
 
    public function signupClass($first_name,$last_name,$email,$password){
        // Open database connection
        include ("DBConnect.php");
        //Check if the user already exist
        $getEmail = "SELECT * FROM account WHERE email = '$email'";
        $getEmail2=mysql_query($getEmail) or die("Could not query for user");
        $getEmail3=mysql_fetch_array($getEmail2);
        if((strlen($getEmail3[email])>0)){
here is the new error
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}'

I was wondering should i go for tycasting before sending the values to my php class file?

Thank you