php

strtotime("next march")

Going through a weird problem here. I am trying to get the date of coming March, but it doesn't seem to work. $nextMarch = strtotime("next march"); What could be wrong with this tiny little code? This is a question related to this question: http://stackoverflow.com/questions/1872812/timestamp-of-nearest-valid-month ...

Facebook like Notifications System

Hi, I am developing a face book like notification module in php/mysql where in the user is notified with the latest activities among his friends (Added Photo/Added Video/Commented etc....). What is the best approach to design this module in terms of database. Does it need to have a seperate table for each activity(say photos). Or a sing...

Using javascript history.back() fails in Safari .. how do I make it cross-browser?

I am using <a href="index.php" onclick="history.back();return false;">Back</a> to provide a back to previous page link. It works fine on Windows (IE/Mozilla) but fails in Safari on both Windows/Mac. Is there a way to make it work on all of the systems/browsers (cross-browser/platform)? If it's not possible, is there any other way u...

PHP: Can We Replace PHP Language Construct With Our Own?

Hello All, PHP allows you to replace or even re-name PHP's built-in functions using functions such as override_function and rename_function. Can we override the PHP's language constructs like the ones below? echo eval ...etc ...

PHP and MySQL calendar issue

Hi folks! I'm writing trying to build a calendar right from scratch. I'm using the function written by David Walsh (see link) and it's great. He does a query for each day's cell. But, I'm afraid that when the script's gonna have to run 30 queries in each render, it's gonna be sloooow. So, I was trying to think in another logic, for ex...

Convert all br tags into one universal <br />

need a simple preg_replace to convert all <br> <br/> and all possible br combinations to <br />. This needs to work in order so i can process a string ie: $output = preg_replace('', '<br />', $input) Thanks everyone! ...

PHP & MySQL - PHP warnings help?

Okay first let me just say that my script works fine it just shows these warning when nothing is in the database. What I want is to make the warnings go away even when nothing is in the database. How can correct this problem? And what part of my code do I need to change? Here is the warnings. Warning: ksort() expects parameter 1 to b...

Html encode in PHP

What is the easiest way to Html encode in PHP? ...

Can anyone get access to my PHP source code ?

Is it possible to hide the .php file on the server...? I have a website which sometimes calls php files inside iframes, now I wouldn't like it if somebody copied that code, so how would I hide it? Or do I have to encrypt it? Speed is a huge matter in my case, so anything that doesn't affect performance is appreciated! Thanks ...

Determine REST POST/PUT request format

Hi, I'm developing a REST CodeIgniter Controller and need to POST and PUT to a URL in multiple formats. The main formats I can think of would be: XML JSON HTML Form data There will be a response format defined in the URI e.g. /format/xml or /format/csv. I don't want to have to define the request format in the URI as well. I was w...

PHP find a remote absolute path

Hi, I'm having a problem fetching the absolute URL of a remote image. What I'm doing right now is this: foreach($html->find('img') as $e){ $path = parse_url($e->src, PHP_URL_PATH); $absolute = realpath($path); if($e->src==$path){ echo '<img class="pic" src=' . $absolute . '/><br/>'; } } This code has been written using t...

Cannot use string offset as an array in php

I'm trying to simulate this error with a sample php code but haven't been successful. Any help would be great. "Cannot use string offset as an array" ...

Can I set a php.ini (upload_max_filesize) variable in .htaccess to only apply to one .php file?

I'm not sure if this is possible, but here's what I would like to do. I have a .php script that uploads and then manipulates the file. I only want that particular .php script to be allowed to upload large files, the php.ini settings should apply for all others. Can I edit the .htaccess file to affect only the one .php script? In pseu...

How to display an email address for users but hide from robot? Is there a simply way to do it using PHP, Javascript or Jquery?

Is there an elegant and easy/simple way to do it using PHP, Javascript or Jquery? ...

Quantify streamed video

I'm developing a PHP application which will charge users for the videos they watch. The business model is "everyone pays for how much she watches". For this purpose, I need to; Implement secure video (FLV) access. (Authorized sessions will gain access) Calculate how much video (FLV) data is sent from the server. A trivial solution for...

How to hide code that is empty the correct way using PHP?

I was wondering should the following code listed below display when empty because it does not. Is this the correct way not to display code when it's empty? If not how should my code look when I don't want the code to be displayed if it's empty? I hope that does not sound confusing? Here is the code. <?php if(empty($link)){ echo '<d...

How to retreive a array value in magento

For example i need to retrieve a value from this session. How should i do ? Exactly i need to get the "customer_log_id". > Array ( > [core] => Array > ( > [_session_validator_data] => Array > ( > [remote_addr] => 127.0.0.1 > [http_via] => > ...

Which Language has better Threading functionality? PHP or Ruby

I am creating a web application which requires threading and I am trying to figure out which langauge between PHP and Ruby has better threading functionality and better performance. Even if not in built, some easy work arounds or add-ons. ...

PHP string manipulation

I'm reading a textfile on the format Phone#(tab)Text(line break) (line break) Or more specifically 4799999999 Hey! You owe us $576.53. Pay up to account no. 9760.00.12345, ID: 201561438. 4798888888 Hey! You owe us $199. Pay up to account no. 9760.05.12345, KID: 201565173. 4797777777 Hey! You owe us... and so on. I want to store...

What are my options for developing a method to allow users to upload photos and video to my website from a mobile device

I want to allow users of my website to upload photos and video from their mobile phone. I have a web-based upload page (built using Flash) that posts uploads to a PHP script running on an Apache web server in Amazon EC2 cloud. I would like to use the same server to receive files uploaded by mobile. The 3 options as I see it are - (coul...