php

PHP SOAP client that understands multi-part messages?

Is there such a beastie? The simple SOAP client that ships with PHP does not understand multi-part messages. Thanks in advance. ...

php script Config settings

I have found a little script which looks interesting, you can download the svn from google code at http://code.google.com/p/streetwire/source/browse/ I am trying to set it up on my xampp localhost install, and there is little documentation, here are the first two lines of the config // Paths define('VHOST_DIR', '/data/vhost'); define(...

php session and path setting

I would like to separate my source folders into two: The folders that contain the code that you type into the address bar and those that make up parts of the page (tiles) and other code (classes, etc). So at the start of every php file I added: <?php // index.php include("config.php"); include("session.php"); ?> Config contains just t...

Changing upload_max_filesize on PHP

I'm using PHP 5.3.0 and have encountered something that might be a bug (in which case I'll report it) or might be me - so I'm asking to make sure. When running this code: <?php ini_set('upload_max_filesize', '10M'); echo ini_get('upload_max_filesize'), ", " , ini_get('post_max_size') I end up with: 2M, 8M This is despite my php.in...

Are there any php functions/libs/etc to detect if a user is behind a proxy or not?

I've been having a spam problem on my site, where people sign up and act extremely abusive to other users of my site. I can easy IP ban them, except they always come back under a different IP address through a proxy or TOR. So I was curious if there are any php classes or functions that can look up the IP and determine if its a genuine ...

How to structure multiple users with multiple permission levels?

The site I am working with has a somewhat convoluted way with dealing with users and permissions. These are the user types: User Facility Approver Facility Admin Corporate Approver Corporate Admin Now there are also facilities, and that is where these permission levels come into play. Facilities are linked to users and user levels ...

Data from multiple models in one view (web page)

I'm new to the MVC pattern but have been trying to grasp it, for example by reading the documentation for the CakePHP framework that I want to try out. However, now I have stumbled upon a scenario that I'm not really sure how to handle. The web site I'm working on consists of nine fixed pages, that is, there will never exist any other p...

php array in_array oddity...

of all the languages i know im the weakest in php... I have a script... that takes a csv file and does some stuff with it... fairly simple. the issue i am having: in_array('username', $headers) ... returns null... while... print_r ($headers); shows username being the first entry in the csv. thoughts? mistakes i may have made? TIA ...

Better way to do simple performance testing

When comparing the performance of operations this is how I would typicaly do the tests: <?php $w = 'world'; $start1 = microtime(true); for($i=0;$i<10000;$i++) echo 'Hello ' . $w . '!'; $end1 = microtime(true); $start2 = microtime(true); for($i=0;$i<10000;$i++) echo "Hello $w!"; $end2 = microtime(true); $start3 = microtime(true...

What is the fastest way to determine if a URL exists in PHP?

I need to create a function that returns if a URL is reachable or valid. I am currently using something like the following to determine a valid url: static public function urlExists($url) { $fp = @fopen($url, 'r'); if($fp) { return true; } return false; } It seems like there would be something faster, may...

Using a `<textarea>` to protect against scripts

Hmm. Instead of "defanging" input or using some kind of regex to remove tags, how safe is it to dump user stuff into a <textarea>? For example, say there's a PHP page that does the following: echo '<textarea>'; echo $_GET['whuh_you_say'] ; echo '</textarea>'; Normally this is vulnerable to xss attacks, but in the textarea, all scrip...

How to avoid dead message in Comet chat?

I am doing Comet chat with Erlang and PHP. But now I think I met a problem: the polling connection will disconnect and reconnect automatically in about a certain time (I set this with 10 seconds), so there will be a period of time that the user doesn't connect to chat server. If a user send message at that time, the message will be dead...

How can I use PHP and JavaScript to make an image clickable, and increment a counter stored as a flat file?

Im trying to find a php/js script that will let me take an image, and when clicked, increase the number in a flat file, and save that file. I know how to include the file to get the vote total. Im going insane trying to find this to plug and play into my website. Id love to have ip logging, and a cool fade in/out refresh update thing. ...

Getting the Latitude and Longitude for areas outside the U.S

Can the API for Google Maps be used to retrieve the latitude and longitude for a given Postal Code or City+Region combination for foreign countries such as The United Kingdon, France, Italy, Japan, Australia etc. ? I am working on a project that requires local search results. For domestic users I retrieve their lat/lon via a U.S Zip Cod...

php header download redirect

I'm making a file sharing site for the fun. Trying to make it so that when I hit download, it starts the download. Instead of just a link to /files/$file im trying to do a header redirect: download.php /** * File Download */ $query = mysql_query("SELECT id,name,desc FROM files WHERE id = ".intval($_GET['id'])); $row = mysql_fetch_asso...

How do I grab an instance of a dynamic php script output?

The following link outputs a different image every time you visit it: http://www.biglickmedia.com/art/random/index.php From a web browser, you can obviously right click it and save what you see. But if I were to visit this link from a command line (like through python+mechanize), how would I save the image that would output? So basical...

Revealing an image bit by bit?

I'm trying to get it so, every time someone donates a set amount on a page, another equal portion of an image is revealed. I've got most of the other logic down (PayPal provides nice unique "you've donated" identifiers and such), however, I'm having trouble with revealing the image bit by bit. I tried breaking up the image into small c...

joining two tables based on cookie data

I am making a cookie based favorite system and need to join data from two tables based on the unique user id stored in the cookie so I can tell what items that use has marked as favorites. I know I need to do a JOIN but have not used them much and dont really have my head around them yet. Existing query that selects the items from the ...

problem with single xml file when we select the different songs

Actually in my website www.musicking.in when the user selects songs one player window will open and that will access the corresponding selected songs xml playlist and the player will play those songs. actually its working fine. but sometimes the problem is when so many users are accesiing the player not playing the songs selected, eithe...

Protect php script that receive paypal IPN notifications! [Solved]

Hello, In my website I've integrated a php script that receive an IPN notification and send a license key to the customer! This script is in a folder with other 2 php files required by the php script ... how can i protect this folder? If I place in it an .htaccess with: order allow,deny deny from all I block the paypal notifications ...