php

Best method for working out locations within a radius of starting point

I'm aiming to create a feature in my latest project preferably using PHP. When each user signs up they are going to input their postcode. Then hopefully I will be converting this to lat/long using Open Street Map. Anyway, I want to be able to find out other users located near the current user. I have seen a lot of people using the Have...

Is there a way to create an uncompressed zip from PHP?

Is there a way to create an uncompressed ZIP (level 0) from PHP? I can't find any info in the php documentation. ...

OpenX White Labelling

I'm sure I'm not the only one but I'm trying to remove some of the elements within OpenX's source code that mention OpenX so I can fully whitelabel it (which should be possible). I can't for the life of me find where the mention is in code for the bannercode: <!--/* OpenX Javascript Tag v2.8.1 */--> It's driving me mad! Anyone have ...

OOP: retrieve 'fathers' attributes from the 'child' object.

Hi guys, here i am again ;) My problem atm is with nested php classes, i have, for example, a class like this one: class Father{ public $father_id; public $name; public $job; public $sons; public function __construct($id, $name, $job){ $this->father_id = $id; $this->name = $name; $this->job =...

Javascript - get task icon

Hello all! I have a small programming problem (php & javascript). On index.php page I'm printing a news (from mysql db) in a table: CHECKBOX | NEWStitle | NEWStext | NEWSuser | NEWSdate checkbox1 | News 1 .. | Shall we.. | User0002 | 28.7.09 Above that table I have small icons (images), representing EDIT, DELETE, ARCHIVE, EM...

better randomization with php

How random is rand(), and is there a solution for generating more random numbers? ...

Parsing XML in PHP

<?php $xmlstr = <<<XML <books> <book> <title>Great American Novel</title> <plot> Cliff meets Lovely Woman. </plot> <success type="bestseller">4</success> <success type="bookclubs">9</success> </book> <book> <title>Man Bites Dog</title> <plot> Reporter invents a prize-wi...

Html LogIn form not functioning

Ok, I have a login form that looks like this: <form id="loginForm" name="loginForm" method="post" action="login-exec.php"> <table width="300" border="0" align="center" cellpadding="2" cellspacing="0"> <tr> <td width="112"><b>Login</b></td> <td width="188"><input name="login" type="text" class="textfield" id="login" /></td> </tr> <tr...

Retrieving the tags for a post from a Wordpress plugin

I'm new to Wordpress plugins, and editing someone else's to add functionality. I need to retrieve the tags for a particular post. The get post function is already in use inside the plugin and returns category information. Unfortunately nothing is returned for tags. The get the tags function appears to be most appropriate but it only ru...

How to schedule the execution of a PHP script on the server side?

I need a PHP script to be automatically executed at a particular time. How would I achieve this aim? ...

Embedded script languages for PHP?

Hi, i was wondering if anybody knows of a nice scripting language that can be embedded into php? Javascript would be favorite and although there are several attempts they are either much too shaky/slow/outdated (phpjs, j4p5) or a real pain to get up and running on shared hosts (pecl spidermonkey). The background is: I would like to ha...

PHP include file extension best practices

First off, I'll admit that I'm anal about such things. (Bad, bad, me.) However, I'm just wondering what's considered best practice in terms of naming PHP include files. As a base case I'm going to keep .php as the final extension (to help prevent un-parsed files being fetched), but to aid distinguishing between a front end file and an i...

Create row ID for dynamic JS Table

Hi, I have working script that the user completes inputs on a form and when they submit the form and the content of the form inputs are entered as a table row. Is there any way of, I think within the JS to make each row have a unique ID and add a delete button to the last colum of each row so the user can delete an individual row. T...

Wordpress register_activation_hook() + global variables + class problem

Hi, I'm writing my first wordpress plugin and I'm trying to create a function to be called when the plugin is activated. Currently it looks like this: class ThumbsUp { ... } global $thumbs; function thumbs_install() { //global $thumbs; $thumbs = new ThumbsUp(); /* Line 160 */ $thumbs->installThumbsUp(); } /* Line ...

PHP/MySQL Select Statement

This one's probably easy: I have two variables: $sender_id $receiver_id Those ID's are stored and assigned to a user in tblusers. I have no problem selecting one-at-a-time: $data = mysql_query("SELECT * FROM tblusers WHERE usrID='$receiverID'") or die(mysql_error()); while($row = mysql_fetch_array( $data )) { echo $row['usrFirst...

Splitting a string containing <if> <else> with regexps

I'm very poor with regexps but this should be very simple for someone who knows regexps. Basically I will have a string like this: <if>abc <else>xyz I would like a regexp so if the string contains <if> <else>, it splits the string into two parts and returns the two strings after <if> and <else>. In the above example it might return a...

Zend_Progressbar + JQuery + uploading a video

I would like to show a dynamic progressbar in my applciation while uploading a video (*.flv format). I searched on the Web for more than 2 hours but I can't find any tutorial to guide me through this process. What I have so far: script that uploads a video jQuery library included in the section But what to do next? Here is the cont...

Can this code to loop through photos in a folder be optimised?

I have written this code having not used PHP for 2 years now to loop through a folder of photos and write them to the page in alphabetical order. It is a fairly simple request but it took me the best part of 15 minutes to write. if ($handle = opendir('photos')) { $count = 0; $list[] = array(); while (false !== ($file = readdir($ha...

PHP arrays and solution to 'undefined index' errors.

I am working through some code done by a previous developer. I'm pretty new to PHP so I am wondering if there is any well known pattern or solution to this problem. Basically the original author does not check any array indexes before he tries to use them. I know I can use isset() to check each before it is used, but right now there ar...

Storing echoed strings in a variable in PHP

How to grab the string that a function echoes to a variable? I've go a function similar to this: function echoer() { echo 'foo'; } I cannot change it's source. What I would like to do is to store 'foo' in a variable instead of letting it go to the standard output. How is it done in PHP? ...