473,387 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Code to turn off monitor

34
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
Jul 31 '08 #1
17 7491
Markus
6,050 Expert 4TB
You can't control a clients pc using PHP.

The php script will only work on the server it is setup in.
Jul 31 '08 #2
mirainc
34
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
Aug 1 '08 #3
Markus
6,050 Expert 4TB
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.
Aug 1 '08 #4
dlite922
1,584 Expert 1GB
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
Aug 1 '08 #5
mirainc
34
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! (:
Aug 4 '08 #6
dlite922
1,584 Expert 1GB
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!!
Aug 4 '08 #7
mirainc
34
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?
Aug 4 '08 #8
mattas
2
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
^^^^^^^^^^^these 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...actually i'm not really sure if that is seconds or milliseconds..sorry..

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
Sep 23 '08 #9
Atli
5,058 Expert 4TB
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
Sep 23 '08 #10
tharden3
916 512MB
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? ;)
Sep 23 '08 #11
Kevinyy
77
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.
Sep 23 '08 #12
Atli
5,058 Expert 4TB
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.
Sep 23 '08 #13
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)
Apr 18 '09 #14
code green
1,726 Expert 1GB
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
http://bytes.com/topic/php/answers/826928-power-saving

And this
http://bytes.com/topic/php/answers/8...emote-shutdown

And this
http://bytes.com/topic/php/answers/8...g-power-values

Mirainc would not take no for an answer then
Apr 20 '09 #15
Markus
6,050 Expert 4TB
@code green
You gotta respect his persistence ;)
Apr 20 '09 #16
Ciary
247 Expert 100+
i think it would be highly insecure if something like this would be possible.thnk about what would happen if someone opens a page and suddenly his pc shuts down. also, if it was possible and you would link to it using an ajax request, it wont be your pc that shuts down but the webserver which hosts the ajax.

if this would be possible without asking the user a permission to do it it would be great to hack into and shutdown webservers. i think, if you want to do it, you'll need an activeX control.
Apr 20 '09 #17
I have this vbscript code which helps to configure the time(in minutes) to turn off monitor.

Set WSHShell = CreateObject("WScript.Shell")

WSHShell.Run "CMD /c POWERCFG -X monitor-timeout-ac 1"

Set WSHShell = Nothing
Dec 15 '15 #18

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bathroom_Monkey | last post by:
Hi, I am building some php script that will backup a mysql database and store it locally. This script will be run on a spare computer I have in my office. I want the results of the backup to be...
3
by: Don | last post by:
Setting: chruch multimedia computer and projection system, with 2 display monitors. The projector is connected to monitor #2. Is there some way using JavaScript I can display a ".jpg" picture...
2
by: Steve Franks | last post by:
According to the docs you tell ASP.NET to use cookieless sessions by setting a value in the config.web file. However, what if I wanted to determine at run time whether or not I wanted to use...
2
by: could.net | last post by:
I want to turn off my monitor from within python, How to do it? Thanks!
2
by: cruddpuppet | last post by:
My school computer has monitor issues (turns off every 2 minutes) and I have to constantly turn it back on. I don't have the software or the privelages to install the software needed to scan for...
4
by: BLUE | last post by:
Psion WorkAbout Pro with Windows CE .NET 4.2 Dealer gave me PowerAPIOn.exe and PowerAPIOff.exe to turn on/off tag reader, but I want to do it programmatically and do the same with WiFi and...
3
by: jim | last post by:
VB.net code to turn monitor on and off....... <CODE> Module Module1 Const HWND_BROADCAST As Integer = &HFFFF Const SC_MONITORPOWER As Integer = &HF170 Const WM_SYSCOMMAND As Short = &H112S ...
27
by: George2 | last post by:
Hello everyone, Should I delete memory pointed by pointer a if there is bad_alloc when allocating memory in memory pointed by pointer b? I am not sure whether there will be memory leak if I do...
13
by: Cross | last post by:
I am developing an application that will show movies. When you wach a movie, you do not want the Power Option "Turn off monitor" to be anabled. Is there anyway to fix this from VB.net? (note that I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.