php

Parsing complex multiple XML attributes in PHP5

Hi guys first post on this site so excuse the formatting. I'm new to xml parsing with php and well this xml feed has me stumped. I get using purely element based formats, but attributes this complex not so much. I tried to get the site to change to easier element based format but they're sticking with this format using attributes and I'...

Multi-Level Bullets Implementation

What is the best way of implementing multi-level lists/bullets in php? What I'm trying to implement is a system to take in short phrases, and categorize them within sections. However, at the same time, I would like to have each section to be collapsible and capable of having sub-sections within them. For Example: Section 10 Section 10...

Whats the simplest way to obscure or hide the paths being used in a PHP - AS3 project

I am working on a project that uses PHP , AS3, and AMFPHP . The project allows users to upload and download images among other things. Since I am fairly new to PHP/FLash security I have been trying to gather as much info about making things as secure as possible. I've got some good advise about using .htaccess files, and a few other tri...

Wordpress Hook Pre Post Update

Hi, I am writing a wordpress plugin. I would like to to set the post status to publish if post status is future. I know one hook that is to be used that is pre_post_update. However where is the array of post related details stored so that I can change the post_status? Thanks for the help ...

Recursive function to generate breadcrumbs

function createPath($id, $category_tbl, $path) { $s = "SELECT * FROM ".$category_tbl." WHERE ID = $id"; $r = mysql_query($s); $row = mysql_fetch_array($r); if($row['PARENT_ID'] == 0) { $path .=$row['TITLE'].'-'; } else { $path .='-'.$row['TITLE']; createPath($row['PARENT_ID'],$category_tb...

Storing XML in a Database for Flexible Content

I'm working on building a system that aggregates content from several different RSS feeds and API's, stores it, and then outputs it with unique formatting based on the source of the content. My current plan is to create an XML structure for each unique type, storing each record using that structure in a MySQL database, and then retrievi...

Globally Unique IDs for files in Windows

I'm wondering how to get globally unique IDs for files and folders in Windows (XP, Vista and 7), and also be able to get the full path of the file or folder just by having the ID, something like getFileByGUID. I'm trying to do this in C++, C# and PHP. The globally unique IDs should stay the same even if the file is moved, so using the f...

displaying all form field names but checkbox's and radios fields dont show.

i have an html form full of text fields, checkbox's , and radio fields. i wanted to get all the names of the fields so that i can get started in validating the information in them. the method i am using to get them is if(isset($_POST['submit'])) { foreach($_POST as $name => $value) { print $name."<br/>"; } } but i notic...

A way to determine browser width in PHP without javascript?

First off is there one? Or would I have to use javascript? I'd like to be able to make changes to which CSS is used, so frex I could load smaller fonts for a mobile device, or whatever. ...

Send 404s to custom route in Kohana 3

I've looked at how shadowhand (the main guy behind Kohana currently) set up his bootstrap.php file to handle exceptions on GitHub. I thought, "that's cool", so I incorporated something similar. However, instead of serving up a view, I'd like to send the request to a different route (or at least point it to a controller/action pair). S...

form $_POST as an array

i noticed that when posting a form the fields come out as an array. like if i do if(isset($_POST['submit'])) { print_r($_POST); } what i usually do for form fields is the following. lets say i have something like this (this is how i usually do it) <form method="POST" action=""> <label>First Name: </label> <input type="text" name="f...

How can I create 'teams' from a list of weighted 'users' randomly but fairly using PHP?

What I am hoping to achieve is the ability to generate 'teams' of users. I will have x amount of men, weighted (decimal skill weight, like 75.23) and y amount of women (also with a skill weight value). Given that list of users, I would then take for input the number of teams to make (let us say, 6 teams). Then, I go through the list o...

Regex to validate URL - Not checking for HTTP?

I know there are tonns of questions on here to validate a web address with something like this /^[a-zA-Z]+[:\/\/]+[A-Za-z0-9\-_]+\\.+[A-Za-z0-9\.\/%&=\?\-_]+$/i The only problem is, not everybody uses the http:// or whatever comes before so i wanted to find a way to use the preg_match() but not checking for http as a must have but mor...

Editing files in PHP

Is there a way to append or remove a line of text from a file using PHP. I am in the process of writing a hosting control panel for my specific web hosting stack and would like to be able to make changes to the files with minimal requirements to touch the file system, and as such would like not to have to rewrite the whole file to add o...

Minimal online commerce software for simple shop.

Hello, I've been looking for some open source (preferably PHP) online shop software that is relatively minimal but haven't had any success. The people that I'm developing the shop for are selling a very limited selection of items and only need PayPal intergration and as such don't need all the bells and whistles of the major open source...

If key is the last in array?

How can i check if this key is the last in an array? $array = array("a","b","c"); The value "c" would have the key 2, is there some code like this is_end(2) which returns true or false depending if they key is the last of the array? Or is there some kind of while() statement I can do? ...

Is there any replacement for PHPDocumentor that supports PHP 5.3?

Some of the new PHP 5.3 features, including namespaces and anonymous functions, are not compatible with PHPDocumentor, even with the latest release. For example, it just raises an error when it encounters "a function with no name", i.e. a closure. So, are there any other open-source tools that generate API documentation (preferably in HT...

TCPDF $pdf->Image Inserted images not visible

Hi, am trying to insert images into a PDF using TCPDF, but am just getting blank pages. Here is my code: if ((($_FILES["file"]["type"][0] == "image/gif") || ($_FILES["file"]["type"][0] == "image/jpeg") || ($_FILES["file"]["type"][0] == "image/pjpeg")) && ($_FILES["file"]["size"][0] < 1000001)) { if ($_FILES["file"]["error"][0] > 0) ...

Easiest way to make comet chat

I need to make tet-a-tet comet chat with many channels using PHP as a backend and JQuery as a frontend. I need something like event-driven server to do this... But didnt find any simple and appplicable to my task. Please, tell me the best solution for this problem ...

PHP: How can I access Paypal's "identity token" from its "Return URL"?

When setting up a custom button at Paypal, you have the option under "Website Payment Preferences" to provide a link that Paypal will automatically redirect the user to upon successful completed payment. Under the Payment Data Transfer you are given an "Identity Token". My presumption is that you can test for the presence of this identi...