php

Best Practice: iPhone app communicating to php script hosted on server

My iPhone app communicates with a php script hosted on a server. Hard coded into the app is the domainname.com/phpscript.php?=data If something happens to my domain name, the app won't work. Is there a best practice for handling this. Do you suggest a DNS or something? I'm just looking for ways to avoid a complete resubmission to apple,...

Diferences between php5apache2_2_filter.dll and php5apache2_2.dll

Besides the name, what are the differences between loading one or another? I got issues with APC and X-Debug, I know that is a quick way to crash Apache but my application relies in APC and I MUST profile with WebGrind so it's no option for me to disable either. So I'm trying to think out of the box. What I can't do: Disable APC or X...

Send multiple xml requests in parallel in PHP? Possible?

I have a script that makes calls to an XML api on a remote server. Currently my script sends 10 requests serially to the remote server. It fully processes each request before sending the next one. This is a huge bottleneck for my server at the moment since each API request can take up to a second each. Since most of the time is spent...

Get URL of calling webpage in PHP

Hello all, I am working on a website statistics engine for a class. The idea being that you can simply embed a little code in your web page which will call the stats website on every page load and the stats website will then track your hits and such… nothing ground breaking. What I would like to do is be able to break down website hits...

Wamp with php3?

I am looking for a wamp with PHP3 (i need to audit some old application that was coded for php3) I couldn't find any on google, does anyone knows one? ...

[PHP] - How to plan a "secure" HTML FORM

I use $_POST to read data sent through HTML forms to the server, narrowing down attacks exposure. How can I strengthen security, using some kind of tokens in the form? The tokens could be readable however with a sniffer..... EDIT * I agree the message above is generic...I'll try to give more details! Ok, a PHP/Server generates emails...

check for integer or float values

I have this $number = 0.5 if (is_float($number)) { echo 'float'; } else { echo 'not float'; } and it echos not float. what could be the reason thanks ...

PHP randomly select from a list

I am currently working with PHP code that random selects colors: <div onclick="location.href='<?php the_permalink() ?>';" style="cursor:pointer;background:#<?php echo rand(0, 9); ?><?php echo rand(0, 9); ?><?php echo rand(0, 9); ?><?php echo rand(0, 9); ?><?php echo rand(0, 9); ?><?php ...

jQuery: Onclick, open a new div with ID

Hi, I'm creating a footer chat bar from this tutorial here: chat bar tutorial I'm trying to make it so when I click a username in the buddylist, it opens up a new chat box div in the chat bar itself. And, when the div is created/opened, it also assigns an ID to it. For example, it assigns the buddy's username to it. I'm not sure if yo...

What are good techniques for creating simple, zero-css-zero-html-knowledge admin theming for websites?

I would like to allow administrative users to simply theme their own website (a re-deployable charity website built in php in the back end). I certainly don't know what the ideal approach would be, but my naive concept of how to do it is like this: Create a theme.css file that is dynamically generated, and overloads the colors and bac...

PHP: Commenting code.

Good Day All, Got theoretical question. I'm creating a simple application using KohanaPHP framework, just fyi. This is my first time with framework and have one - maybe stupid for some of you - question. While developing classes or functions I'm commeting my code using DocBlock. Just wondering how should I comment my code while using ...

Extract a mysql resource to php array?

My goal is to display the profile of a user. I have this function: function get_profile($un) { if($registerquery = $this->conn->query("SELECT * FROM table WHERE usr = '".$un."' ")){ return $profile = mysql_fetch_array($registerquery); } } Then the display snippet: <?php $profile = $mysql...

How can I add metadata to an image?

Where does one insert meta data into and image file and what it the mark up to do so? i want to do this with php. ...

Validator Zend_Validate_File_IsImage doesn't work correct

I try to use the next validator of ZF: $isImageValidator = new Zend_Validate_File_IsImage(array('headerCheck' => true)); (I don'n want to use fileInfo or mimeMagic) But even when image is chosen, validator returns next: File 'image.png' is no image, 'application/octet-stream' detected (When i look through the $_FILES global array i...

Getting 'active' page to set nav tab

I want to be able to pull the name of the file and url I'm currently on, set two variables (filename, folder), and check it against an array. Depending what the values are, we set an 'active' class to that < li> to show the page is a part of that section. I've never really used arrays before, but I did a little research thinking they w...

Forward Basic Authentication to a form?

Alright, I don't know if anyone has tried to do this yet, however. I have a website lets just call it localhost. for now. I have a form on that page. however, I want to be able to skip the form, and redirect my data to the form by using the basic authentication method. for example: http://admin:admin@localhost would send the username an...

PHP read command from file and run it

Hello, I have a unix command written in a file and I need PHP to read it and execute it. The reason it needs to be read from a file is because the commands symbols mess up the script when put them directly in it. So far I have this: <?php $command = readfile("http://localhost/command.txt"); echo shell_exec($command); ?> Upon running...

Problem sending json jQuery ajax to php and back

I'm having problems sending a json jQuery array via ajax to a php script. What is the problem here: var tee = $('#voting_image img').attr('id'); var vote = 1; var thing = {tee: tee, vote: vote}; var encoded = $.toJSON(thing); $.ajax({ url: '/vote_save.php', type: 'POST', ...

PHP eval(gzinflate(base64_decode(..))) hack - how to prevent it from occurring again?

We recently had a website hacked, where some PHP code was injected into the index.php file that looked something like: eval (gzinflate(base64_decode('s127ezsS/...bA236UA1'))); The code was causing another php file (cnfg.php) to be included, which was causing some pharmaceutical-related spam to be displayed (but only visible to googleb...

PHP How to call parent::__call() and pass in the arguments

Hi, If I am overloading the __call method in a PHP class, how could I call the actual method if my code doesn't do something else? For example: public function __call($name, $arguments) { if($name == 'tom') { $this->doName($name); } else { // Something here to carry on the __call maybe: // $t...