Jump to content


Photo

need help to modify a code


  • Please log in to reply
8 replies to this topic

#1 pewee

pewee
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 04 September 2006 - 12:46 PM

I need to send internal message to more than one user simultaneously. The system is made to send «one internal message to only one user" at the time.

The code used to send is:

$sendto = 189;



when user ID is '189' , when I load the page it's working very well and sends message to member ID 189.

I wanted to send simultaneously to a list of user that I have 189, 234, 2578, 6890, etc.. that list can be located on an external txt file.

Each time a user will be sent a message an email is also send  by the system to inform him of a new message in his mail box.

It would be cool if I can have a 10 seconds pause between the sending...  let's say

$sendto = 189;
pause of 10sec 
$sendto = 234
pause of 10sec 
$sendto = 2578
etc...




Any idea how to do that  ?

I 'll appreciate any help_ Thanks


#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 04 September 2006 - 01:03 PM

pause?  use the sleep() function ... sleep(10) pauses ten seconds
Legend has it that reading the manual never killed anyone.
My site

#3 pewee

pewee
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 04 September 2006 - 01:27 PM

Thanks for the reply,


sleep() function ;

$sendto = 189;
sleep(10); 
$sendto = 234;
sleep(10);
$sendto = 2578;
... etc

is that what you have in mind?

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 04 September 2006 - 01:37 PM

Almost. Just remove the line that says sleep() function; the rest is fine.
Legend has it that reading the manual never killed anyone.
My site

#5 syed

syed
  • Members
  • PipPipPip
  • Advanced Member
  • 151 posts
  • LocationEngland

Posted 04 September 2006 - 02:04 PM

Use this script to read a file line by line so u can store the numbers in the file as u suggested earlier.

<?php

        $lines = file('data.txt');

        foreach ($lines as $line_num => $line) {

          print $line;
        }

?>

#6 pewee

pewee
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 04 September 2006 - 02:17 PM

Hello, thanks for fast reply;

I tried that:
$sendto = 189;
sleep(10); 
$sendto = 16067;
sleep(10);

looks like something is missing, because I don't know why It is sending only to the last member ID "16067" not to the first "189"

#7 acdx

acdx
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 04 September 2006 - 02:58 PM

I don't think you can send e-mails just by assigning a value to a variable..

EDIT: how about just something like

<?php
foreach($members_array as $id)
{
  send_mail_function($id);
  sleep(10);
}
?>

Where $members_array holds all the member IDs and send_mail_function(int id) sends the e-mail.

.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

.


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


#8 pewee

pewee
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 04 September 2006 - 03:52 PM

Hello, this are not emails but internal messages sent within the program. The program then sends emails to inform members of a new messages.

The problem that I have today is that i cannot send more than ONE internal message at the time... I was trying to send one message to many members...

thanks for thr help

#9 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 04 September 2006 - 03:55 PM

<?php
// ...
send_message(189);
sleep(10); 
send_message(16067);
sleep(10);
// ...
?>

Edit: you obvisouly need to create the send_message() function.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users