473,396 Members | 1,859 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,396 software developers and data experts.

How to generate events in php (Server side)

Hello
I would ask if there is any possibility to generate events in php
I mean generate it on server side
Exemple:
If (cond1) and (cond2)
{ send email to user
}

cond1 and cond2 exists in DB so I think it is kind of script that
should be always in standby
Thanks
Aug 21 '08 #1
8 2293
Markus
6,050 Expert 4TB
I have little to zero understanding of what you're talking about (it is nearly 2:30 am, though).

How to generate events? Could you provide an example please?
Aug 21 '08 #2
dlite922
1,584 Expert 1GB
Hello
I would ask if there is any possibility to generate events in php
I mean generate it on server side
Exemple:
If (cond1) and (cond2)
{ send email to user
}

cond1 and cond2 exists in DB so I think it is kind of script that
should be always in standby
Thanks
you'll need to query the database.

do an if statement, and use the mail function or PHPMailer to send the mail.

PHP will not run as a service so you will need to code a file and put it in a crontab or scheduled tasks to run as frequrent as you need, every 5 minutes, hour, day.

Let us know if any questions,



Dan
Aug 21 '08 #3
Atli
5,058 Expert 4TB
Given that your conditions are taken from a database, I assume you have a script that is responsible for updating/inserting those fields?

Would it not be simpler to just have that trigger the mail script?
Aug 21 '08 #4
you'll need to query the database.

do an if statement, and use the mail function or PHPMailer to send the mail.

PHP will not run as a service so you will need to code a file and put it in a crontab or scheduled tasks to run as frequrent as you need, every 5 minutes, hour, day.

Let us know if any questions,



Dan
This is a good answer I did not expect that there is such possibility
I’m using cpanel to manage my server and it has only cron jobs and no scheduled tasks (I think) the cron jobs ask for the commend to run??, how can I use it to run a php scrip ?
Thanks

screenshot is attached

Aug 21 '08 #5
I have little to zero understanding of what you're talking about (it is nearly 2:30 am, though).

How to generate events? Could you provide an example please?
I have users posting ads and others ”usersalert” are subscribing for new ads so they will receive alert by email if there is cretin number of ads ”n” and, only once a day, so my be that “n” could be reached in any time during the day or, it could take more than one day, so I’m trying to run the scrip automatically in specific time “t” and test if “n” { send email to ”usersalert” } else wait for the next “t”
I hope it is clear now
Aug 21 '08 #6
nathj
938 Expert 512MB
I have users posting ads and others ”usersalert” are subscribing for new ads so they will receive alert by email if there is cretin number of ads ”n” and, only once a day, so my be that “n” could be reached in any time during the day or, it could take more than one day, so I’m trying to run the scrip automatically in specific time “t” and test if “n” { send email to ”usersalert” } else wait for the next “t”
I hope it is clear now
It sounds to me like the idea, mentioned earlier, of sending the email when a new ad is inserted is the best solution.

What you could do is set a small counter in another table that keeps track of the number of adverts in a specified period. Then when someone submits the nth advert send the email. Once an email has been sent simply reset the count.

This is simply an enhancement on an earlier posting based on the extra details you have provided.

cheers
nathj
Aug 21 '08 #7
FLEB
30
I think you just need to re-define your problem in more detail. It's not a matter of "sending events"-- it's a matter of...

1.) Determining when to perform the check (in-line with new entries, or perhaps on a daily basis with a cron job).
2.) Getting a set of "trigger" conditions (either hard-coded or from a database)
3.) Querying and retrieving the information from the database that you'll need in order to discover whether the conditions are met
4.) Comparing the database output against the conditions, and
5.) Sending the email

All of these are rather straightforward-- it's just a matter of looking into the individual subjects.
Aug 21 '08 #8
It sounds to me like the idea, mentioned earlier, of sending the email when a new ad is inserted is the best solution.

What you could do is set a small counter in another table that keeps track of the number of adverts in a specified period. Then when someone submits the nth advert send the email. Once an email has been sent simply reset the count.

This is simply an enhancement on an earlier posting based on the extra details you have provided.

cheers
nathj
yes this is a solution as well and I thought about it as a last option, but in this case the email con be sent many times a day and I don’t want to be marked as spam
Aug 22 '08 #9

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

Similar topics

5
by: Vince C. | last post by:
Hi. I'd like to trap ADO Recordset object events in my ASP script (either VBS or JS, no preference). I've tried (in VBS) writing a Sub rs_RecordChangeComplete( adReason, cRecords, pError,...
0
by: Efim | last post by:
Hi, I have got some problem with sending of events in .NET. I am using remouting. The client has got 2 objects for receiving different types of events (responses and events) The server has got...
5
by: Antonio Ooi | last post by:
Hi, I'm an application developer from Malaysia. I wanted to know how ASP.NET server-side events vs. client-side DHTML for FORM manipulations, may be in terms of performance and practicality? To...
5
by: Mong | last post by:
Hi, I have a webform with various asp controls on it such as textboxes and dropdownlists. I'm fairly new to asp.net coming from VB6 and am wondering when it's best to use client side events and...
4
by: Mohammed AlQuraishi | last post by:
Hi, I'm having trouble with synchronizing the order of server-side events, and I was hoping someone here can shed some light on what's happening. In a simplified version, I click on a button...
12
by: scsharma | last post by:
Hi, I am working on creating a webapplication and my design calls for creating main webform which will have menu bar on left hand side and a IFrame which will contain all the forms that are shown...
4
by: Mike Logan | last post by:
I would like to dynamically create a Visio diagram from .Net. I tried looking at the Visio SDK, but the samples are extremely convoluted for me to understand. Does someone have an example of...
3
by: Mike | last post by:
Hi, I'm wondering if I can do this with ASP.NET?
2
by: =?Utf-8?B?QW5kcmV3IFN0b2tlcw==?= | last post by:
Hi I have a usercontrol which contains ajax toolkit controls which I am using in a SharePoint siite. When the user clicks one of the buttons on the page it fires a series of events server side...
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:
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.