Jump to content

How Do I Make MY Require Form Detail Come Back Instantly And Ready For Next User


Dicee

Recommended Posts

Hello, How do I make my require('reg_form_detail.php'); re-appear immediately and ready for next User login after logging out and shutting down the browser?I am still kinda new to php coding. Is there another way that I can write this code to make it work. Please take a look at my code below and if possiblegive me a real code-sample and/or add it into my code or show a new way. The FORM works but doesn't come back fast enough and ready for next visitor! Please Advise I would be most thankful! DiceeEmail:Kirkpatrick.rich7@gmail.com p.s. Please insert real changes to my code: <?php //Ric Kir (script for pop up )//if($_SERVER['REMOTE_ADDR']=='115.240.51.183'){if(!isset($_COOKIE['user_id']) &&($_COOKIE['user_id']<1)){ require('reg_form_detail.php'); }//} ?>

Link to comment
Share on other sites

The registration form will pops-up and the User logs in or register. After the browser close the form is not there.However it will eventually come back, after waiting 30 minutes to an hour. I need for it to be ready instantly for thenext visitor so he can login. I think this is achievable, please help me resolve this problem.Again Many Thanks

Link to comment
Share on other sites

it will be hard to say anything without seeing the code because it is your code set up to do like that. it seems like you are using cookie to determine user login authentication. you should use session instead.

Link to comment
Share on other sites

Hello Thanks for your message re: Pop-up Form Being Ready/there For Next User To Login...Could you show me how you would write that? I think I tried using session before. Here is my code: <?php //Ric Kir (script for pop up )//if($_SERVER['REMOTE_ADDR']=='115.240.51.183'){if(!isset($_COOKIE['user_id']) &&($_COOKIE['user_id']<1)){ require('reg_form_detail.php'); }//} ?>

Edited by Dicee
Link to comment
Share on other sites

it will be hard to say anything without seeing the code because it is your code set up to do like that. it seems like you are using cookie to determine user login authentication. you should use session instead.
Hello Birbal,Thanks for your message.could you show me how you would write that? I think I tried using session before.Here is my code:< ?php//Ric Kir (script for pop up )//if($_SERVER['REMOTE_ADDR']=='115.240.51.183'){if(!isset($_COOKIE['user_id']) &&($_COOKIE['user_id']<1)){require('reg_form_detail.php');}//}?>
Link to comment
Share on other sites

Or you could just use a $_SESSION instead of a $_COOKIE. When you delete a session (logout) there is no delay in showing that nothing is set. With a cookie there are sometimes lingering bits that cause a browser to still think it is set. Do you know how to use $_SESSION? I really feel that is your problem. I use $_SESSION for my login features and whenever a user logs out the log in is IMMEDIATELY ready for the next user on said computer.

Edited by Krewe
Link to comment
Share on other sites

Or you could just use a $_SESSION instead of a $_COOKIE. When you delete a session (logout) there is no delay in showing that nothing is set. With a cookie there are sometimes lingering bits that cause a browser to still think it is set. Do you know how to use $_SESSION? I really feel that is your problem. I use $_SESSION for my login features and whenever a user logs out the log in is IMMEDIATELY ready for the next user on said computer.
Hello Krewe,I appreicate your reply! I think I have an idea "how to use SESSION?" However can you give me a real sample using my code and/or creating simular code?Heres my code:< ?php//Ric Kir (script for pop up )//if($_SERVER['REMOTE_ADDR']=='115.240.51.183'){if(!isset($_COOKIE['user_id']) &&($_COOKIE['user_id']<1)){require('reg_form_detail.php');}//}?>
Link to comment
Share on other sites

So you're only showing that if the cookie is not set. If the cookie is set then you don't show it. So if you want to always show it then remove the if statement.
Hello justsomeguy,Thanks for your very helpful remarks!Could you do me a favor and show me how you would go about removing the if statement based on my code below:I tried removing the if statement and the site come up blank? Perhaps I moving it the wrong way? Give me a real example via my code below: < ?php//Ric Kir (script for pop up )//if($_SERVER['REMOTE_ADDR']=='115.240.51.183'){if(!isset($_COOKIE['user_id']) &&($_COOKIE['user_id']<1)){require('reg_form_detail.php');}//}?>
Link to comment
Share on other sites

<?php require('reg_form_detail.php'); ?>

There you go, no if statement.

Ok, you're right... but when I remove the if statement the Form come back immediately. However, it keeps popping up within seconds and will not redirect to home pageafter login? Removing the if statement resolved one issue, but created another one. Please advise!
Link to comment
Share on other sites

I'm not quite sure what you're asking for. You said you wanted it to show immediately, and it is. If you only want to show it in a certain situation then you'll need to check for that. If you want to show it when the user is not logged in, for example, then you'll need an if statement to check if the user is not logged in.

