Ok, I have seen a lot of gripes about the php include() directive here. It seems this is become a cause of grief for me too.
My site structure is something like this:
public_html\index.php
public_html\includes\content.inc.php
public_html\language\en\language.inc.php
public_html\classes\db.inc.php
The site runs swell on Apache no issu...
Hello all,
Does anybody know if you can configure php's mail() command so it will only use an SMTP server rather than the local sendmail? We are having trouble with emails being marked as spam.
Our server is running RedHat 5 Enterprise.
I am aware of various PHP libraries that act as an SMTP client but I'd rather configure PHP so mail...
Hello,
Is there a real skype api sms gateway ? I want to develop a very light client for Skype in php.
I have found Skype4com but it is not very useful since the user can't send an sms with his username/password.
Thanks!
...
Hello i would like to ask how to create a php code for mysql to do the fallowing thing
if active = 1 to do current amount + 2000
id, eid, amount, apply 1, apply 2, apply 3, active
1 1788 500 NULL NULL NULL 1
2 1956 1000 NULL NULL NULL 1
3 2035 ...
Hello,
I'm working with UK address data and also International address data.
I need to geocode the address data for use on a google map. I'm doing this using the HTTP service. Ie/ Constructing a query string and passing it to file_get_contents($THEURL).
I've managed to geocode 80% of the address data perfectly, however those addresse...
Never mind I did not try hard enough, here is what I was looking for:
$dob = '1980-09-04';
echo $dob;
$age = date('Y') - date('Y', strtotime($dob));
echo $age;
if (date('md') < date('md', strtotime($dob))) {
$age--;
echo $age;
}
Sorry for the unnecessary question.
...
I am trying to achieve the following:
$subject = 'a b a';
$search = 'a';
$replace = '1';
Desired result:
Array
(
[0] => 1 b a
[1] => a b 1
)
Is there any way of achieving this with preg_replace?
preg_replace('/\b'.$search.'(?=\s+|$)/u', $replace, array($subject));
will return all the replacments in the same result:
Array
(...
I'm using the following to clean up input from my contact form:
<?php
$name = strip_tags(stripslashes($_POST['name']));
//this is repeated for several other fields, then:
if(isInjected($name)) { die(); }
/* see isInjected function below */
// send the mail
?>
I'm using this function:
<?php
/* function from http://phpsense.com/p...
Does anyone know of a good class / library to convert English representations of time into timestamps?
The goal is to convert natural language phrases such as "ten years from now" and "three weeks" and "in 10 minutes" and working out a best match unix timestamp for them.
I have hacked up some pretty poor and untested code to get going ...
hi,
on a site, i have to upload images and manually crop them. is there a script so i can crop them without reloading the page (so i can integreate easily), and that will just pass the cropped image location as a $_POST value (via js form submission?)
edit -
i meant use JS to sent the crop dimensions (via ajax), get the returned data ...
Im trying to write an SQL query that will check in the table ‘persons’ in the column ‘rName’ for say a name “jack” and if it exists then UPDATE that row else INSERT a new row with the new rName.
I’v been trying out IF/ELSE statements but haven’t really seen how they work.
Or is there a better way to do what I want without If/ELSE? (I ha...
Hello all,
I'm new to doctrine. I created an bootstrap file like the following one:
require_once(dirname(__FILE__)."/../conf/general.php");
require_once(dirname(__FILE__).'/Doctrine/lib/Doctrine.php');
spl_autoload_register(array('Doctrine', 'autoload'));
$manager = Doctrine_Manager::getInstance();
$manager->setAttribute(Doctrine::AT...
I have an object and want a method that returns how much method this Object have that start with "bla_".
I found get_class_methods() wich returns all method names, but I only want names which starts with "bla_"
...
I read through the related questions and didn't find my answer. This isn't about require/require_once or the use of the __autoload function or even the name of the files.
My company builds large sites and as we've grown, the practice we've grown into is splitting up functions by their relation such as:
inc.functions-user.php
inc.funct...
Hi,
I'm new to PHP and in order to learn the language and the concepts I'm working on a e-commerce website with a shopping cart, etc.
In this site I have items, when an item is clicked, the id of the item is sent via the GET method to the shopping cart page. Using this id, I add the item to the shopping cart(table in db) and it works fin...
I use phpFlickr (last stable version) on Windows Vista and WAMP2.0 :
and I have these :
Strict Standards: Assigning the return value of new by reference is deprecated in .../phpFlickr.php on line 91
Strict Standards: Assigning the return value of new by reference is deprecated in .....phpFlickr.php on line 330
Strict Standards: Assig...
Okay, I understand this:
mm/dd/yyyy - 02/01/2003 - strtotime() returns : 1st February 2003
mm/dd/yy - 02/01/03 - strtotime() returns : 1st February 2003
yyyy/mm/dd - 2003/02/01 - strtotime() returns : 1st February 2003
dd-mm-yyyy - 01-02-2003 - strtotime() returns : 1st February 2003
yy-mm-dd - 03-02-01 - st...
In my project I have 2 databases. propel-build-model is already set up to work for 2 databases - http://stackoverflow.com/questions/733224/multiple-databases-support-in-symfony
If I make changes to either of the databases, I need the propel-build-schema command to rebuild the schemas for both.
I know I can do this manually by amending ...
Is there any way to get SQL Server result in charset different from the native database encoding?
I mean something like "set names" which is used by MySQL.
...
I am writing an application which requires the Master/Slave switch to happen inside the application layer. As it is right now, I instantiate a Zend_Db_Table object on creation of the mapper, and then setDefaultAdapter to the slave.
Now inside of the base mapper classe, I have the following method:
public function useWriteAdapter()
{
...