php

Is there a way to access a string as a filehandle in php?

I'm on a server where I'm limited to PHP 5.2.6 which means str_getcsv is not available to me. I'm using, instead fgetcsv which requires "A valid file pointer to a file successfully opened by fopen(), popen(), or fsockopen()." to operate on. My question is this: is there a way to access a string as a file handle? My other option is to ...

PHP: whats the total length of a post global variable?

Hi, I was wondering if anybody knows the total length that a post global could be. e.g: $_POST['formInput'] = "hello world, how long can i be?"; I am creating a site where someone will enter an unknown amount of chars into a textarea, so potentially it could be 2 pages on a word document. So if anybody knows of any other methods of h...

An online free-trial anti-abuse system design.

I am currently selling time based access passes to an online service at micro payment prices. After payment the customer gets a set of credentials that is only valid for the purchased period. When the access pass expires the customer has to buy a new set of credentials. So basically the credentials are one-time(period) use only. I wo...

How can I create a comma separated list for multiple node references in Drupal 6?

I have an Author content_type that I'm switching out for username in articles. The problem is that a story can have multiple authors, and the following code in template.php will only generate the first author. How can I get this to output to be readable as "By John Smith, Jane Doe and Mary Poppins | Feb 19, 2010"? function mytheme_date(...

preg replace all links

$text = "Clip - http://depositfiles.com/files/8b5560fne Mp3 - http://letitbit.net/download/4920.adaf494fbe2b15c34a4733f20/Madonna___The_Power_Of_Good_Bye.mp3.html Madonna - The power of goodbye Your heart is not open, so I must go The spell has been broken...I loved you so Freedom comes when you learn to let go Creation co...

How can 4,000 products be easily transfered from one ecommerce solution to another?

A potential client has a slow ecommerce site using Joomla/Virtuecart which takes 6-10 seconds for any page to load. I've seen faster solutions and would like to transfer the 4,000+ products with little hassle to a speedier, more full-featured open-source solution. Is there a good way to transfer thousands of products between ecommerce ...

How to search tweets in replies and retweets?

I want to make an app almost the same as dell canada. http://www.facebook.com/DellCanada?v=app_137102584517&ref=nf . On the right side, "twitter sphere". it is able to be filtered by a keyword from Replies and Retweets. I have googled for a long time, still didn't get any idea how to do it. And thoughts? Thanks in advance. Regard...

php regex: removing more than double space

$tags = preg_replace('/\s\s+/',' ', $tags); that will remove more than just one space ? i need to remove anything more than double space. ...

Safest way to pass credit card number through a multi-step form?

On step 3 I have a form which accepts a credit card, Step 4 re-prints the information including the last 4 digits of the credit card, and Step 5 I need to know the full CC # to process it and send it through my https connection to a 3rd party vendor - should I store it through hidden inputs or $_SESSION so I can access it in between the ...

Having a problem with PHP property_exists()

Hey all... When I run the code below, the if(property_exists(get_class($puzzleCharacters_encrypted), $solutionCharacter) keeps evaluating to false, but the echo statements preceding that are showing the correct information, so the properties are definitely there. Anything I might be missing? (PHP Version 5.2.11) $puzzle_solution = $curr...

Object Oriented Programming with PHP: Refreshing Kills my Objects!!!

I have been poking around in PHP for OOP and I noticed something... Objects are re-instantiated each time the page is refreshed. The problem is that I want the object to keep certain information in class variables for the whole time that someone is on a website. Is there some sort of way to keep an object alive the whole time that some...

Discrepancy in switch statement results

function skyCoverage( $metarClouds ) { foreach( $metarClouds[0] as $cloudReport ) { $coverageCode = substr( $cloudReport, 0, 3 ); // I check $coverageCode here, and it is indeed "CLR" switch( $coverageCode ) { case "CLR": $cloudCoverage = 0; break;...

JSON Spawning mysql sleep processes.

I am in the process of making a Javascript(Front end, PHP back end) game. In this game it checks the server for updates every 2 seconds. There is one 1 sql call being run and at the end I use $mysqli->close() to close the SQL connection. The columns in the where are both indexed. The problem I am having is after its running for a l...

Does Zend ACL suit my needs?

I have based my application upon the Zend Framework. I am using Zend_Auth for authentication, but I'm not sure if Zend_Acl will work for me because, frankly, the examples I've seen are either too simplistic for my needs or confuse me. I'm thinking of elements in my application as Resources and these Resources can have have Privileges. ...

php class function -> call the function according to a passing parameter

Hi, I have a class 'abc', with several functions inside it: 'abc_function1' 'abc_function2' 'abc_function3' 'abc_function4' 'abc_function5' I would like to call a function of the class 'abc' according to a parameter that I enter, a string containing 'function1' or 'function 4' for example, to refer to the corresponding function of the ...

Seeking elegant way to remove any instances of 544 words from a string

I need to remove any instances of 544 full-text stopwords from a user-entered search string, then format it to run a partial match full-text search in boolean mode. input: "new york city", output: "+york* +city*" ("new" is a stopword). I have an ugly solution that works: explode the search string into an array of words, look up each w...

PHPmailer multiple recipients error

Hi there, I have the following code with PHPmailer: $tomailn[0] = '[email protected]'; $tomailn[1] = '[email protected]'; foreach($tomailn as $value) { $mail->AddAddress($value, ''); } But I am getting the error 'Could not instantiate mail function'. If I remove an item from the array it works fine, but gives an error on when trying to...

Checking input is a sum in PHP

I have a form where the user can type something and I want my script to check if it's a sum (e.g. 5 x 5 or 3+ 3) how would I do this? Presumably using Regular Expressions? ...

What does this javascript code mean and how to i decode it using php

this code has a URL in it, how do i use php to decode the url out of it: <script type = 'text/javascript' > eval(function(p, a, c, k, e, d) { while(c--)if(k[c])p = p.replace(new RegExp('\\b' + c.toString(a) + '\\b', 'g'), k[c]); return p} ('1l.1k(\'<7 13="1j"1i="1h:1g-1f-1e-1d-1c"p="o"n="m"1b="3://b.5.a/9/1a.19"><2 1="t"0="s"/><2 1=...

Are this is a bug in PHP language or what ?

I really wondering about this code <? session_start() $_SESSION['me'] = 654; $me = $_GET['me']; echo $_SESSION['me']; ?> it will print the $me value not the $_SESSION['me'] value. Are this is a bug or they do it for security reasons ? any Explanations ? ...