php

Respecting EXIF orientation when displaying iPhone photos on the web

I am developing an iPhone camera app that uploads an image to Amazon S3 and that image is displayed on a website. When the iPhone takes a picture, it always saves the photo in an upright orientation, while the orientation used to correctly view the photo is saved in the image's EXIF data. So if I take a photo with the iPhone and open i...

Google Contacts API - No Redirection

Hello there, I am currently working on Contact Importer web app (in PHP) so I will be able to grab email address from a user's account on Gmail, Yahoo, etc and use them for my own evil purposes. Just kidding, my web app is very friendly. I thought I would start with Google. I found they have a fantastic little API called Google Contact...

What are the pros and cons of storing files in a database?

Hi, I'm writing a php application and was wondering if it's a bad idea to store complete files in the database. Files should be around 100-200kb mostly text files (txt, doc, docx and so on) or small image files. Or is it just a plain wrong idea? ...

jquery to construct a string and pass it as a post argument for file

I have this js code: $("#startSearch").live("click", function(event) { $("input:checkbox[name='searchId']:checked").each(function() { var searchId = $(this).val(); var host = ''; $.post("php/autosearch-get-host.php",{sId: searchId},function(data){ host = 'http://' + data + '/index.php'; })...

PHP array_search nor working?

What am I doing wrong here? $array = array('sky'=>'blue', 'grass'=>'green', 'sun'=>'yellow'); $key = array_search('green', $array); echo $key; error: Parse error: syntax error, unexpected T_DOUBLE_ARROW in /Applications/XAMPP/xamppfiles/htdocs/search-array.php on line 2 ...

MySQL.. search using Fulltext or using Like? What is better?

I'm working on a search feature for my application, I want to search all articles in the database. As of now, I'm using a LIKE in my queries, but I want to add a "Related Articles" feature, sort of like what SO has in the sidebar (which I see as a problem if I use Like). What's better to use for MySQL searching, Fulltext or Like... or a...

Why must I rewind IteratorIterator

$arrayIter = new ArrayIterator( array(1, 2) ); $iterIter = new IteratorIterator($arrayIter); var_dump($iterIter->valid()); //false var_dump($arrayIter->valid()); //true If I first call $iterIter->rewind(), then $iterIter->valid() is true. I'm curious why it requires that rewind() be called. I imagine there's good reason for it, but I ...

How can I connect to MySQL on a WAMP server?

This might be ridiculously easy for you but I've been struggling with this for an hour... :( <?php $connect = mysql_connect("localhost:8080", "root", "mypassword"); echo($connect);?> This is the code that I'm trying to run - you can see that I'm using 8080 as my port number and, of course, I have html codes as well. However, it gives...

PHP code comments parse speed

Does anyone have a solid benchmark about the speed of parsing PHP code comments? Meaning, will excessive comments increase the time to process a PHP page? ...

PHP explode not filling in array spot 0

I have a file we will call info.txt under UNIX format that has only the following in it: #Dogs #Cats #Birds #Rabbits and am running this against it: $filename = "info.txt"; $fd = fopen ($filename, "r"); $contents = fread ($fd,filesize ($filename)); fclose ($fd); $delimiter = "#"; $insideContent = explode($delimiter, $contents); No...

Help with PHP mailer script

Hi there, I'm clueless when it comes to PHP and have a script that emails the contents of a form. The trouble is it only sends me the comment when I want it to also send the name and email address that is captured. Anyone know how I can adjust this script to do this? A million thanks in advance! <?php error_reporting(E_NOTICE); func...

Multiple INET sockets (mulple IP's too) connected to UNIX sockets

HOST = same host all the time, accepts multiple connection. I have a dedicated server and I will buy extra IP's. Socket 1 connects to HOST:PORT, from IP-1 Socket 2 connects to HOST:PORT, from IP-1 Socket 3 connects to HOST:PORT, from IP-1 Socket 4 connects to HOST:PORT, from IP-2 Socket 5 connects to HOST:PORT, from IP-2 Socket 6 connec...

How to str_replace a section of PHP Code

$embedCode = <<<EOF getApplicationContent('video','player',array('id' => $iFileId, 'user' => $this->iViewer, 'password' => clear_xss($_COOKIE['memberPassword'])),true) EOF; $name = str_replace($embedCode,"test",$content); I'm trying to replace a section of code with another piece of code. I can do it with smaller strings but once I ad...

How do I get the business days in a week with PHP given the range and current week as params?

Hi, how do I compute the business days in a week given the parameters: start date, end date and current week? The duration of the range for the start date and end date may go over a year. edit: thanks for the welcome! business days are from mon-fri. ...

What is a good PHP Payment library that works with Paypal, Google Checkout and Authorize.net?

What is a good PHP payment library that works with Paypal, Google Checkout and Authorize.net? I did find this library but it is not maintained and doesn't offer Google Checkout. Is there other options such as a service that can handle those three or more gateways? ...

Mysql - Get # of months and years

Is there any way to get the # of months and years since a date, using the mysql DATE column? So if I enter 1/1/2009.. I want 1 years, 3 months.. and so on. ...

Having to hit the site login button twice after first turning on computer

Hello, I'm using the code below for a login. It works fine, but when I first try logging in after turning on my computer, it only works the second time that I hit the "Login" button. Any idea how I can make it not require hitting the "Login" button twice in this situation? Thanks in advance, John if (!isLoggedIn()) { if (isset...

In Php, Calling an array when it's name is stored in a variable

Possible duplicate: http://stackoverflow.com/questions/433302/php-convert-a-string-to-variable for example: $test = array("this","is","a","test"); $what_array_to_read = "$test[0]"; function to read the array $test[0] ...

Deferring frequent updates in MySQL

I have frequent updates to a user table that simply sets the last seen time of a user, and I was wondering whether there is a simple way to defer them and group them into a single query after a short timeout (5 minutes or so). This would reduce queries on my user database quite a lot. ...

Method/function overrides in Codeigniter

Hi guys, I want to override the validation_errors() method of the form helper in CodeIgniter for one controller only, so that it will display a single error message (as a sentence in plain english) instead of the detailed line item summary. I've tried defining a validation_errors() function in my controller, which is what I usually do w...