SunQuest
           PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old July 17th, 2002, 08:11 PM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
pop-up window triggers

question..

is there any way to create a script that repeatidly checks itself to evaluate whether or not a particular variable is true or false, and when the variable is true it will then trigger a pop-up window to open?

i know you can do it onLoad, onUnload or onClick with js.. but i'm wanting to - for example, push a pop-up to someone elses screen on my command, assuming of course they're logged into my website.

any idea's?

Reply With Quote
  #2  
Old July 17th, 2002, 10:11 PM
riptide riptide is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 10 riptide User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to riptide
RE: pop-up window triggers

Wouldnt it work to have a field in the user table like popup tinyint. and if its one when he loads a page he get the popup nad if its zero he doesnt?

Not sure if it works or if its what you meen.

Reply With Quote
  #3  
Old July 17th, 2002, 10:34 PM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
RE: pop-up window triggers

that would work, but i don't want the user to have to load a page to trigger it.. i want it to work like this.

the user loads my site and logs in blah blah, but then he just sits there idle for a while. i want to be able to send them the popup without them doing anything other than being logged in.

i lookin for a way to dynamically check for the variable and shoot the popup as soon as the variable is true

does that make more sense?

Reply With Quote
  #4  
Old July 17th, 2002, 10:37 PM
riptide riptide is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 10 riptide User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to riptide
RE: pop-up window triggers

Make an autoupdate on the page or in a hidden frame.

Reply With Quote
  #5  
Old July 17th, 2002, 11:05 PM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
RE: pop-up window triggers

could you give me an example please? i'm not sure what you mean..

would the following code work? or would it just take forever to execute?

i just pulled it out of the air but should give a clear idea what i'm trying to do achieve either way
php Code:
Original - php Code
  1.  
  2. <script language="javascript">
  3. function trigger()
  4. {
  5.  
  6. <?php
  7.  
  8. function checkVar($var)
  9. {
  10.     if($var == FALSE)
  11.     {
  12.         checkVar($var);
  13.     }
  14.     else
  15.     {
  16.         // send popup
  17.     }
  18. }
  19. checkVar($value);
  20.  
  21. ?>
  22.  
  23. }
  24. </script>
  25.  
  26. <body onLoad="trigger()">

PS - im at work so i can't test this until i get home

Reply With Quote
  #6  
Old July 18th, 2002, 01:33 AM
EvilivE EvilivE is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Milwaukee, WI USA
Posts: 291 EvilivE User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to EvilivE
RE: pop-up window triggers

That makes sense, I would put a delay timer in there also.

Reply With Quote
  #7  
Old July 18th, 2002, 01:36 AM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
RE: pop-up window triggers

why put a delay?

Reply With Quote
  #8  
Old July 18th, 2002, 03:02 AM
EvilivE EvilivE is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Milwaukee, WI USA
Posts: 291 EvilivE User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to EvilivE
RE: pop-up window triggers

I sort of got ahead of myself. As I was reading what you wanted to do, I was thinking "what a great idea", you could use this like admins do when they are taking down a server or something. For example if there is a new post on this msg board while I am surfing this site, I would get a pop-up saying so. That, of course, would require a read to the database ... hence the timer. See what I am saying?

Reply With Quote
  #9  
Old July 18th, 2002, 03:21 AM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
RE: pop-up window triggers

er.. well i just tried my code and it goes into a very long execution time cause it won't push the page since it's still checking itself..

how can i get it to check itself say, every 2 seconds? without effecting load time?

Reply With Quote
  #10  
Old July 18th, 2002, 03:35 AM
nemesis nemesis is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Saint-Petersburg, Russia
Posts: 29 nemesis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: pop-up window triggers

Well, I'm still not quite sure what you wnat to archieve, but AFAI understood the best way to do it is to use a hidden frame.
Somewhere on your page you create a hidden frame pointing to a 'special' page whose only task is to check for the variable value and if it evaluates to true then issue the <script>...</script> with the popup code, otherwisa it should only print the refresh header.
Therefore, IMHO it should look sth like this:
The main page code
Code:
<html>
......
<iframe height="0" width="0" src="popup_check.php">
......
</html>

The "popup_check.php" code:
Code:
<?php

//printing the refresh info (alternatively
//you can just send a refresh header with header()
echo '<meta http-equiv="Refresh" content="5, popup_check.php">';

if (evaluate_var()) {
  echo '<script type="text/javascript">alert ("The variable evaluated to TRUE!");</script>';
}

?>


I think that this kind of approach will solve the problem.

PS I haven't tested the code supplied, 'cause the only purpose of it is to give the basic idea. Thanks for your attention.

Reply With Quote
  #11  
Old July 18th, 2002, 03:42 AM
EvilivE EvilivE is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Milwaukee, WI USA
Posts: 291 EvilivE User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via Yahoo to EvilivE
RE: pop-up window triggers

Here is a perfect example using javascript http://lonestar.texas.net/~rgrafe/P....htm#delaytimer

Reply With Quote
  #12  
Old July 18th, 2002, 04:28 AM
Taoism Taoism is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Winnipeg, MB, Canada
Posts: 81 Taoism User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 30 sec
Reputation Power: 2
RE: RE: pop-up window triggers


Quote:
er.. well i just tried my code and it goes into a very long execution time cause it won't push the page since it's still checking itself..

how can i get it to check itself say, every 2 seconds? without effecting load time?


php Code:
Original - php Code
  1.  
  2. <?php
  3. <script language="javascript">
  4. function trigger(){
  5. <?php
  6. function checkVar($var){
  7.     if($var==FALSE){checkVar($var);}
  8.     else{/* send popup */}
  9. }
  10. checkVar($value);
  11. ?>
  12. }
  13. </script>
  14. <body onLoad="trigger()">
  15. ?>


You code should go into a very long loop....it is recursively calling itself with no check to get back out

Not to mention that PHP is sever side and basically stateless. You can't use php to force something to a browser if the browser doesn't already have a request at the server.

So in your outlined idea...

1) user logs attempts to log in...
2) using php you process the log in and send a result page
^^^ That's it... at point number 2 the php script would effectively be done and would no longer be sending data back to the client.

You need something that isn't server-side to accomplish what you want...Javascript, Java Applet, etc. And even then, Javascript would be client side. The applet could keep a 'live' connection happening though...

Cheers,
Keith.

Reply With Quote
  #13  
Old July 18th, 2002, 06:10 AM
nemesis nemesis is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Saint-Petersburg, Russia
Posts: 29 nemesis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: pop-up window triggers


Quote:
Here is a perfect example using javascript http://lonestar.texas.net/~rgrafe/P....htm#delaytimer


I think it's not exactly what is needed to solve the problem. Notepad wanted to check for the variable value during all the time a user is logged in, while the above example performs a one-time check after a certain amount of time.

Reply With Quote
  #14  
Old July 18th, 2002, 08:33 AM
notepad notepad is offline
Codewalkers Loyal (3000 - 3499 posts)
 
Join Date: Apr 2007
Location: Central, IL USA
Posts: 3,214 notepad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to notepad
RE: pop-up window triggers

hmm a lot of interesting feedback i appreciate it..

the hidden frame sounds like the best solution although i was prefering it to remain completeley hidden - and the refresh of the frame would appear in the status bar. also, i don't want it to check every so many seconds, i want it to constantly check without delay

i've got a lot more angles to look at this from because of all your comments i'll let you know how i end up.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > pop-up window triggers