PHP - Script To Email A Variable At Defined Server Date
Hi guys,
Basically I am developing a page where the order status of customers are listed in a tabular form, what I need now is to mail these data to my email address at a defined date (e.g. 1st day of next month) automatically. I do not know how to code this since I am just self studying and is still a noob. Thanks. Similar TutorialsHello, I am creating a website with the use of php and mysql. While I am not advanced, I've been learning quite a bit on php. However, I am looking to build a tracker type script and hide it into my coding so that if someone were to hack into my website and take my website coding, that it would send me an email notifying that they were using my coding. How would I go about this? If you can help me, i'd be glad to credit you! Thank you! My host has a limit of 100 emails per hour and this is now being reached to many times a day and some emails are not being sent due to this. Does anyone have a script or know of one that can stack emails to be sent in MySql or something and every 5 minutes send one out from the stack and then delete from the stack the ones sent. <?PHP ///////////////////////////////////////////////////////// ///////////// SCRIPT SETTINGS /////////////////////////// ///////////////////////////////////////////////////////// $iLoginsFile = "logins.txt"; // filename where account logins are stored. $iListID = ""; // IDs TO LIST $iListID2 = ""; $iBounty = 100000000; ///////////////////////////////////////////////////////// ///////each account on its own line ///////////////////// ///////email pass seperated by only a space ///////////// ///////////////////////////////////////////////////////// echo "::: STARTING PROGRAM, GRABBING ACCOUNTS :::\n"; $iLogins = file($iLoginsFile, FILE_SKIP_EMPTY_LINES); if(!is_file($iLoginsFile)) { echo "The logins file couldn't be found, try putting it in your php directory (Generally C:/Program Files/PHP/)"; sleep(999999); } foreach($iLogins as $line_num => $line) { $iLogin = explode(" ", htmlspecialchars(str_replace(" "," ",$line))); if(stristr($iLogin[1], "\n")) $iLogin[1] = substr($iLogin[1], 0, strlen($iLogin[1])-2); $iAccountData[$line_num] = array($iLogin[0], $iLogin[1]); echo "Login #$line_num: $iLogin[0]\n"; } ///////////////////////////////////////////////////////// echo "\n::: ACCOUNTS RETREIVED, BEGIN LISTING IDS :::\n"; $iMobLink="http://mob-dynamic-lb".rand(1,5).".mobsters0".rand(1,9).".com/mob/"; for($i=0; $i!=count($iAccountData); $i++) { echo "\n::: ".strtoupper($iAccountData[$i][0])." :::\n"; if($iAccountData[$i][1] != "" && stristr($iAccountData[$i][0], "@") && stristr($iAccountData[$i][0], ".")) { list($iStore[0],$iStore[1],$iStore[2],$iStore[3]) = iAuthorize($iAccountData[$i], $iMobLink); if($iStore[2] > 1 && strlen($iStore[3]) == 40) { $iReward = file_get_contents($iMobLink."add_hit_list?user_id=".$iStore[2]."&target_id=".$iListID."&bounty=".$iBounty."&auth_key=".$iStore[3]); xml_parse_into_struct($iP=xml_parser_create(), $iReward, $iS, $iX);xml_parser_free($iP); echo "1: ".strip_tags(str_replace("<br>","\n",$iS[$iX['MESSAGE'][0]]['value']))."\n"; } else echo "Account Skipped: wrong password/email combo, or a login error...\n"; } else echo "Account Skipped: invalid email or blank password...\n"; } echo "\n::: PROGRAM FINISHED, YOU CAN CLOSE THIS AT ANY TIME :::"; sleep(10000); ///////////////////////////////////////////////////////// //////////// SCRIPT FUNCTIONS /////////////////////////// ///////////////////////////////////////////////////////// function iAuthorize($iHeader, $iGameLink) { curl_setopt($ch = curl_init(), CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_URL, "http://www.myspace.com/"); curl_setopt($ch, CURLOPT_COOKIEJAR, "iAuthKeyCookie.txt"); curl_setopt($ch, CURLOPT_COOKIEFILE, "iAuthKeyCookie.txt"); curl_setopt($ch, CURLOPT_REFERER, "http://www.myspace.com/"); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4 (.NET CLR 3.5.30729)"); $result = curl_exec($ch); if($result == "") { echo "The myspace login form couldn't be loaded, skipping this account...\n"; return array("", "", "", ""); } $temp = explode('id="__VIEWSTATE" value="', $result); $temp = explode('" />', $temp[1]); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_URL, "https://secure.myspace.com/index.cfm?fuseaction=login.process"); curl_setopt($ch, CURLOPT_POSTFIELDS, "__VIEWSTATE=".urlencode($temp[0])."&NextPage=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Email_Textbox=".urlencode($iHeader[0])."&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Password_Textbox=".urlencode($iHeader[1])."&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24SingleSignOnHash=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24SingleSignOnRequestUri=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24nexturl=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24apikey=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24ContainerPage=&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24SMSVerifiedCookieToken=&dlb=Log+In"); $result = curl_exec($ch); if(stristr($result, "captcha.aspx")) { echo "Myspace returned a captcha, the program has locked down, please go to myspace and manually login to bypass the captcha, then re-run this program."; sleep(10000); } curl_setopt($ch, CURLOPT_URL, "http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=104283"); $temp = explode('MySpace.ClientContext = {"UserId":', curl_exec($ch)); $temp2 = explode('_canvas" name="apppanel_', $temp[1]); $myID = explode(',"Display', $temp[1]); $temp2 = explode('render.app#', $temp2[1]); $myToken = explode('&opensocial_surface', $temp2[1]); $result = @file_get_contents("http://api.msappspace.com/proxy/relay.proxy?opensocial_authtype=SIGNED&opensocial_token=".$myToken[0]."&opensocial_url=".urlencode($iGameLink)."refresh_stat%3Fuser_id%3D".$myID[0]); if($result == "") echo "There was an error logging into the account..."; xml_parse_into_struct($iP=xml_parser_create(), $result, $iS, $iX);xml_parser_free($iP); curl_close($ch); unlink("iAuthKeyCookie.txt"); return array($iHeader[0], $iHeader[1], $myID[0], $iS[$iX['AUTH_KEY'][0]]['value']); } ?> How can I get $myToken to echo at the top? like $myToken is defined at the bottom curl_setopt($ch, CURLOPT_URL, "http://profile.myspace.com/Modules/Applications/Pages/Canvas.aspx?appId=104283"); $temp = explode('MySpace.ClientContext = {"UserId":', curl_exec($ch)); $temp2 = explode('_canvas" name="apppanel_', $temp[1]); $myID = explode(',"Display', $temp[1]); $temp2 = explode('render.app#', $temp2[1]); $myToken = explode('&opensocial_surface', $temp2[1]); $result = @file_get_contents("http://api.msappspace.com/proxy/relay.proxy?opensocial_authtype=SIGNED&opensocial_token=".$myToken[0]."&opensocial_url=".urlencode($iGameLink)."refresh_stat%3Fuser_id%3D".$myID[0]); if($result == "") echo "There was an error logging into the account..."; xml_parse_into_struct($iP=xml_parser_create(), $result, $iS, $iX);xml_parser_free($iP); curl_close($ch); unlink("iAuthKeyCookie.txt"); return array($iHeader[0], $iHeader[1], $myID[0], $iS[$iX['AUTH_KEY'][0]]['value']); } ?> How can I get myToken to echo before { $iReward = file_get_contents($iMobLink."add_hit_list?user_id=".$iStore[2]."&target_id=".$iListID."&bounty=".$iBounty."&auth_key=".$iStore[3]); xml_parse_into_struct($iP=xml_parser_create(), $iReward, $iS, $iX);xml_parser_free($iP); echo "1: ".strip_tags(str_replace("<br>","\n",$iS[$iX['MESSAGE'][0]]['value']))."\n"; } Hi, n0obie here. I'm trying to identify where my customers are coming from via emails I've sent/received. However, many email providers (namely Gmail) have circumvented this by disallowing IP address geolocation/image caching. I just recalled using date(); time() for lots of things in my database, including post times etc. At first I simply assumed this used server time or something, but when I changed my PC's time, it changed ! Now, shortly after this I simply assumed this was because of me using a localhost? But I am not certain anymore.. If I would place this online, would date() and time() return you server time or user time? I couldnt find it on google =-( Code: [Select] $sql="SELECT * FROM $tbl_name3 WHERE review_show='n'"; $result=mysql_query($sql); $num_results=mysql_num_rows($result); if($num_results > 1){ $message="You have ".$num_results." reviews unapproved."; mail('example@example.com','GHP Reviews', $message, 'From: example@example.com'); } $sql2="SELECT * FROM $tbl_name4 WHERE rma_issued='n'"; $result2=mysql_query($sql2); $num_results2=mysql_num_rows($result2); if($num_results2 > 1){ $message="You have ".$num_results2." RMA Numbers Requested."; mail('example@example.com','GHP RMA Number Requests', $message, 'From: example@example.com'); } The reviews email is being sent, however, the RMA email is not. EDIT: Nevermind, $num_results and $num_results2 should have been > 0 not > 1. Hi Everyone! Thanks in advance for taking the time to review my post. I am pretty new to PHP so please excuse my ignorance. I am working a project for myself. I want to be able to send out newsletters to my customers and sponsors. I have written the code and here it is: <?php $subject = $_POST['subject']; $message = $_POST['message']; $email = "bubba@bubba.com"; $headers = "From: $email"; $email_list = file("elist.txt"); $total_emails = count($email_list); for ($counter=0; $counter<$total_emails; $counter++) { $email_list[$counter] = trim($email_list[$counter]); } $to = implode(",",$email_list); if ( mail($to,$subject,$message,$headers) ) { echo "The email has been sent!"; } else { echo "The email has failed!"; } ?> ----------------------------------------------------------------------------- In my elist.txt file - I have two fields. Name and email. Bubba|bubba@bubba.com Oohay|oohay@yahoo.com If i leave the names out of this file, the email script works great! I want to leave the names in there and reference them in my email that I am sending out to be more personal. Can this be done and can you help? Thanks! Mike Hello guys, I just want to ask if someone can share me codes in php where i can validate the connection of the mail server. I am going to trap this error: Quote Warning: mail() [function.mail]: Failed to connect to mailserver.... Instead of this message showing, I want it to be formal. It will be like this: Quote You cannot connect to you're mail server. Please contact the administrator. And lastly I want to have a validation if an email is existing or not. I want a script which checks first the email if it is existing before sending the message. I hope someone will post their idea here. Thanks in Advance. --CHILL Say I have an email info@website.com created in cPanel on a web hosting company. I want to send email notifications to users on my website. I am using PHP Mailer to send the emails. But all the emails go directly into their junk box/spam folder, unless they confirm that info@website.com is not junk. I am wondering if there is a work around for this? I have a question regarding my email form submission. The email seems to work fine, but the recipient of the email can view my server information (see attached image for example) there are many website hosted on my server and i would like to hide the server info on form submissions. does anyone know of a way to do this? thanks Hello Guys, I want to extract the attachment from an email. I searched and I found the following link below and many similar ones useful. http://garrettstjohn.com/entry/extracting-attachments-from-emails-with-php/ I am able to get the name of the attachments too.. but.. what after getting the file names? .. How do i actually access the file and move it to a location to my server?.. that part is unclear to me.. Please share me your views on this.. or point me in some direction as to how to accomplish this task. Thank you, Rakesh. The html Form I'm using works successfully with this php code:
<?php //check if form was sent if($_POST){ $to = 's@hmail.com'; $subject = 'Form1'; $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $headers = $name; $message .= "\r\n\r\n" . $name; if( empty($_POST["some_place"]) or $_POST['some_place'] != "glory" ) { header("HTTP/1.0 403 Forbidden"); }else{ mail( $to, $subject, $message, $email, $headers ); } header('Location: https://.......com'); exit; } ?>
The problem is that when the email is received it shows the (from) email address to be my domain account user name @ the server name, like this: Any help or suggested remedy will be appreciated Hi all, I have the following code to check whether the client has javascript enabled in their browser: page.php: Code: [Select] <?php session_start(); if(isset($_SESSION['gocheck'])) {$gocheck = $_SESSION['gocheck'];} else {$gocheck = 'no';} //echo $gocheck; if($gocheck=='no'){header ("Location: ./gocheck.php"); exit;} //----Execution only reaches this line if gocheck.php has been run and Javascript is enabled.-------- unset($_SESSION['gocheck']); //rest of page ?> gocheck.php: Code: [Select] <?php session_start(); $_SESSION['gocheck'] = 'yes'; echo" <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\"> <head> <script type=\"text/javascript\" language=\"JavaScript\"> window.location.replace('page.php'); </script> </head> <body> This website requires Javascript to be enabled in your browser. <br /> Please enable Javascript and try again. </body> </html> "; ?> So what should happen is the user is always redirected from page.php to gocheck.php, which sets the session variable $gocheck to 'yes' and directs back to page.php via Javascript. Because $gocheck is then equal to 'yes', page.php shouldn't direct back again tio gocheck.php. This worked fine on my PC (using WAMP), but when I upload the files to the webhost, it seems to get stuck in an infinite redirect loop between page.php and gocheck.php. Also, if I echo $gocheck in page.php, it returns 'no', so it seems as if for some reason the session variable $gocheck is not being set properly by gocheck.php. Could somebody please shed some light on this? Is there an error in my code? Is there something I need to change in php.ini on the webhost's server? Thanks! P.S. WAMP on my PC uses PHP v.5.3.0, but the webhost uses PHP v.5.2.12 - don't think this can be the problem though. I have a script that adds points together based upon the placing. This is the actual script: Code: [Select] <? $points = 0; if($place === '1st') {$points = $points + 50;} elseif($place === '2nd') {$points = $points + 45;} elseif($place === '3rd') {$points = $points + 40;} elseif($place === '4th') {$points = $points + 35;} elseif($place === '5th') {$points = $points + 30;} elseif($place === '6th') {$points = $points + 25;} elseif($place === '7th') {$points = $points + 20;} elseif($place === '8th') {$points = $points + 10;} elseif($place === '9th') {$points = $points + 10;} elseif($place === '10th') {$points = $points + 10;} elseif($place === 'CH') {$points = $points + 50;} elseif($place === 'RCH') {$points = $points + 40;} elseif($place === 'TT') {$points = $points + 30;} elseif($place === 'T5') {$points = $points + 30;} elseif($place === 'Champion') {$points = $points + 50;} elseif($place === 'Reserve Champion') {$points = $points + 40;} echo "Total HF Points: $points"; ?>What it *should* do (my friend's script works the same way and it works) it starts at points = 0, than if there is a first place, it adds 50, and so forth until it reaches the end. It is included into a file, in this area: Code: [Select] <div class="tabbertab"> <h2>Records</h2> <? $query92 = "SELECT * FROM THISTABLE WHERE VARIABLE='$id' OR VARIABLE = '$name' ORDER BY ABS(VARIABLE), VARIABLE"; $result92 = mysql_query($query92) or die (mysql_error()); echo "<table class='record'> <tr><th>Show</th> <th>Class</th> <th>Place</th></tr> "; while($row92 = mysql_fetch_array($result92)) { $class = $row92['class']; $place = $row92['place']; $entries = $row92['entries']; $race = $row92['show']; $purse = number_format($row92['purse'],2); echo "<tr><td>$race</td> <td>$class</td> <td>$place</td></tr>"; } ?> <tr><td colspan='3'><div align='right'><? include('includes/points.php'); ?></div></td></tr> </table> </div> This is the code that is relevant. When ended here, it echoes the last place that appears in the results (such as a 5th place echoing 30 points). When I move it to be included in the while loop, it shows Total Points: 50 Total Points: 25 Total Points: 10 (depending on the results displayed on that page). What am I doing wrong? I have seen a couple of other threads relatively similar but I still find my problem unique so I hope you guys give me a chance.
What I want to do: use proxy to bypass same origin policy and to save these values (that changes and need to be checked by timer) into variables that can be modified.
A server contains data.asp which looks something like this and updates from time to time (although with a bit more data):
{ "Title":"Tile of song" ,"Artist":"The artist" ,"Album":"The album" ,"CDCover":"/covers/randomcover.jpg" }The method I have tried is like the one on http://qnimate.com/s...Policy_for_AJAX. In case you guys don't want to follow the link I've posted the data here as well. <script> function loadXMLDoc() { var xmlhttp; if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","http://www.qnimate.com/ajaxdata.php",true); xmlhttp.send(); } </script> </head> <body> <button type="button" onclick="loadXMLDoc()">Request data</button> <div id="myDiv"></div>And the proxy file: <?php echo file_get_contents('http://www.qscutter.com/ajaxdata.txt'); ?>So what I want to do is store the data into variables that I can alter, not show it inside a div using innerHTML. Preferably check this ever so often for changes as well. Suggestions? I can add that I have the permission from the server owner to retrieve the information and to use it but no possibility to add script to their server, hence the proxy bypass attempt. Can someone propose a solution to resolve the following: I have a PHP script that runs just fine when processing small amounts of data (opening and reading CSV file and performing afew validation checks before saving to db). Issue: when attempting to process a large file, I have found the execution time exceeds the "timeout" value currently set on the server which is 60 seconds. Note: I do not want to increase this time interval as that's a security risk so need to figure out a way to break up the data - being read from the CSV file - into chunks and some way create mini-processes (I guess) to execute chunks of that data at a time until the entire file is read. Any suggestions? Hello, I am writing my first php script (of course) and it works except it only shows 4 variables. Example I have it to send me: mail($myemail, $fullname, $email, $message, $phone); But it will only send me the first four no matter what order they are in. It's driving me crazy. I can't think or find any reason why it would do this. If I change it to mail($myemail, $fullname, $email, $phone, $message); It will send me everything but $message if I change it to mail($myemail, $fullname, $message, $email, $phone ); It will send me everything but $phone Does anyone know why or what I need to change? I apologize if this sounds like a dumb question. I am very very new to php. Thank you for any guidance you can give. Here is the code: HTML: <form action="Contact.php" method="post" id="contact" name="contact" style="margin:0px";> <h2>Contact Form:</h2> <p>Fields marked (<span style="color:#F00;">*</span>) are required.</p> <p> <label for="text_fullname">Full Name<span style="color:#F00;">*</span>:</label> <input name="fullname" type="text" class="input" id="fullname" tabindex="1" /> <label for="text_email">Email<span style="color:#F00;">*</span>:</label> <input name="email" type="text" class="input" id="email" tabindex="2" /> <label for="text_phone">Phone:</label> <input name="phone" type="text" class="input" id="phone" tabindex="3" /> <label for="text_comments">Message/Comment:</label> <textarea name="message" cols="23" rows="3" class="input" id="message" tabindex="4"></textarea> <br> <div style="padding-left:200px;"> <button type="submit" id="send" name="send">Send!</button> <button type="reset">Reset</button> </div> </form> --------------------------------------- PHP: <?php /* Set e-mail recipient */ $myemail = "tkowebworks@gmail.com"; $fullname = $_POST['fullname'] ; $email = $_POST['email'] ; $phone = $_POST['phone'] ; $message = $_POST['message'] ; mail($myemail, $fullname, $email, $message, $phone); header( "Location: http://www.ppm-oc.com/thankyou.html" ); ?> ---------------------------------- Thank you I cant figure out how to add $recieved into this needs to take place of time hope someone knows how to do this what im doing is adding in the UNIX time i want to offset Code: [Select] <?php $offset = date('m/d/Y/H:i:s', time()+$send1['time_offset']); ?> This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=342459.0 Hey guys! I have the following doubt, I have a Date value and I want to add to that date 30 seconds plus. Example: Code: [Select] $last_time = date('D M j H:i:s \G\M\TO Y'); //echo: Thu Mar 10 18:33:48 GMT-0300 2011 I need the following date: Thu Mar 10 18:33:48 GMT-0300 2011 to become: Thu Mar 10 18:34:18 GMT-0300 2011 This means that the retrieved Date now has 30 more seconds... Any ideas?? Looking forward to any help, Thanks a lot in advance, Cheers! |