php

Problem with sprintf error when using S3->copyObject() and filenames with % in them.

I am using PHP S3.PHP class to manage files on Amazon S3. I use the copyObject() function to copy files in my S3 bucket. All works great until I meet filenames that need to be urlencoded (I urlencode everything anyway). When a filename ends up with % characters in it the copyObject() function spits the dummy. for example - the filename...

Why some variables are parameters and others aren't?

What could be the reason for having this: public function __construct($host, $port, $timeout = 5){ $errnum = 0; $errstr = ''; Instead of this: public function __construct($host, $port, $errnum = 0, $errstr = '', $timeout = 5){ ? Why some are params and others aren't ? Thanks a lot, MEM ...

Searching for free PHP chart library with PNG, SVG or PDF output (under LGPL or similar)

Is there a free (LGPL or similar) PHP library that draws line, bar, ... and pie charts to PNG / SVG graphics or PDF files? I need that charts for a PDF output module. As it will be used in a commercial product, it needs to be under LGPL or any similar license. Already searched a lot, but found nothing that is really usable, so far. ...

using foreach loop for multiple MySQL inserts

I'm using the following snippet to break up an string array, then insert them into the database. //split tags into individual words $tag_array = explode(',', $tags); foreach($tag_array as $tag){ addslashes($tag); echo $tag." "; $addTagsQuery = "INSERT INTO `my_blog`.`tags` (`id`,...

balancing Server side and Client side code on a large website

Let's suppose I am programming Facebook (which i'm not), or some other site that involves heavy traffic. Our general Layout is: All CSS is in external files 99% of JS is in external files the back bone of the websites HTML is generated by a PHP/MySQL backend, then we have JS functions to generate the DOM of parts that commonly change. O...

getting json_encode to not escape html entities

I send json_encoded data from my PHP server to iPhone app. Strings containing html entities, like '&' are escaped by json_encode and sent as &. I am looking to do one of two things: make json_encode not escape html entities. Doc says 'normal' mode shouldn't escape it but it doesn't work for me. Any ideas? make the iPhone app un-es...

Tell me there's a better way to turn these checkboxes into JSON

I'm working on a form that lets folks choose their preferred methods of contact. Among other things, the form consists of 9 checkboxes (3 sets of three) that I'm trying to store in my database as JSON. Here's the pertinent parts of the form... <h1 style="padding-top:25px;">Communication Preferences</h1><hr /> <div class="onethird cont...

Configure PHP to send all mail to one account only

How can I configure PHP to send all outgoing mail to my own account so that I can test a business application without actually sending mails to unsuspecting businesses, such as "Congratulations, you have a new account. You will be billed for $xxx" ? ...

input type=text $POST value is null

i'm trying to send the value of the search textbox via jquery on keydown to the php page so that it can display the results containing the search keyword. however, the php page is not reading $_POST of the input textbox [not button]. html: .keydown(function() { //create post data var postData = { "bsearch" : $(this).va...

PHP - Extracting weeks/days/hours/minutes from a date calc.

$dateDiff = $mtime - $ctime; $fullDays = floor($dateDiff/(60*60*24)); $fullHours = floor(($dateDiff-($fullDays*60*60*24))/(60*60)); $fullMinutes = floor(($dateDiff-($fullDays*60*60*24)-($fullHours*60*60))/60); echo "Difference is $fullDays days, $fullHours hours and $fullMinutes minutes."; I am looking to add the ability to se...

Save Checkbox State and Update Database

Hello, I am stucked with an idea I want to implement into one of my projects, and I need some help from the best. :) What I have In the first image I pull some info from my DB and display that info and also a button do Edit/Remove that Even and a Checkbox that should be checked in case of the Event is finished/done. In the second...

image resize in runtime with codeigniter(php)

I have uploaded an image with the resolution 1600x1200. How can I show users 60x60 and 200x200 without creating thumbnails and uploading again. (like phpthumb library) in CodeIgniter? ...

Any fast screenshot services available?

I need one that does not have a big queue. So, if it does not have it on its cache, it would generate and deliver it reasonably fast (1-4 seconds). I do have a list of services, what I am asking is if you have experience with any such service that meets the above criteria that you could recommend. Thank you Edit: To clarify my intent,...

PHP Mail & Ajax: Message does not contain any form data

I'm using jQuery's AJAX function to send a message from a contact form - $('form button').click(function() { $("input").removeClass("error"); $("textarea").removeClass("error"); var name = $("#name").val(); if (name == "" || name == "Name" || name == "Namn") { $("#name").addClass("error"); $("#name").focus(); return false; } var emai...

How to get CKeditor to switch from Hspace and Vspace to proper CSS

I'm working with CKeditor, and for whatever reason, they included Hspace and Vspace in their UI. Convenient idea to allow users to manipulate their images like so, but those are way deprecated. Has anyone converted CKeditor's Hspace and Vspace to CSS, and know how to explain its conversion? I am a javascript novice.. ...

Setting up a proxy server

Hi, So I have a server set up (LAMP) server, this proxy has access to the internal network and I need to give the outside world access to this proxy in order to perform tasks. For example, you should be able to call that proxy with a POST request with the right parameters and the proxy should return the status of that post. Now let's s...

Retrieving RSS feed with tag <content:encoded>

I have the following snippet of code: function getFeed($feed_url) { $content = file_get_contents($feed_url); $x = new SimpleXmlElement($content); echo "<ul>"; foreach($x->channel->item as $entry) { echo "<li><a href='$entry->link' title='$entry->title'>" . $entry->title . "</a></li>"; echo "<li>$entry->content</li>"; echo "<...

How to invite a users friends to an event? Facebook Graph API

I have an application using the Graph API. I have it creating events for the user, but would like to let the user invite their friends from our site instead of having to go to the events Facebook page. Does anyone know of the request I have to send the friends' IDs too to invite them like with the old API? Or if it even exists? I am find...

search using pdo, mysql and php

i'm trying my hand with PDO and would like to know if the following is the correct code to search keywords since it's giving me an error: mysql_real_escape_string(): [2002] A connection attempt failed because connected host has failed to respond. php class: public function searchQuotes() { $search = mysql_real_esc...

php 's mysql_query function didn't support more LIKE statament ?

I queried: select * from marrydays where YMD_X like '2010-1-%' and marrydays.CONG not like 'aa%' and marrydays.CONG not like 'bb%' ; But after I use mysql_fetch_object function,I didn't got exact result,the result just like I queried : select * from marrydays where YMD_X like '2010-1-%' ; Why? ...