php

Translate Java code to PHP code (13 lines)

Hello! simonn helped me to code an ordered integer partition function here. He posted two functions: one function simply gives back the count of partitions, the second function gives the partitions as a list. I've already managed to translate the first function from Java to PHP: Java version PHP version Unfortunately, I can't manag...

How to setup 1:many relationships in MySQL

Hello folks, I'm trying to build a searchable database of acronyms and their definitions that are specific to a certain industry. It has been years since I've done any real programming, so I'm a little behind the learning curve. I'm writing the code in PHP, and I'm using MySQL as the database. If this can be done easier in Postgres, ...

Accessing last created row in PHP/MySQL

How to access the row which has just been inserted into a DB with PHP/MySQL? I have: $sql = 'INSERT INTO `jos_db`.`jos_sections` (`id`, `name`) VALUES (NULL, \'foo\')'; mysql_query($sql, $dbi); bar(); How do I access the new row in bar()? ...

autoload and multiple directories

Hi I've just been looking at php's autoload() function. Seems a nice idea, but I'm not sure how it handles multiple directories. My current development basically has a library directory structure grouping classes into subdirectories by operation. I'm wondering I have to declare a include() for each directory ... which I really hope I ...

Read header files and do something before full photo upload happens

I am passing a GUID as a header and a photo as a body to a php file. The GUID is used to authenticate. If it's not valid, I want to end the call and I do this using die("GUID was expired"); This works fine, but my issue is that the whole photo is uploading before that gets called. This is bad for the user. I want to read the header a...

php.ini misconfiguration

I've narrowed my problem down somewhat. When I run "error_log('hey');" from the command line it dumps to STDOUT. But if I run the same code from my web interface (Apache) it puts the error in the error log. I've checked both ini files, the one Apache is using, and the one in /private/etc (I'm on a Mac running MAMP). Both error_log variab...

Sort XML via attribute value PHP

So I have an XML file that I am trying to loop through in order, according to the attribute, "order". Here is an example: <page> <talentTrees> <tree name="Football" order="2"> <tree name="Baseball" order="0"> <tree name="Frisbee" order="1"> </talentTrees> </page> My goal is to loop through each "tree" using foreach, but I want to rea...

PHP $_GET and $_POST undefined problem

I'm new to PHP so I apologize if this is a simple problem... I am moving a PHP site from one server to another. The new server is IIS 7.0, PHP 5.2.1, with short open tag turned "On", and I don't know how the original server was set-up (I was just given the code). The following is the very first section of code on one of the pages: <?...

Is it possible to set group-management rights on an Active Directory group via LDAP?

I am building a self-service group management web-app that will allow users to create and manage groups in our Active Directory under a particular OU. I have successfully written a PHP application that accomplishes most of this by binding as an admin user and creating new group objects in the appropriate OU, then adding and removing 'm...

php file download: strange http header

i'm builing this php script which displays a given folder 's children folders and files. Files ought to be downloaded. In order to disclose as little information as possible, each item in the directory is a form with a submit button that contains the html markup. The send method is POST. IF i click on a directory, it opens that directo...

Securing a PHP Product - btcompiler and license keys?

Multi Part Question: I am developing a php app that I plan to sell and distribute. I want to control who has access to the apps main functions and installation though some sort of call to my server, which would check to see if the script's install location (example.com) is in a database, maybe even check for a license key of some sort. ...

Why php page keep loading ?

I am running php 5.2.6 with apache 2. On my localhost, some pages keep loading forever with Firefox. Konqueror works fine. From another computer using Firefox works as well. I looked at the network with ethereal and 200 ok is send and no more data is transiting. any ideas ? Thanks ...

how to send objecs from an iPhone app to a server app using XML??

Hi! I'm building an application in the iPhone where the communication with a PHP server is needed (using XML). I'm able to receive data from the server and I handle the xml file using the NSXML parser. I haven't found too much documentation about sending data from the iPhone to the server (via XML). Any idea, links, and examples w...

how to pass array in php to ruby ?

how do i pass php array's to ruby script as an argument so that ruby script can read php's array. ? ...

PHP - Do something if no errors/warnings occur in set of expressions

I have a page that will basically be used to concatenate a bunch of xml files, it will act as glue that binds them together. There's a small chance the xml files that are being combined might not be well formed because the user will have access. I'm trying to basically rewrite a live file if there are no warnings / errors thrown in a sp...

Optimize PHP framework loading

I have a custom built application framework written in PHP which I have been tasked to optimize. This framework is a shared codebase which loads MVC "modules" to provide various functionality. Each module is a directory containing multiple PHP classes for controllers and models and PHP files for views. The entire framework loads for alm...

Automated Validator Object, Usefulness?

I am mulling over whether I should place metadata in an XML file, then creating an object that automates validation. The reasoning behind this is, adding or removing validation for user input would be a matter updating an XML file. I was curious what the opinions of others were on the usefulness of automating field validation in PHP. I...

ruby script executed from php not working, but ruby script works fine alone.

so i have ruby script that simply writes to a test.txt file with "hello" i have a php script that executes this ruby script, when a user clicks a link. i find that test.txt is empty. however when i run by itself $> ruby sayhi.rb test.txt is filled with "hello" ...

passing JSON encoded argument to a ruby script.

i have a large php array encoded to JSON, and passing it to a ruby script. however, it keeps throwing JSON::ParserError.... it is confused by the numerous doublequotes and singlequotes in the array. i ahve tried escapeshellarg, escapeshellcmd ..... these are not working. ...

Changing CCK Title for Form

By default a CCK form creation has a title of the form Create [Your Content Type Name Here] I want to change mine to Register for Such and Such It was suggested that I could use string-override, but I can't find the string to replace. I've also tried writing code to form_alter, but can't seem to figure out how to get the "title" ...