php

combining dynamic text with regular expressions in php

I am experimenting with finding popular keywords using curl, php and regular expressions. I have an array of non-specific nouns that I am matching my keyword search up. So I am looking for words like "the", "and", "that" etc. and taking them out of the keyword search. so I have an array of words like so: $wordArr = [the, and, at,.......

mysql select records greater than 3 months

I am trying to write a query to select all records from users table where User_DateCreated (datetime field) is >= 3 months from today. Any ideas? Thanks! ...

Anything like Heroku for PHP or .NET?

In my area PHP is very widespread, so is .NET. Ruby not so much; most places have never heard of it. For some personal things I am "forced" to choose Rails because I want to take advantage of Heroku - the ability to deploy and scale on the cloud very easily is the main reason. Also, they offer a small FREE plan that I can use for demo...

PHP error T_object_operator

I am getting this error : Parse error: syntax error, unexpected T_OBJECT_OPERATOR in wp-content/themes/phil/page.php on line 104 This is my code: <?php $todaysDate = date ('M d'); $event_query = new WP_Query('showposts=5&category_name=events&meta_key=Date&meta_compare=>=&meta_value='.$todaysDate.'&orderby=meta_value=order=ASC'...

HTML Purifier: Converting <body> to <div>

Premise I'd like to use HTML Purifier to transform <body> tags to <div> tags, to preserve inline styling on the <body> element, e.g. <body style="background:color#000000;">Hi there.</body> would turn to <div style="background:color#000000;">Hi there.</div>. I'm looking at a combination of a custom tag and a TagTransform class. Current ...

Box of text in php gd

I want to make box of text having story in it...copy on image using GD library.i want it beacause i have to save image for further puporse. ...

My cookies won't stay (PHP).

I'm building an autologin system using cookies, but one fundamental part of the functionality of the cookies fails: they are non-persistent over different sessions - or even pages! In my login script, I set the cookies like this: setcookie('userID', $userID, time()+86400); // (edited after replies) $userID has a value. Then I print th...

PHP File_PDF Examples / Tutorials?

I've looked through several Google searches now, and continue to keep coming up empty when it comes to finding some end-user documentation for the File_PDF package. A lot of people have pointed to FPDF, which is a predecessor, and as far I know, no longer compatible. FPDF hasn't been updated (http://fpdf.org/) since 2008, either. I'...

imap_open dies when being called

Hi, I've got the following code: print "foo"; imap_open("{localhost:143/imap/notls}", "myname", "mypass"); print "bar"; The script dies. I get zero responds, nothing from apache, no "foo" or "bar", nothing. I can however connect to the imap server (nc localhost ...), I can also put the script on another server and connect ...

Syntax error, need help with this 'string'

I have this piece of code here below: $fq.=" + (fritidsboende_uth_from:[$fritids_uth_from TO *] AND fritidsboende_uth_to:[* TO $fritids_uth_to]) OR (fritidsboende_uth_from:'1972-01-01T01:01:00Z' AND fritidsboende_uth_to:'2019-01-01T01:01:00Z')"; I have noticed my app doesn't get anything behind the colon, in this part of the code: ...

Gateway page system

I'm trying to alter the way we currently provide a gateway page system within our CMS. What i mean by gateway page is mapping a non-existent URL to a page through a rewrite rule in the .htaccess, e.g. RewriteRule ^foobar$ page.php?mode=bar&method=foo&id=1 This allows people to create short links to CMS pages for magazine adverts etc. ...

Create fake subdirectories with htaccess and php AND keep existing directories as is.

I have a website, which has numerous subdirectories already. (All existing in server's filesystem) I want to create new "virtual" sub-dirs with htaccess, but I only want the htaccess rule work for directories, listed in DB, and not existing in filesystem. i.e. File system has: /dir1/ & /dir2/ MySQL database has record for 'dir3' & 'di...

extract every occurrence on string

I have a string of the form "a-b""c-d""e-f"... Using preg_match, how could I extract them and get an array as: Array ( [0] =>a-b [1] =>c-d [2] =>e-f ... [n-times] =>xx-zz ) Thanks ...

unix timestamps and php

I have a list of unix timestamps in a database, and I wanting to select the ones that are from today. i.e If today is Tueday, I want to get all the timestamps that were made today? Is it possible? Is there such a things as strtotime("Today")? Any help would be great ...

Collect specific fields to an array

Hi everyone, Each div with the class "row" is added upon request from the user, to be able to add multiple items at once. So now is the question how I'll collect all the forms in to an array that PHP can read (like JSON for instance). I'll guess that there's already some easy and effective way of doing this? <div class="container"> ...

Adding 30 minutes to time formatted as H:i in PHP

Having a nightmare at the moment and just can't see why it isn't working I have a value in the form H:i (ie 10:00, 13:30) etc called $time What I want to do is create two new values, $startTime which is 30 mins before $time and $endTime which is 30 mins after $time I have tried the following but just doesn't seem to want to work $sta...

cassandra thrift: append data

If I need to append data (not insert) into a particular super column, what should I do? For eg: Consider a existing record described below Kespace : test columFamily: testColum SuperColumn : testSuper column_name : email value : [email protected] Here if I want to add my phone number to the super column "testSuper". What should I...

Switching from PHP to Ruby - is it the answer to performance?

Hi everyone, I get more often the answer, when asking performance related stuff regarding PHP applications, that PHP really isn't the language for high-performance applications, and that a compiled language really is the way to go. The only thing holding me back to PHP is that it's what I have learned to work with for some while now an...

String formatting help

I have this: 2010-04-08T01:01:00Z I want to remove the 'T' and everything behind it as well. Also I would like to rewrite the date into this format: 08-04-2010 How can I do this the easiest way? Thanks ...

getcwd for current location based on ftp account permission

Hello. I'm trying to make a small script that's changing the permission for specific file using a ftp connection. My problem is the absolute path. I have a ftp account wich land on the script directory (/script/). If i'm using getcwd, it will return the whole path (/home/user/public_html/script) but i need only the difference between the...