Send an alert to another php script

Discussion in 'PHP' started by alimoses, Aug 15, 2011.

  1. #1
    I have a script teller.php, when an unauthorize operation is performed in teller.php
    I want an alert to pop up in another page i.e account.php about the unauthorized operation is performed.
     
    alimoses, Aug 15, 2011 IP
  2. programmer_best1

    programmer_best1 Well-Known Member

    Messages:
    282
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    133
    #2
    use header("location: account.php?alert=something");
     
    programmer_best1, Aug 15, 2011 IP
  3. sarahk

    sarahk iTamer Staff

    Messages:
    28,899
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #3
    Is the illegal operation being detected on the page or during server processing?

    If its on the page you need to have some javascript to detect it (or ajax to check against backend rules) and then give the "alert".

    If its backend processing then you just need to generate the correct html/javascript to warn the user.
     
    sarahk, Aug 15, 2011 IP
  4. alimoses

    alimoses Member

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #4
    This is the scenerio.
    if the cashier try to post the amount that is more than the limit set, then the system should alert the system admin automatically. that is a pop-up alert or flash.
     
    alimoses, Aug 17, 2011 IP
  5. The Webby

    The Webby Peon

    Messages:
    1,852
    Likes Received:
    30
    Best Answers:
    1
    Trophy Points:
    0
    #5
    Save the alert in a Database from teller.php. Then poll the database for new alerts from account.php

    Either this, or make a socket server based application for realtime data update
     
    The Webby, Aug 17, 2011 IP
  6. freelanceinphp

    freelanceinphp Member

    Messages:
    134
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    48
    #6
    I understand the scenario but what is a php code problem you have?
     
    freelanceinphp, Aug 18, 2011 IP
  7. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #7
    PHP doesn't work that way, popping up on some user's desktop. The user calls the PHP file (by going to its address) and the PHP file does what it was written to do. The user has to start the action, the page can't.

    What you want is teller.php to send an email or a chat program announcement or something else that can pop up on a user's desktop. Decide what you want to do, and someone can point you to code to do it or write some code for you. (Emailing is trivial - see the manual for the mail() function.)
     
    Rukbat, Aug 22, 2011 IP
  8. kanikakaminial

    kanikakaminial Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    you can use Javascript alert function on click..
     
    kanikakaminial, Aug 25, 2011 IP
  9. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #9
    kanikakaminial, read the post. Person A enters something wrong and he wants person B's computer to pop up a notice.
     
    Rukbat, Aug 25, 2011 IP
  10. sarahk

    sarahk iTamer Staff

    Messages:
    28,899
    Likes Received:
    4,555
    Best Answers:
    123
    Trophy Points:
    665
    #10
    System Admins tend to be two screen type of people so it's entirely realistic for them to have a browser open purely for system monitoring. That dedicated browser has a page similar to this site's spy that polls and shows new alerts that need to be managed. Each new item that polls could come with a sound file that plays once to attract the system admins attention.

    All very doable as suggested by The Webby and Rukbat.

    I guess we need the OP to come back and tell us if more advice is needed.
     
    sarahk, Aug 25, 2011 IP