Jump to content
Killersites Community
jibicho

Register Page Error

Recommended Posts

I get this kind of error on trying to follow the tutorial on php login.PHP Strict Standards:  Only variables should be passed by reference in /home/cifakeny/public_html/new/login.php on line 46

line 46 of login.php reads as follows,

 

$stmt->bind_param("ss", $input['user'], md5($input['pass'] . $config['salt']));

 

my register.php page is clumsy and not showing the scroll values.

 

 

 

 

 

Share this post


Link to post
Share on other sites

Which tutorial are you following? (I have two: a procedural login, and an OOP/MVC style login). Can you provide the line above/below line 46 as well, just so I know the context of the issue?

Share this post


Link to post
Share on other sites

i am following procedural login(only with views and includes). lines below and above 46 are as follows.

 

 

else
    {
        // get and clean data from form
        $input['user'] = htmlentities($_POST['username'], ENT_QUOTES);
        $input['pass'] = htmlentities($_POST['password'], ENT_QUOTES);
        
        // create query
        if ($stmt = $mysqli->prepare("SELECT members.id, permissions.name FROM members, permissions WHERE username=? AND password = ? AND members.type = permissions.id"))
        {
            $stmt->bind_param("ss", $input['user'], md5($input['pass'] . $config['salt']));
            $stmt->execute();
            $stmt->bind_result($id, $type);
            $stmt->fetch();
            
            // check if there is a match in the database for the user/password combination
            if ($id)
            {
                // close statement
                $stmt->close();
                
                // set session variable
                $_SESSION['id'] = $id;
                $_SESSION['type'] = $type;
                $_SESSION['username'] = $input['user'];
                $_SESSION['last_active'] = time();
                
                // redirect to member's page
                header("Location: members.php");
            }

Share this post


Link to post
Share on other sites

The first thing you might try: splitting that line into two lines:

$password = md5($input['pass'] . $config['salt']);
$stmt->bind_param("ss", $input['user'], $password);

Share this post


Link to post
Share on other sites

Thanks for swift correspondence and support as well. the next issues are:

- The disarranged register.php page with selection content display as single line in the box i.e. selectoptionadminmember and invisible password label.

- The password reset link sent fails on click and shows the error:

The requested URL /reset_password.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

 

kindly help me solve these.

Share this post


Link to post
Share on other sites

I have managed to solve the second email link related error after editing my config.php page but unfortunately i couldnt solve the first one that follows:

 

- The disarranged register.php page with selection content display as single line in the box i.e. selectoptionadminmember and invisible password label.

 

The distortion is hindering me from registering a member.

 

thanks for the help so far.

Share this post


Link to post
Share on other sites

Can you post the register.php file? Are you sure you aren't missing a quote, or that there isn't another error in your code? (a missing closing tag on an HTML element, for example?

Share this post


Link to post
Share on other sites

I have managed and reads 'member added successfully' but still gets disarranged after adding the member successfully i.e. the member is added but in case I made a mistake in feeling the form i cant pick from there, I mean I  have to refresh or click back the browser.

 

I have attached both v_register.php and register.php file.

 

thanks for the guide so far.

register.php

v_register.php

Edited by jibicho

Share this post


Link to post
Share on other sites

I've looked over the files, but as far as I can tell, they seem fine. Can you explain in more detail what the issues is? I'm not sure what you mean by "gets disarranged". What are you doing, what are you expecting, and how is the system not working the way you are expecting? Are you getting any specific error messages?

Share this post


Link to post
Share on other sites

kindly use the following details since i cant find the exact words to illustrate the behaviours.

link: http://www.cifakenya.co.ke/new/login.php

 

then use

 

username: admin

password: head

 

try to register a member then submit and watch out the behaviours and you will notice my concerns. for me page i get after registering a member is not fit to allow further registration. i hope you understand me better now. thanks for your response.

Share this post


Link to post
Share on other sites

OK, got it. On line 65 in register.php, add the missing ">" at the end of the line, so the </option> tag completely closes, like this:

$select = '<option value="">Select an option</option>';

Do the same thing on line 73:

$select .= ">" . $name . "</option>";

Share this post


Link to post
Share on other sites

Really works well. Many thanks admin. Your support is amazing. You restored my hope to explore and love working with php.

 

I am looking forward to learn oop on php and of course I have no fear to confront errors this time round since your instant troubleshooting is there for all.

 

am also looking forward for a convenient hosting plan for you which i need your advice on that.

 

 

Share this post


Link to post
Share on other sites

Everyone tends to have their own opinion about hosting. I've had good experiences with HostGator -- never really had a problem with down time, and their support has been helpful when I've ever needed it. Their basic plans run in the $5-$10 per month range. Stay away from GoDaddy for hosting. They are cheap, but you get what you pay for. 

Share this post


Link to post
Share on other sites

Thanks for your hosting plan advice. I would also like to inquire on how to integrate a forum on existing site. Also, if its possible to have a page where the admin can log in and post a job so that when public visit the site on the other end they can apply for jobs and upload their credentials. I would really appreciate if i can get a code which can do such kind of work for me. thank you in advance.

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


×