php

Does anybody know where to get a smtp connection Daemon?

Here's the thing. I need a daemon running on the server which basically will open an smtp connection, then it will expect calls to the process to send e-mails through the opened connection. This is to avoid connecting to the smtp every time, instead I can receive multiple calls to the process but connection only one time. By the way, t...

what is the best way to put a translation system in php website?

Hi everybody, I'm deevelopping a website in PHP and I'd like to give the user to switch from german to english easily. So, a translation politic must be considered: Should I store the data and its translation in a database table ((1, "Hello", "hallo"), (2, "Good morning", "Guten Tag") etc .. ? Or should I use the ".mo" Files to store...

Appending index value to duplicate screen names

I'm using expressionengine as a CMS but want to override the core validation for new users. When someone registers as a new user, the system checks to see if the screen_name is already taken. If it is, then it throws an error flag. I've found the section of code that's doing the validation but I'd like to change it so that instead of ...

A regex that converts text lists to html in PHP

Hi, I'm trying to code a regexp to convert a block of text: * List item * Another list item to html: <ul> <li>List item</li> <li>Another list item</li> </ul> I know there are snippets or classes to do this (Markdown, Textile, etc) but I think it's overkill: I really just want some basic functionality. So far I'm trying wit...

PCRE: Lazy and Greedy at the same time (Possessive Quantifiers)

I am trying to match a series of text strings with PCRE on PHP, and am having trouble getting all the matches in between the first and second. If anyone wonders why on Earth I would want to do this, it's because of Doc Comments. Oh, how I wish Zend would make native/plugin functions to read Doc Comments from a PHP file... The following...

Converting to date in PHP from yyyymmdd format

I have dates in the following format (yyyymmdd, 18751104, 19140722)... what's the easiest way to convert it to date().... or is using mktime() and substrings my best option...? ...

How to integrate a symfony website with whmcs

Hello, I'm trying to find a way to integrate my website, coded using Symfony (www.symfony-project.org) with my billing system, WHMCS (www.whmcs.com). The first thing I tried was creating a new symfony module called whmcs and in that module, I was using ob_start/require_once/ob_get_contents to retreive the page but it kept resulting in ...

how to convert an object to an array (PHP)?

using the below code for decoding json $categories = json_decode($data); $categories = $categories->data; where i get this {"categories":[{"id":1,"name":"Utilities","apps":897,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/uti.jpg"},{"id":2,"name":"Productivity","apps":477,"iconurl":"http:\/\/static.apptrackr.org\/caticons\/pro....

PHP cookie problem - www or without www

Why is it that if I create a cookie on www.example.com and check it on example.com, the cookie doesn't exist there? I am planning to just use .htaccess redirect non-www to a www domain. But how do I solve this? ...

Listing Array Issue

Hi: I am calling a webservice and I am getting a complex object back. I need to display variables reg_no, opening_inventory_weight. RESULT:- object(stdClass)#12 (3) { ["TxnErrors"]=> object(stdClass)#13 (0) { } ["TxnStatus"]=> bool(true) ["headers"]=> object(stdClass)#14 (1) { ["RPMHeader"]=> array(1) { ...

MySQL Design for Handling Products with Custom Fields

I'm building an web application where an product can be of a few different types (furniture types, actually) and depending upon those types, the product has certain fields associated with it. Quick Background: I'm using MySQL and PHP with CakePHP as my framework. The answer I'm looking for doesn't necessarily need to be "CakePHP-like"; ...

How can I store HTML color codes in a MySQL database then search for a range or colors?

I have a script that extracts the mostly commonly occurring colors from an image. I want to store this data in MySQL then be able to pull out images based on the clicking of a color. For example if the user clicks on a red color I want to pull out other images that have a high count for "red" colors. I'm not sure how to search within a r...

Quality PHP code/snippet repositories?

Does anybody know any larger repositories of high-quality PHP classes and snippets? The only site I know is phpclasses.org, and while I mean no disrespect to its owner/s, its design looks pretty outdated (already has for a looong time) and the "social control" in terms of people reviewing and commenting on code is weak: There are lots an...

Regular expression to extract from URI

Hi, I need a regular expression to extract from two types of URIs http://example.com/path/to/page/?filter http://example.com/path/to/?filter Basically, in both cases I need to somehow isolate and return /path/to and ?filter That is, both /path/to and filter is arbitrary. So I suppose I need 2 regular expressions for this? I am ...

Modifying Webform module

I need some help modifying the Webform Module so that it can work for my project. I use Webform right now for single page, basic forms, and it works wonderfully. What I need to be able to take multiple webforms and string them together based on some initial selections a user makes. Let me give an example. The user is sent to a "General ...

Need help with comet, and what to choose

Hi, I'm new to comet, but I have read about it and I realize that PHP is bad for comet long polling. All of my project is written in CodeIgniter PHP Framework, so all my code is PHP. But I need request data all seconds to update auctions products, and I'm looking for comet, but as PHP is a bad way to comet, how can I do it? also it is...

Using Ajax and jQuery to login a user through a PHP-script, is it secure?

Hi there, quick question, is it secure to use the jQuery.post function in jQuery to pass a users login information to a PHP script? Im thinking about using a piece of code like this: $("#login_form").submit(function() { var unameval = $("#username").val(); var pwordval = $("#password").val(); $.post("backend.php", { username: una...

php imagecopyresampled poor quality

I have a php script which saves the original image, then resizes it - one thumbnail and one larger image for web viewing. This works well except with some images the quality is terrible. It seems to be saved with a very low colour pallet. You can see the result at http://kalpaitch.com/index.php?filter=white - click on the first thumbnail...

Is there an API to determine the most common link in a number of tweets?

Is there an API (Twitter API does not provide this) that I can use to determine the most common links in 200 tweets for example. What I want to do is to get the latest 200 tweets and then determine what are people talking about, I am sure that the tweets will contain links (because I will ask the twitter API to return tweets that contain...

PHP DOMDocument - get html source of BODY

I'm using PHP's DOMDocument to parse and normalize user-submitted HTML using the loadHTML method to parse the content then getting a well-formed result via saveHTML: $dom= new DOMDocument(); $dom->loadHTML('<div><p>Hello World'); $well_formed= $dom->saveHTML(); echo($well_formed); This does a beautiful job of parsing the fragment and...