We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
  • Pages:
  • 1
PHP automation
Topic Started: Jun 1 2005, 02:11 AM (785 Views)
blakeo_x
Member Avatar
I cant believe its not PHP!
[ *  *  * ]
I have a script I created in PHP that is something like a mailing list. Instead of having to open a page or push a button every time I want to send out the emails, I want the script to run on the first of every month automatically.

Please help. Try to keep your answer simple step-by-step instructions if possible as Im still warming up to PHP.
Offline Profile Quote Post Goto Top
 
Das
Member Avatar
Smells of rich mahogany
[ *  *  *  *  *  *  * ]
You need to set up a Cron Job to run monthly. Do you have Cpanel?
Offline Profile Quote Post Goto Top
 
blakeo_x
Member Avatar
I cant believe its not PHP!
[ *  *  * ]
yes
Offline Profile Quote Post Goto Top
 
Das
Member Avatar
Smells of rich mahogany
[ *  *  *  *  *  *  * ]
Click on Cron Job in Cpanel.

Put:
Quote:
 

in the area where it tells you to add a line

and in your script change it to be:

Quote:
 
$id = $_GET[id];

if ($id == "7fg9sdf7gdg7fg897g09g7s8dg7s87df8dvfvsfvvbbvbb") {
//Script here
}
//else do nothing


Thank Rory for the code.
Offline Profile Quote Post Goto Top
 
FearKiller
Member Avatar
www.drewscripts.com
[ *  *  *  *  * ]
Code:
 
<?php
if($_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR']) {
die('You can not run this script... so go away');
}
else {
// INSERT SCRIPT TO BE RUN HERE
}
?>

This is what I would use for security rather than a GET id as this will make the script more efficient and secure. :)
Offline Profile Quote Post Goto Top
 
Rory
i;m a mess
[ *  *  *  *  *  *  * ]
^ thanks, i knew there was a better way to do it... (das ein nicked the code i wrote for him and posted it here :P)
Offline Profile Quote Post Goto Top
 
Das
Member Avatar
Smells of rich mahogany
[ *  *  *  *  *  *  * ]
Rory
June 1, 2005 02:03 PM
^ thanks, i knew there was a better way to do it... (das ein nicked the code i wrote for him and posted it here :P)

Sorry, I figured it was ok.
Offline Profile Quote Post Goto Top
 
Seth
Member Avatar
I has a pony
[ *  *  *  *  *  *  *  *  * ]
With proper attribution it is.
Offline Profile Quote Post Goto Top
 
Das
Member Avatar
Smells of rich mahogany
[ *  *  *  *  *  *  * ]
Seth
June 1, 2005 08:24 PM
With proper attribution it is.

There was never a copyright on the code. Does that matter?
Offline Profile Quote Post Goto Top
 
Seth
Member Avatar
I has a pony
[ *  *  *  *  *  *  *  *  * ]
You can't copyright programming logic. Still it is polite to let others know that the code is Rory's.

*Seth copyrights infinite loops :shifty:
Offline Profile Quote Post Goto Top
 
Das
Member Avatar
Smells of rich mahogany
[ *  *  *  *  *  *  * ]
Seth
June 1, 2005 08:34 PM
You can't copyright programming logic. Still it is polite to let others know that the code is Rory's.

*Seth copyrights infinite loops :shifty:

Can't you just add '//Made by User'? Done.

*Das copyrights everything else :shifty:
Offline Profile Quote Post Goto Top
 
Jory
Member Avatar
Member
[ *  *  *  *  *  * ]
*Qj cares not about your copyrights

Think adding //Code made by Rory (in this case) is all you can do.
It gives him the credit, what is all you can give him, I'd say.
Offline Profile Quote Post Goto Top
 
Rory
i;m a mess
[ *  *  *  *  *  *  * ]
I wasn't massivly bothered :unsure:
Offline Profile Quote Post Goto Top
 
Das
Member Avatar
Smells of rich mahogany
[ *  *  *  *  *  *  * ]
FearKiller
June 1, 2005 01:06 PM
Code:
 
<?php
if($_SERVER['REMOTE_ADDR'] != $_SERVER['SERVER_ADDR']) {
die('You can not run this script... so go away');
}
else {
// INSERT SCRIPT TO BE RUN HERE
}
?>

This is what I would use for security rather than a GET id as this will make the script more efficient and secure. :)

What would you replace REMOTE_ADDR and SERVER_ADDR with?
Offline Profile Quote Post Goto Top
 
Gornakle
Member
[ *  *  *  *  * ]
Das Ein
June 2, 2005 03:42 PM
What would you replace REMOTE_ADDR and SERVER_ADDR with?

You don't. $_SERVER['REMOTE_ADDR'] returns the address of whoever accessing the script, $_SERVER['SERVER_ADDR'] that of the server.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · Technology Chat · Next Topic »
Add Reply
  • Pages:
  • 1