FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


cool sms addon





splash
i wanted to emulate the cellular provider content service so i tried this
it send a bit of info when run at random it picks out the info to send
first part subscribe to service with welcome message
Code:

 <HTML>

 <HEAD>

 <META http-equiv="refresh" content="2; url=http://mainpage here.com"> </HEAD>

 <BODY>

<?php

$emailAddress = $_POST['emailadd'];



if(!$emailAddress) // If email address is not entered show error message

{

    echo "Please enter your email address.";

    exit;

}

else

{

    $From = "Random Text Subscription";

    $message = "Thank you, your number ($emailAddress) has been added to our database successfully.\n Brought To You By ttchat.tk";

    $filename = "subscribers.txt"; // File which holds all data

    $content = "$emailAddress\n"; // Content to write in the data file

    $fp = fopen($filename, "a"); // Open the data file, file points at the end of file

    $fw = fwrite( $fp, $content ); // Write the content on the file

    fclose( $fp ); // Close the file after writing



    if(!$fw) echo "Couldn't write the entry.";

    else echo "Your number $emailAddress was successfully added to database.";

    mail($content, $From, $message);

}

?>

<BR><BR><B> Please hold while You are been redirected to the main page -------------->>>>>>></B>

</BODY>

</HTML>


second part to randomize and select content to send to list this part of the script can also be added to a cron job so u don't have to open it manually
Code:

<?php

$textfile ="where content is saveed.txt";



$f = implode('', file("$textfile"));

$quotes = explode("\n\n", $f);

$quote = rand(0, sizeof($quotes)-1);

$tmp = str_replace("\n", "<br>\n", $quotes[$quote]);

$content = $tmp;



$filename = "subscribers.txt"; // File which holds all data

$arrFp = file( $filename ); // Make array of file content lines

$numAdds = count( $arrFp ); // Count no. of elements in the array, count email addresses



for($i=0; $i<$numAdds; $i++)

{

    $emailAddress = trim( $arrFp[$i] ); // Trim email addresses before sending mails

    echo "Sending email to $emailAddress...";

    $success = mail( $emailAddress,'' , $content);



    if($success) echo "Success<br>";

    else echo "Error<br>";

}

echo $content;

?>
Related topics
addon domains / rndc: connect failed
Yet another addon domain question.
What is the best antivirus progrem?
cool bikes
My flash Character - Max
games fo the PS2 on FTP
Please Give Feedback About My Funny Pics Collection!
sms jokes
sms jokes
Some Collection of Cool SMS Messsages
Free World Wide SMS
FREE SMS from Website
piclens Best Addon ever made for Firefox !
cool stuff for Free SMS
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.