Jump to content

Search the Community

Showing results for tags 'php'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. Hi Ive currently developed a script that connects via an API to send a message, and tested it with one user and it works perfectly. But now im bit stuck to send it to multiple users. All my visitors unique IDs are being stored into a file called unique.csv all in 1 column under each other. But what im currently trying to do is to recall the info from the csv and make a contact list to broadcast the message to. The csv file looks like: Here is my current script <?php $f_pointer=fopen("unique.csv","r"); // file pointer while(! feof($f_pointer)){ $ar=fgetcsv($f_pointer); } require_once ('MxitAPI.php'); /* Instantiate the Mxit API */ $key = '****'; $secret = '*****'; $visitor = '****'; $api = new MxitAPI($key, $secret); $api->get_app_token('message/send'); $api->send_message('guniverse', '$ar[0]', '*test message*', 'true'); echo 'Success'; ?>
  2. How to convert following perl scripts to php.... my ( $ServiceSet, $Service ); eval { $ServiceSet = Win32::OLE->GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2")-> ExecQuery("SELECT * FROM Win32_Service WHERE State=\"Running\""); }; unless ($@) { print "\n"; foreach $Service (in $ServiceSet) { print $Service->{Name}, "\n"; if( $Service->{Description} ) { print " $Service->{Description}\n"; } else { print " <No description>\n"; } print " Process ID: ", $Service->{ProcessId}, "\n"; print " Start Mode: ", $Service->{StartMode}, "\n"; print "\n"; } } Above code shows running services from win32_service that i`m taken from http://msdn.microsoft.com/en-us/library/aa394418%28v=vs.85%29.aspx... Please help.. i want to display running services and display it in table form??? Thank You...
  3. I'm trying to make a quiz powered by PHP and jQuery, with all the data (questions, answers, ID's, etc.) stored in a database. My current code attaches a radio button to each answer in a list... <li class="Answer '.$QID.'-'.$Value.' '.$Correct.'" id="'.$QID.'"><label>'.$Value.'. <input name="q'.$QID.'" input data-key="'.$Value.'" type="radio"> '.$QA.'</label></li> Taking a tip from a commercial quiz I saw online, I'd like to remove the radio button (and presumably the form it's a part of, using some CSS to make each answer look something like a button... <li class="Answer '.$QID.'-'.$Value.'" id="'.$QID.'">'.$QA.'</li> However, the commercial quiz is written in JavaScript, which is very hard for me to follow. So I'm trying to create something similar using more PHP (and jQuery). I'm now trying to figure out how to "capture" a value for each question, based on the answer selected by a visitor. For example, let's say someone chose B as the answer to the first question. The ID ($QID) for that question and each associated answer is the numeral 1. The value for $QID-$Value for that particular answer is 1-B. Let's say I create a variable - $Answer1 - to store an ID or value for a user's answer choice for the first question. So, in this case, $Answer1 = '1-B' (if we go with $QID-$Value) or simply 'B' if we just go with $Value. I'm not sure exactly how to capture these values. I don't even know what I should be using - PHP, jQuery or AJAX. Just to get started, all I want to do is give $Answer1 the value for whatever answer the user chooses. So $Answer1 should equal 'B' in this case. Can anyone tell me how to do that, or at least tell me if I should be using PHP, jQuery or AJAX to accomplish it? Thanks.
  4. So while editing my .HTACCESS file I added the proper lines to redirect users that encounter errors like 404 and 500. It works like a charm if I tell it to display a specific message. However if I tell the file to redirect users to a custom error page it fails. When testing out my 404 redirect I get this: Not Found The requested URL /143/test.php was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Apache/2.4.9 (Win64) PHP/5.5.12 Server at localhost Port 80 As you can see it is stating that my ErrorDocument is not found BUT if I type my ErrorDocument URL in I can go to it myself. My .HTACCESS file looks like this: ErrorDocument 400 /error.php ErrorDocument 401 /error.php ErrorDocument 403 /error.php ErrorDocument 404 /error.php ErrorDocument 500 /error.php ErrorDocument 502 /error.php ErrorDocument 504 /error.php # supress php errors php_flag display_startup_errors off php_flag display_errors off php_flag html_errors off # enable PHP error logging php_flag log_errors on php_value error_log PHP_errors.log NOTE: I am using localhost (WAMP). Thanks.
  5. im trying to insert a value in to mysql using an experiment everything works fine after hitting the insert button but the problem arises wen i refresh the page as a empty value gets inserted in to the mysql table wen i refresh it.(pardon my english) this is the index page where i fetch an result from mysql table: <div id="container"> <div class="Container-left"> </div> <div class="container-right"> <form action="1.2.php" method="post"> <textarea height="190px" width="190px" name="text" placeholder="share wats on your mind"></textarea> <br> <input type="submit" name="button" value="Type Here" /> </form> <hr> <?php include '1.2.php'; while ($fetch = mysqli_fetch_array($query1)) { echo 'comment:'.$fetch['post'].'<br/>'; echo '<small>date:'.$fetch['date'].'</small><br/><hr>'; } ?> </div> </div> this is the page where my second code rests: <?php include 'config.php'; error_reporting(E_ALL ^ E_NOTICE); $h= htmlspecialchars($_POST['text']); $p= mysqli_real_escape_string($conn,$h); $sql = "INSERT INTO article (post) VALUES ('$h') "; $sql1="SELECT * FROM article"; $query=mysqli_query($conn, $sql); $query1= mysqli_query($conn, $sql1); if ($_POST['button']){ echo 'inserted'; } else { echo 'not inserted'. mysqli_error($conn); } what should i do to stop value getting inserted in to my table while refreshing the page. pl help and thanks in advance.
  6. I am trying to get data out off a mysql database, by using an php file. But i am not getting any output? Examples.html <html ng-app="countryApp"> <head> <meta charset="utf-8"> <title>Angular.js Example</title> <script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.min.js"></script> <script> var countryApp = angular.module('countryApp', []); countryApp.controller('CountryCtrl', function ($scope, $http){ $http.get('category.php').success(function(data) { $scope.countries = data; }); }); </script> </head> <body ng-controller="CountryCtrl"> <table> <tr ng-repeat="country in countries"> <td>{{country}}</td> </tr> </table> </body> </html> category.php <?php $servername = "localhost:3306"; $username = "root"; $password = "root"; $dbname = "myDB"; $conn = mysqli_connect($servername, $username, $password, $dbname); if(!$conn){ die("Connection failed: " .mysqli_connecet_error()); } $showData = "SELECT id FROM myDB"; $data = array(); $result = mysqli_query($conn, $showData); if(mysqli_num_rows($result) > 0){ while($row = mysqli_fetch_assoc($result)){ $data[] = $row; } } else { echo "0 results"; }; print json_encode($data); mysqli_close($conn); echo($outp); ?>
  7. Basically what I am needing is when a visitor comes to my site and request info on a product, the form sends the product id or name. I have the site set up like product.php?Item=26 and the item number changes based on the product. The page items are being populated with info stored in the mysql databse. I need the email being sent to say something like Basically the "item info" is being pulled from the database. I have asked on different forums and I cannot get a good answer that I can use to make this happen. I might not be explaining it right. Page the form is on is (and all other new-product.php pages) http://www.packagingequipment4sale.com/new-product.php?Item=26 Any help would be greatly appreciated
  8. Hello, First time asking technical question in a forum so I beg pardon for errors. I have a third party blog module installed on opencart. The original coder helped me to fix some bugs, but he is not answering anymore to emails. I would like to add a simple pagination to the "latest articles" part, because at the moment the website display the exact number declared in "article limit" and does not show pagination if articles shown are less than the total. the code from "article_by_type.php" line 85 is the following: /*recent_article*/ if ($setting['article_type']=='recent_article') { $data = array( 'sort' => 'p.date_added', 'order' => 'DESC', 'start' => 0, 'limit' => $article_limit ); $articles = $this->model_news_article->getArticles($data); } another file "article_list.php" at line 88 and 214 already have pagination: $this->data['article_ajax_load'] = $this->getArticle($article_category_id,$page,$limit,$description_limit); $pagination = new Pagination(); $pagination->total = $article_total; $pagination->num_links = 3; $pagination->page = $page; $pagination->limit = $limit; $pagination->text = $this->language->get('text_pagination'); $pagination->url = 'index.php?route=module/article_list/getlist&cpath='.$article_category_id. '&page={page}'.'&limit=' .$limit; $this->data['pagination'] = $pagination->render(); can anyone help add pagination to "article_by_type.php" or adapt the existing pagination code to it ? article_by_type.php article_list.php
  9. hello dear PHP-experts, today i create a rescue-system for the emergency-situation: i am creating a little resque-usb for SUSE-DVD on USB-Stick currently plan to create a litle Rescue-USB while using Suse-ISO DVD on a USB medium 1:1 copied step 1. Suse-ISO download: here: http://ftp5.gwdg.de/pub/linux/suse/opensuse/distribution/13.2/iso/openSUSE-13.2-Rescue-CD-x86_64.iso step 2 copy the file onto a USB stick with the following command dd if=openSUSE-13.2-Rescue-CD-x86_64.iso of=/dev/sdX bs=32kwhere sdX=sdb or sdc is the USB stick ready - now i can test the rescue-usb
  10. Hi, Can anyone recommend some Business Intelligence tools that can be integrated into a PHP (wordpress/joomla) based website? I've had a good look around the net but they all seem to be written in Java/J2EE and appear to be software based - not sure if im after the possible or impossible here... Thanks
  11. I'm going to create a web page with <iframe> tag & want that the src of <iframe> change as value of url in query string changes.i.e. mysite.com/?url=google.com then,src of <iframe> should google.com
  12. Hi! I need to make a little signup form that contains 2 textbox for name and birthday and 2 buttons for submit and export to xml. When the user clicks on the export to xml button, there must be an xml file containing the information entered by the user that can be downloaded. I'm not really familiar to php but can you give me an idea on how to make this possible ? thank you in advance
  13. Here is what I am trying to do. Get from this http://mysite.com/post.php?id=12&title=postname to this http://mysite.com/post/12/postname/ here’s the rewrite rule. Options +FollowSymLinks RewriteEngine On RewriteRule ^post/([a-zA-Z]+)/([0-9]+)/$ post.php?id=$1&title=$2 This is my html link that links to the post.php page. <a href="post.php?id=12&title=postname"> Click here to see the post! </a> It does not change the url. I have also tried it like below and it gives me an internal error. <a href="post/12/postname"> Click here to see the post! </a> Can you see what I have done wrong? Also if the above method for the linking is correct, how do I get the "id" and "title" using the $_GET?
  14. I just want to add a css cass named "active" to my navigation links when its page opened using php. In my website the content have broken into its individual components. And those components are separated, organized, and put back together using one index file. (website bootstrap file) Actually I am modularizing this website using php. My Navigation is something similar to this code - ... <li> <a href="index.php?p=dashboard">Dashboard</a> </li> <li> <a href="index.php?p=page-two">Page Two</a> </li> <li> <a href="index.php?p=page-three">Page Page Three</a> </li> ... This is how my index.php looks like - // Validate what page to show: if (isset($_GET['p'])) { $p = $_GET['p']; } elseif (isset($_POST['p'])) { // Forms $p = $_POST['p']; } else { $p = NULL; } // Determine what page to display: switch ($p) { case 'dashboard': $page = 'dashboard.inc.php'; $page_title = 'Control Panel'; break; case 'page-three': $page = 'page-three.inc.php'; $page_title = 'Page Three'; break; case 'page-two': $page = 'page-two.inc.php'; $page_title = 'Page Two'; break; // Default is to include the main page. default: $page = 'login.inc.php'; $page_title = 'Control Panel Login'; break; } // End of main switch. // Make sure the file exists: if (!file_exists('./modules/' . $page)) { $page = 'login.inc.php'; $page_title = 'Control Panel Login'; } include('./includes/header.html'); include('./modules/' . $page); include('./includes/footer.html'); I tried it something like this - case 'dashboard': $page = 'dashboard.inc.php'; $page_title = 'Control Panel'; $class == ($page == $p) ? 'active' : ''; break; And adding this class to my navigation <li> <a class="<?php echo $class;?>">.... </li> But this is not working for me. hope somebody may help me out. Thank you.
  15. I am really struggling with the logic aspect of my application. I can't picture the structure and get it clear in my mind. As a result, I can't code anything because I'm second-guessing myself at every turn. My application is pretty simple in reality. It's an application that keeps a record of all the different 'contracts'/'agreements' that my colleagues have signed. Some will have signed three or four depending on what systems they are working on. The application will run a cron, daily, and send out an email to anyone who's contract/agreement is about to expire with an invite for them to renew it. I have already built an application that has a login system and authentication (using Laravel). It was my first Laravel effort and I did it using a tutorial from YouTube. I figured I could use the one login from that to act as the administrator for this whole application. Once the administrator is in, they will be presented with a panel to do various things. This is the part I am stuck on. What do you all think of my "logic"? Here are the basic routes (forgetting the auth stuff which is already done); /contracts - to see a list of all the contact templates out there. /contracts/{contract-id} - to view the specific contract template /contracts/create - GET and POST to be able to add new contract templates for other systems /people - view all my colleagues on one page /people/{person-id} - view a specific colleague and all the contracts they have signed /people/create - GET and POST for this too to be able to add new colleagues to the system /people/{person-id}/create-new-contract - so this would add a record in to a third table which joins info from the people table and the contracts table to make a list of unique contract agreements for each person and their expiry date. GET and POST for this as well I suppose. Even as I'm writing this, I don't know if this will be needed because I might have an emailing class that might do this job better? Hence the writing of this post! /agreements/renew/{renew-code} - This will create a new record in the table and amend the old one to show that the previous agreement has expired and that a new one for the next 365 days is in place.As you can probably tell.. I am struggling a bit. Is there any advice you can give me to help me mentally map out my application before I start coding? I just want to get it right..
  16. I'm not sure where to exactly begin with this query, but here's the objectives: Column A values: 3, 5, 7, 9, 21 Column B value: 2 Column User: $id Perform an if on each separate column A while ran in a batch process to speed up the query
  17. hello dear php-experts on my notebook an Akoya P 6512 15" AMD Athlon X2 P320, 2,10 GHz, 4 GB that runs OpenSuse 13.1 i want to prepare the new installation of opensuse 13.1 but i cannot boot from a my DVD with the openSuse 13.2 b. my cd with the Gparted i tried out to enter the boot menu with f 2 - and subesquently editing the boot-device f 10 and switching the boot device nothing works - i have no glue what i can do now ? note : i run the following BIOS American Megatrends version 02.61 i need your help now - should i do a bios ubdate or what? many thanks for any and all help
  18. Hi I just finished this tutorial('http://www.startutorial.com/articles/view/php-crud-tutorial-part-3/) and everything was working fine until I decided to add last names to the application. I got everything working on all the other pages except the Update page. This is my php code. d = $_REQUEST['id']; } if ( null==$id ) { header("Location: index.php"); } if ( !empty($_POST)) { // keep track validation errors $nameError = null; $lastError = null; $emailError = null; $mobileError = null; // keep track post values $name = $_POST['name']; $last = $_POST['last']; $email = $_POST['email']; $mobile = $_POST['mobile']; // validate input $valid = true; if (empty($name)) { $nameError = 'Please enter Name'; $valid = false; } $valid = true; if (empty($last)) { $lastError = 'Please enter last name'; $valid = false; } if (empty($email)) { $emailError = 'Please enter Email Address'; $valid = false; } else if ( !filter_var($email,FILTER_VALIDATE_EMAIL) ) { $emailError = 'Please enter a valid Email Address'; $valid = false; } if (empty($mobile)) { $mobileError = 'Please enter Mobile Number'; $valid = false; } // update data if ($valid) { $pdo = Database::connect(); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "UPDATE customers set name = ?, last = ?, email = ?, mobile =? WHERE id = ?"; $q = $pdo->prepare($sql); $q->execute(array($name, $last,$email,$mobile,$id)); Database::disconnect(); header("Location: index.php"); } } else { $pdo = Database::connect(); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "SELECT * FROM customers where id = ?"; $q = $pdo->prepare($sql); $q->execute(array($id)); $data = $q->fetch(PDO::FETCH_ASSOC); $name = $data['name']; $last = $data['last']; $email = $data['email']; $mobile = $data['mobile']; Database::disconnect(); } ?> When I hit Update it is directing me to a white screen instead of the index.php page.
  19. I have a problem, where i need to know when user leave or close tha browser tab. I tryd to make a ajax post, after unload, make a POST into kill_browser.php and after 1 minute when session_expire, php code will be execute and save time into database. But it not seems to work :/ I'm glad if some 1 can say what im doing wrong, or is there eny better way to detect it. @home.php var leaved = 'leaved'; $(window).unload( function(){ $.ajax({ url: 'kill_browser.php', global: false, type: 'POST', data: leaved, async: false, success: function() { console.log('leaved'); } }); }); @kill_browser.php <?php require('class/connection.php'); $conn = new connection(); session_cache_limiter('private'); $cache_limiter = session_cache_limiter(); session_cache_expire(1); $cache_expire = session_cache_expire(); session_start(); $_SESSION['leaved'] = $_POST['leaved']; if($_SESSION['leaved'] == null || $_SESSION['leaved'] == " "){ $conn->logOut($_SESSION['userID'], $_SESSION['userIP'], $_SESSION['LAST_GENERATED_ID']); session_regenerate_id(true); unset($_SESSION); session_destroy(); header('location:index.php'); } ?>
  20. Hey guys, so I was wanting to sell some source code on my website, but how would I do that. Is there some way to use paypal, when users pay X price they can download the zipped folder, and make sure there is some security to it so somebody just cant share the download link and let people that did not purchase it download it.
  21. Hi Everyone I'm working with the woo commerece plugin and i'd like to have a sub heading under the title of each product. Style and format is sorted however i want a particular Category to show in the sub heading section. I've managed to get as far as showing all categories but i want to narrow this down to just one category that is under a parent category. Below is the code i am using, could anyone suggest how i could achieve showing any child category selected under a parent category. Thanks <?php /** * Single Product title * * @author WooThemes * @package WooCommerce/Templates * @version 1.6.4 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly global $post, $product; $cat_count = sizeof( get_the_terms( $post->ID, 'product_cat' ) ); ?> <h1 itemprop="name" class="product_title entry-title"><?php the_title(); ?></h1> <?php echo $product->get_categories( ', ', '<span class="posted_in">' . _n( 'Artist:', 'Artist:', $cat_count, 'woocommerce' ) . ' ', '.</span>' ); ?>
  22. Why smarty won't find my template file? Fatal error: Uncaught --> Smarty: Unable to load template file 'test.tpl' <-- thrown in C:\xampp\htdocs\testing\includes\smarty\sysplugins\smarty_internal_templatebase.php on line 129 also did testinstall $smarty->testInstall(); Smarty Installation test... Testing template directory... C:\xampp\htdocs\testing\templates\frontend\default\tpl is OK. Testing compile directory... C:\xampp\htdocs\testing\templates_c\frontend is OK. Testing plugins directory... C:\xampp\htdocs\testing\includes\smarty\plugins is OK. Testing cache directory... C:\xampp\htdocs\testing\cache is OK. Testing configs directory... C:\xampp\htdocs\testing\configs is OK. Testing sysplugin files... ... OK Testing plugin files... ... OK Tests complete. And get template dir var_dump($smarty->getTemplateDir()); array(1) { [0]=> string(55) "C:/xampp/htdocs/testing/templates/frontend/default/tpl\" } File schema htdocs -- testing -- incluses -- smarty plugins sysplugins Smarty.class.php SmartyBC.class.php -- configs configs.php -- db connect.php db.php -- configs -- cache -- templates -- frontend -- default -- css -- mages -- js -- tpl test.tpl -- backend -- templates_c -- frontend index.php index.php <?php ini_set('display_errors', 1); ini_set('log_errors', 1); ini_set('display_startup_errors', TRUE); ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); error_reporting(E_ALL); ob_start(); session_start(); require 'includes/smarty/Smarty.class.php'; require 'includes/db/db.php'; require 'includes/configs/configs.php'; $page = isset($_GET['do']) ? $_GET['do'] : ''; switch($page){ case 'home'; include 'pages/home.php'; break; default: include 'pages/test.php'; break; } ob_flush(); ?> configs.php <?php $smarty = new Smarty(); $smarty->compile_check = true; $smarty->debugging = false; $smarty->cache = 1; $smarty->setTemplateDir('C:/xampp/htdocs/testing/templates/frontend/default/tpl'); $smarty->setCompileDir('C:/xampp/htdocs/testing/templates_c/frontend/default'); $smarty->setCacheDir('C:/xampp/htdocs/testing/cache'); $smarty->setConfigDir('C:/xampp/htdocs/testing/configs'); ?> test.php <?php //$success = 'Success Message'; //$error = 'Error Message'; $errors[] = 'Error one'; $errors[] = 'Error two'; $smarty = new Smarty; //$smarty->assign('success', $success); //$smarty->assign('error', $error); $smarty->assign('errors', $errors); $smarty->display('test.tpl'); ?> test.tpl {if !empty($errors)} <div id="errors"> {section name=i loop=$errors} {$errors[i]}<br /> {/section} </div> {/if}
  23. session_start(); $text = rand(10000,99999); $_SESSION["vercode"] = $text; $height = 25; $width = 65; $image_p = imagecreate($width, $height); $black = imagecolorallocate($image_p, 255, 255, 255); $white = imagecolorallocate($image_p, 0, 0, 0); $font_size = 14; imagestring($image_p, $font_size, 5, 5, $text, $white); imagejpeg($image_p, null, 80); The code above creates an image with white background. How to change it to create transparent background?
  24. I am trying to create a registration form where users put their name, email and password only. but i want to write an auto generated account number into database table for each user e.g; XY1234567 where XY should not change 1234567 auto generated random number and no duplicates (in numbers only). example... XY1234567 XY2345678 XY2233455 i found code $num_of_ids = 10000; //Number of "ids" to generate. $i = 0; //Loop counter. $n = 0; //"id" number piece. $l = "AAA"; //"id" letter piece. while ($i <= $num_of_ids) { $id = $l . sprintf("%04d", $n); //Create "id". Sprintf pads the number to make it 4 digits. echo $id . "<br>"; //Print out the id. if ($n == 9999) { //Once the number reaches 9999, increase the letter by one and reset number to 0. $n = 0; $l++; } $i++; $n++; //Letters can be incremented the same as numbers. Adding 1 to "AAA" prints out "AAB". } but its not working as i want. Any help please?
  25. I believe the solution the my problem should be simple I feel that it's staring me right in the face. I have a Cron Job that sends an email message to users who's bill "due date" falls on the current date. I want to make the email more personalized and say: Dear John Doe: You have the following bills due today: Rent Cable Internet Please login to pay your bills Thanks,. Here's my following PHP code <?php header("Content-type: text/plain"); // OPEN DATA BASE define("HOSTNAME","localhost"); define("USERNAME",""); define("PASSWORD",""); define("DATABASE",""); mysql_connect(HOSTNAME, USERNAME, PASSWORD) or die("Connetion to database failed!"); mysql_select_db(DATABASE); joinDateFilter(); // BILL QUERY function joinDateFilter(){ $query = mysql_query("SELECT bills.billname, bills.duedate, bills.firstname, bills.email, bills.paid FROM bills JOIN users ON bills.userid=users.userid WHERE DATE(bills.duedate) = CURDATE() AND bills.PAID != 'YES'"); $mail_to = ""; while ($row = mysql_fetch_array($query)){ echo $row['firstname']." - ".$row['email']."\n"; $mail_to = $row['email'].", "; } if (!empty($mail_to)){ sendEmail($mail_to); } } // SEND EMAIL function sendEmail($mail_to) { $from = "MyEmail@myemail.com"; $message = "Dear " . $row['firstname'].", <br><br>" ."You have the following bills due today.<br><br>" .$row['billname']. "<br><br>" ."Please login to pay your bills"; $headers = 'From: '.$from."\r\n" . 'Reply-To:'.$_POST['email']."\r\n" . "Content-Type: text/html; charset=iso-8859-1\n". 'X-Mailer: PHP/' . phpversion(); mail($mail_to, "Today is your due date", $message, $headers); } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.