Code to turn off monitor

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mirainc
    New Member
    • Jul 2008
    • 34

    Code to turn off monitor

    Is there any code i can use in PHP or any language compatable with PHP to make the monitor turn off. you know just like it turns off automatically after its been on 15 mins (or whatever time the user sets it on)


    Thanks
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    You can't control a clients pc using PHP.

    The php script will only work on the server it is setup in.

    Comment

    • mirainc
      New Member
      • Jul 2008
      • 34

      #3
      Originally posted by markusn00b
      You can't control a clients pc using PHP.

      The php script will only work on the server it is setup in.
      Does that mean the PHP script will only work on the PC that has PHP configured? Or current PC..? if yes can i have the codes or maybe is there a javascript of vbscript tat i can use?

      Thanks

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by mirainc
        Does that mean the PHP script will only work on the PC that has PHP configured? Or current PC..? if yes can i have the codes or maybe is there a javascript of vbscript tat i can use?

        Thanks
        It means it will only run on the server.

        Comment

        • dlite922
          Recognized Expert Top Contributor
          • Dec 2007
          • 1586

          #5
          Originally posted by mirainc
          Does that mean the PHP script will only work on the PC that has PHP configured? Or current PC..? if yes can i have the codes or maybe is there a javascript of vbscript tat i can use?

          Thanks
          You cannot control the client's PC through the browser.

          Every code you write the browser reads and implements. The browser, a program, does not, should not, and will not alter anything on the PC.

          You must have the client download a program that you write and they must manually execute that file to make it work.

          How would you like it if my website erased your files, shut down your computer, and ejected your CD Rom drive without your control?

          Think about it for a second. It's just common sense. The internet wouldn't be the internet. .... it would be...mass-remote-access-network...or something.

          :)


          Dan

          Comment

          • mirainc
            New Member
            • Jul 2008
            • 34

            #6
            hmm.. ya i guess if wa websit could do that it would be bad.. My teacher is demanding too much i guess.. anyway thanks so much for all the help.. At least now i can tell my teacher why i cannot do it..

            Thanks guys! (:

            Comment

            • dlite922
              Recognized Expert Top Contributor
              • Dec 2007
              • 1586

              #7
              Originally posted by mirainc
              hmm.. ya i guess if wa websit could do that it would be bad.. My teacher is demanding too much i guess.. anyway thanks so much for all the help.. At least now i can tell my teacher why i cannot do it..

              Thanks guys! (:
              What kind of teacher do you have!!

              Comment

              • mirainc
                New Member
                • Jul 2008
                • 34

                #8
                haha.. ya he's weird.. He gave me this for my final year project...

                OH.. can i ask 1 more thing? :D

                is it possible to turn off the monitor on just the current PC? or PC in a network? Network as in the PCs connected by LAN. Coz my teacher wants a program that will shutdown, hibernate, shutdown hard disks and switch off monitors in the school network. But i really have no idea how to do that using PHP.. I'm new to PHP.. just learning it to do this project.. i managed to do a PC shutdown on my PC but i dunno how to do that on a LAN network..

                Anyone can offer some advise?

                Comment

                • mattas
                  New Member
                  • Sep 2008
                  • 2

                  #9
                  are you trying to use command prompt or like a batch file or what?


                  If you are using command prompt use the following for shutting down computers on a network

                  I'll guide you through step by step...

                  shutdown::
                  i l s r g a p h e m t c f d
                  ^^^^^^^^^^^thes e are the different commands

                  these are the different commands you can choose from

                  the text should read as follows below

                  shutdown -<something> <something> <something>
                  and so on and so forth

                  for example if you wanted to shutdown a computer named bhsschoolstore1 (my partner that I work with's machine) you would put the following

                  shutdown -m //bhsschoolstore1 -s -f -t 999999999


                  what that would do would give them a message saying their computer will shutdown in 999999999 seconds roughly 116 days or something...act ually i'm not really sure if that is seconds or milliseconds..s orry..

                  if you want an automatic shutdown put the following
                  shutdown -m //bhsschoolstore1 -s -f -t 0

                  what that does is shuts down forces all applications to stop running and sets a time limit of 0 milliseconds

                  if you do shutdown -m //bhsschoolstore1 -s -f -t 30 -c"bite me"

                  it would show a dialog box stating that it is about to shutdown in 30 seconds and displays the user who iniated it and the comment bite me
                  email me if you have questions about anything

                  <Email removed>


                  lol i think my coworker is mad now btw
                  Last edited by Atli; Sep 23 '08, 04:11 AM. Reason: Removed email.

                  Comment

                  • Atli
                    Recognized Expert Expert
                    • Nov 2006
                    • 5062

                    #10
                    Hi mattas.

                    Please do not post your email address in the public forums.
                    It is a violation of our Posting Guidlines, which we expect all members to follow while posting in these forums.

                    Thank you.
                    Moderator

                    Comment

                    • tharden3
                      Contributor
                      • Jul 2008
                      • 916

                      #11
                      Originally posted by dlite922
                      What kind of teacher do you have!!
                      yes, I don't think your teacher is very intelligent... why would he/she have you do this? I hope said teacher is not tampering with the school computers? ;)

                      Comment

                      • Kevinyy
                        New Member
                        • Jul 2008
                        • 77

                        #12
                        You cannot control physical aspects of computer hardware using php. and i dont think your teacher requested this of you.
                        Plus, if you are new to php your teacher surely wouldnt have anything remotely this "advanced".
                        Also, saying this as a final project would mean youve taken a full quarter/year/semester of the PHP course, you wouldnt be calling yourself "new" to php.

                        July31 isnt usually school time.

                        Comment

                        • Atli
                          Recognized Expert Expert
                          • Nov 2006
                          • 5062

                          #13
                          Originally posted by Kevinyy
                          You cannot control physical aspects of computer hardware using php. and i dont think your teacher requested this of you..
                          You could do it by executing shell commands from PHP, but I wouldn't really consider that PHP code either.

                          This does sound like an odd school project. Especially for a beginners class on PHP. They usually focus on web development, rather than OS specific stuff like this.

                          To be honest, this sounds more like the OP is trying to either hack into peoples computers via a website, or an attempt to bring down his schools computer system.
                          If either are true, know that no browser will allow the first option, and no decently set up LAN would allow for the second.

                          The method suggested by mattas requires that the target computer allows remote shutdowns, which it won't unless it has been configured to do so by an administrator.

                          Comment

                          • DaveRandom
                            New Member
                            • Apr 2009
                            • 3

                            #14
                            Hi All

                            The important thing to note here is that PHP is a server-side language, so commands that affect the system are executed on the server, not the client.

                            Anything you want to automate on the client-side is best done with JavaScript, but even that alone will not do what you are asking. You would need to call a shell command to carry out the required functions.

                            If the OP is doing this for a legit reason, he should be able to set this up with no problem (the permissions will need changing on the client computer).

                            This is not the place to discuss the correct shell commands to complete these functions, but anyone trying to do this sort of thing (in particular, put the monitor into standby from the shell) should take a look at NirCmd, a great little command line utility for windows that adds a lot of increased functionallity to Windows commands, without needing to install the PowerShell. It can also send commands to remote machines.

                            DvR (Chris)

                            Comment

                            • code green
                              Recognized Expert Top Contributor
                              • Mar 2007
                              • 1726

                              #15
                              The exact same question was asked by the same poster 8 months ago.
                              How odd that the OP gets the same school project every year


                              And this


                              And this


                              Mirainc would not take no for an answer then
                              Last edited by code green; Apr 20 '09, 07:54 AM. Reason: Additional info

                              Comment

                              Working...