Link to comment
Share on other sites

if you want it to show it with delay you will need to use JS. php cant control anything clientside, like delaying display. you can set "display:none" to the form style. and in clients side you can set up function which will be run after some time. the function will change the form style to display:block http://w3schools.com/js/js_timing.asp

Link to comment
Share on other sites

I'm not quite sure what you're asking for. You said you wanted it to show immediately, and it is. If you only want to show it in a certain situation then you'll need to check for that. If you want to show it when the user is not logged in, for example, then you'll need an if statement to check if the user is not logged in.
OK... I want the Form to show or popup every time a User visit the site either to register or login? The way it is now without the if statement the Users are unable to login or register. When I fill out the Form and click submit it disappears and come right back after a couple of seconds never moving to the front page. Using the if statementworks but when I sign out and try to log back into site the Form doesn't pop up? I then have to wait at least 30- 40 minutes before it resets? Is theres something that Ican add or remove from the code to make that work, or perhaps revise the if statement? ManyThanks! Please Advise.
Link to comment
Share on other sites

if you want it to show it with delay you will need to use JS. php cant control anything clientside, like delaying display. you can set "display:none" to the form style. and in clients side you can set up function which will be run after some time. the function will change the form style to display:block http://w3schools.com/js/js_timing.asp
Can you give me a real example on the use of JS php with use of my code? Heres my code: < ?php//Ric Kir (script for pop up )//if($_SERVER['REMOTE_ADDR']=='115.240.51.183'){if(!isset($_COOKIE['user_id']) &&($_COOKIE['user_id']<1)){require('reg_form_detail.php');}//}?>
Link to comment
Share on other sites

OK... I want the Form to show or popup every time a User visit the site either to register or login?
Isn't it showing up every time now?
The way it is now without the if statement the Users are unable to login or register.
Why? Isn't this the login/registration form? It's probably best to link to an example of this online. The if statement you keep showing only checks if a cookie is set or not. It will never show the form if the cookie is set. It sounds like you're not deleting the cookie properly if that's the issue. You haven't showed the log out code, or the log in code for that matter. It's hard for me to visualize what exactly is happening and what you want to happen without seeing it.
Link to comment
Share on other sites

Isn't it showing up every time now? Why? Isn't this the login/registration form? It's probably best to link to an example of this online. The if statement you keep showing only checks if a cookie is set or not. It will never show the form if the cookie is set. It sounds like you're not deleting the cookie properly if that's the issue. You haven't showed the log out code, or the log in code for that matter. It's hard for me to visualize what exactly is happening and what you want to happen without seeing it.
Hello Guy, Heres my login code for your perusal: Thanks! www.yimusiconeuniverse.com USER LOGIN PHP <?phprequire("wp-login_files/application_top.php");//general class$general = new general_class();$art_form = $general->fun_art_form();//print_r($_POST);if(isset($_POST['wp-submit'])){if(empty($_POST['log'])){ $error[]='<strong>ERROR</strong>: Please enter user name.';} if(empty($_POST['pwd'])){ $error[]='<strong>ERROR</strong>: Please enter password .';} if(empty($error)){ $check_query = mysql_query("SELECT * FROM user_registration WHERE user_name='".$_POST['log']."' AND password='".$_POST['pwd']."'"); if(mysql_num_rows($check_query)==0){ $error[]='<strong>ERROR</strong>: Please check login detail.';}else{$_SESSION['user_name'] = $_POST['log']; header('Location:http://yimusiconeuniverse.com');}} } ?>
Link to comment
Share on other sites

If you're using the session to log in, why are you checking for a cookie when you display the form? Where does that cookie get set? Where is it supposed to get deleted?
I guess that doesn't make much sense? I only want to use cookie in lieu of session. I think that is the missing piece of code the Setting and Deletion of cookie. However,I'm just not knowledgeable enough at his time in order to fix that problem? This is still somewhat new to me. Thanks!
Link to comment
Share on other sites

Well, if you want to use cookies then you can use the setcookie function to both create and delete a cookie: http://www.php.net/m...n.setcookie.php
Hello guy, thanks for all your help! This is what I came up with...but still have probleems. View New Code below and tell me what I'm doing wrong?It works and I even reduced the time to: a 10-seconds long cookie. However, still have to wait some time before Regisstration Form pops back up? <?php if(@$_COOKIE['user_id'] != true) { // If the cookie "user_id" is not set to truesetcookie('user_id', true, time() + 10); // Sets a 10-seconds long cookie called "user_id" to equal true.setcookie('user_id', true); // Sets a session-duration cookie called "user_id" to equal true; require('reg_form_detail.php'); // require your form detail page}//} ?> Edited by Dicee
Link to comment
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
×
×
  • Create New...