php

Error with Dolphin Boonex Community Framework

I just finished moving files from my system to my web host and I am getting this error. I have manually changed the permissions of the tmp folder they are referring to but I keep getting the errror. Please could someone tell me what the problem could be Fatal error: Uncaught exception 'Exception' with message 'Please make sure the /hom...

PHP resize image fixed size but maintain orientation

I need to resize images in php using GD to a fixed size but maintain the orientation (portrait/landscape), these are: portrait: 375 x 500px landscape: 500 x 375px Everything I have tried always ignores the orientation and makes them all landscape. Can anyone help? ...

How to convert a string color to its hex code or RGB value?

Hello all, I am not sure if its possible but I would like to create some sort of function where you pass in a string such as "yellow" or "green" and it returns its hex code or the range of hex codes that greens or yellows fit into. Is this possible in PHP? If not possible, I am willing to try anything else that can do this! Thanks all...

Different Soap Envelopes - One Works, The Other Fails

I'm making an identical SOAP Request, one using the Zend Framework and the other not. The Zend one is not working and the only difference seems to be the envelope namespace. How is the envelope set and why would one of them fail? Zend Soap Call <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://wsapi...

php code for geeting paramenter and image from the post request

Hi all can any one guide me how to get parameter specially image from the given post request. --0xKhTmLbOuNdArY Content-Disposition: form-data; name="source" lighttable --0xKhTmLbOuNdArY Content-Disposition: form-data; name="title" Google (The top search engine). --0xKhTmLbOuNdArY Content-Disposition: form-data; name="isbn" 97800772...

$_SERVER not set with command line -r option?

When I try to print the $_SERVER variable from a command line php, it thinks $_SERVER is not set. $ php -r "print_r($_SERVER);" Warning: print_r() expects at least 1 parameter, 0 given in Command line code on line 1 However, when it's in a file, running it from the command line has it set $ cat test.php <? print_r($_SERVER); $ php t...

Timing portions of a PHP script, including runtime of individual methods of objects?

I was looking for a reliable, clean way to do advanced runtime reports for specific portions of a PHP script. What I'd love to do is dynamically time and track every method call of every object during script execution, log this information, and create a table/report at the end of the script for output. I've thought about doing something...

preg_replace pass match through function before replacing

This is what i want to do: $line = 'blabla translate("test") blabla'; $line = preg_replace("/(.*?)translate\((.*?)\)(.*?)/","$1".translate("$2")."$3",$line); So the result should be that translate("test") is replaced with the translation of "test". The problem is that translate("$2") passes the string "$2" to the translate function. ...

How can I customise Zend_Form regex error messages?

I have the following code: $postcode = $form->createElement('text', 'postcode'); $postcode->setLabel('Post code:'); $postcode->addValidator('regex', false, array('/^[a-z]{1,3}[0-9]{1,3} ?[0-9]{1,3}[a-z]{1,3}$/i')); $postcode->addFilters(array('StringToUpper')); $postcode->setRequired(true); It creates an in...

Integrating Roundcube mail efficiently - literally - has anybody done it?

Hi guys I've integrated roundcube mail albeit pretty bluntly in my application i.e I just have it open in an iframe with the login credentials passed through via session variables. It works but the problem is that its very darn slow - and I'm beginning to assume its because of the iframe thing . I was wondering if anyone has been able to...

Would dynamically created JavaScript files be cached?

So my application uses a LOT of js files. thats a lot of http requests. I decided to combine them dynamically at the server in packs of 3-4 files clubbed by functionality. My client side request is: ...script type="text/javascript" src="http://mydomain.com/core-js.php" ... My server side does: --core-js.php-- header("Content-type: ap...

Debugging CodeIgniters 404 errors

I'm having a nightmare uploading my site to the production server. The site runs fine locally and on a staging server (exactly the same server, settings as the production site). However when I deploy to production I'm getting a 404 error from CI. CodeIgniters 404 error pages are frustrating because it seems as if i can't access other li...

Download HTML and Images with WGet without first few lines

I'm attempting to use wget with the -p option to download specific documents and the images linked in the HTML. The problem is, the site that is hosting the HTML has some non-html information preceding the HTML. This is causing wget to not interpret the document as HTML and doesn't search for images. Is there a way to have wget stri...

MySQL vs PHP when retrieving a random item

Hi, which is more efficient (when managing over 100K records): A. Mysql SELECT * FROM user ORDER BY RAND(); of course, after that i would already have all the fields from that record. B. PHP use memcached to have $cache_array hold all the data from "SELECT id_user FROM user ORDER BY id_user" for 1 hour or so... and then: $id = ar...

mysql select from a table depending on in which table the data is in

I have 3 tables holding products for a restaurant. Products that reside in the bar, food and ingredients. I use php and mysql. I have another table that holds information about the orders that have been made so far. There are 2 fields, the most important ones, that hold information about the id of the product and the type (from the bar,...

php all values in array are identical?

how can I quickly tell if all values in array are identical? ...

Html shows after submitting form and is nowhere to be found in php script.

Upon submitting this form on my site. It send me to a page that says. "Use Back - fill in all fields Use back! ! " But this html isn't in the mail script anywhere. Where could this be coming from? I started out using this contact form (http://www.ibdhost.com/contact/) then changed it a little. Here is the mail script. <?php ...

Can you do RSS feeds on a local server? (PHP)

I am using XAMPP and was wondering if I can code my site to include RSS feeds. Would the codes work and can I test it if I am working on a local server? I am practicing using the OReily head First PHP/Mysql book and I'm on the chapter on RSS and getting RSS videos from youtube. ...

Running response time tests on php code - how much is 7.2E-5 microseconds?

Hi guys I'm using microtime() function of php to tell how long certain snippets of code take to run I do this by taking the time before and after the snippet and subtracting them using microtime function. I got the following results though for the different snippets: 1 - 0.022976 2 - 0.003656 3 - -0.196361 4- 0.006563 5- 7.2E...

De-normalization alternative to specific MYSQL problem?

I am facing quite a specific optimization problem. I currently have 4 normalized tables of data. Every second, possibly thousands of users will pull down up-to-date info from these tables using AJAX. The thing is that I can predict relatively easily which subset of data they need... The most recent 100 or so entries in those 4 normali...