php

What PHP framework to choose for a Senior Project

I am working on my senior project, and the topic that we agreed on was a CMS that similarly to Drupal would make things easier by providing robust administration capabilities Some of them include: Content type and data field creation (CCK) Views Creation complex user management (tasks and roles) the ability to add third party modules lat...

Capistrano php/apache rollback

Let's say you have a project running on apache. I use capistrano to deploy new code and update a httpd.conf/other configuration files, I then reload all of my services (reloading the configs). How is rollback managed? I wouldn't assume cap rollback would put the old configs in place and reload. Is this possible? Can you show me an examp...

php require_once not working the way I want it to.. relative path issue

I'm having problems assigning a relative path to require_once. I'm sure it's something simple that I'm not seeing... folder directory structure level 1: site level 2: include level 2: class so... site/include/global.php <-- this is where function autoload is being called from site/class/db.php when I attempt to use function__autoload...

Help me understand how message queuing works

Been using PHP for quite some time now and I was wondering what this whole "message queue" is all about. Let's take facebook for example. I can update my status but then I have to show that status updates to all my friends (let's say I have 3000 followers). Even more work if there are comments and they have to be notified to all friends ...

help with regex -- require AM/PM substring at end

I'm using php's preg_match to get a named subgroups from a string. I'm parsing user-generated date/time strings into well-formatted date/time tokens. Here's my regex ~(?P<month>\d?\d)(/|-)(?P<day>\d?\d)(/|-)(?P<year>\d\d\d?\d?) +(?P<time>[\d: +((A|a)|(P|p))(M|m)]+)~i And it correctly parses dates like 01-17-10 09:30 pm 2/1/2010 06...

Scrolling a div with overflow without javascript

I have a div with a static height, with content clipped using overflow: auto. On regular desktop browsers I use javascript to scroll to the bottom of the content. However, I need to do the same on mobile browsers, or browsers without javascript. Not in real time, but to output html+css in such a way so as the browser renders the bottom o...

Asynchronous/parallel HTTP requests using PHP curl_multi

I recently looked into the possibility of making multiple requests with curl. I may not be understanding it fully, so I am just hoping to clarify some concepts. It's definitely a good option if you are fetching content from multiple sources. That way, you can start processing the results from faster servers while still waiting for slowe...

Zend Framework Amazon S3. How to create subfolder in a bucket?

How to create subfolder in a bucket? $s3->createBucket creates only a bucket if I tried $s3->create('bucket/subfolder') it says: bucket name contains invalid characters. tried this either: $s3->registerStreamWrapper("s3"); mkdir("s3://bucket/subfolder"); didn't work either. P.S: credentials are valid. so don't tell me that I'm passi...

Generate playlist using php and getid3

Hi, New to php. I use a php script to generate a playlist, the first song entry in the list is blank for all fields (artist, title, length, filename). Why? Here's the script <?php require_once('getid3/getid3.php'); $dir = 'mp3'; $file_type = 'mp3'; $play_list = '<?xml version="1.0" encoding="utf-8"?><config>'; if (is_dir($...

confusion receiving an string value with functions list() and split()

buy.php <form action="cart.php"> <input style="width:10px; margin-left:9px; " name="price[]" type="checkbox" value="' . $variety['price']. '_'. $variety['variety'] '_'. $product['name']. '" /> </form> I am sending the input form above to cart.php inthere I receive it like: list($aDoor, $variety,$productname) = split('_', $_POST...

PHP best way to MD5 multi-dimensional array?

Hi, i was wondering what is the best way to generate an MD5 (or any other hash) of a multi-dimensional array? I could easily write a loop which would traverse through each level of the array, concatenating each value into a string, and simply performing the MD5 on the string. However, this seems cumbersome at best and i wondered if t...

Problem with using Jquery.ajax over .load on Zend

Right now, what i'm trying to do is to replace a label on the front page with a block of html. Right now, the page basically has: <label id="replace"></label> the js currently has: $(document).ready(function(){ $("#replace").load('/test'); }); the Zend class function has: public function indexAction(){ $this->_helper->layout()...

PHP switch with GET request

I am building a simple admin area for my site and I want the URLs to look somewhat like this: http://mysite.com/admin/?home http://mysite.com/admin/?settings http://mysite.com/admin/?users But I am not sure how I would retrieve what page is being requested and then show the required page. I tried this in my switch: switch($_GET[]) { ...

Admin routing, http://website.com/admin won't go to posts/admin_index

I have admin routing enabled. How can I set routing, to make http://website.com/admin go to posts/admin_index? I've got this: Router::connect('/', array('controller' => 'posts', 'action' => 'index')); But it doesn't seem to work. I get this error (when going to http://website.com/admin): Missing Controller Error: Controller could n...

How can I create a user-customizable form in PHP?

A department at my university has asked the CS department to make them a site that will allow faculty on campus to RSVP for an appreciation breakfast that is held once a year. They then want to be able to pull up all who have registered for the event from some administration page. This isn't really a problem, and I can create a simple ...

Receive output of python script from PHP?

I want to launch a python script similar to this web crawler, wait for it to finish, process the data in php, then return the results to the user. From what I hear, getting the output from python is trivial, but the above script is doing stuff in parallel, so just printing stuff as it finishes won't give me any kind of usable structure....

Grabbing Paypal returned values

Hi, these are the steps in my app: 1) user enters 2 variables (credits and pin) 2) goes to paypal with button and makes the payment 3) paypal automatically returns the user to my site 4) ??? ... So 2 questions: A) step 4 should grab the same original 2 variables that the user entered... how can i achieve that? B) what happens if t...

Should I be using the command pattern? Seems like a lot of work...

My Room class has a lot of methods I used before I decided to use the command pattern. Previously, I was invoking a lot of commands and now it seems I have to make a method in my roomParser class for every method. If I wanted to invoke say, setHotelCode I would have to create a method in roomParser that iterates through and invokes the m...

Designing a tool for PHP debugging

EDIT: Like I said, Xdebug type responses are not really that helpful here. I've added some more info below: I am planning on writing a small PHP debugging solution and would like to poll Stack Overflow for some ideas before I get started. The goal is to simplify debugging a PHP based web app. The tool should be able to plug into an ex...

Handle multiple accounts and users in one CakePHP app with URL domain.com/account/controller/action

What I need to accomplish is a single Application with a single database but multiple accounts (companies), each with multiple users. The URL convention must be as follows: domain.com/account/controller/action So ALL controllers are prefixed by the company/account name. All accounts would share the single database, but each one would ...