php

Zend Framework routes not being applied

I have the following routes in my application.ini: resources.router.routes.user.route = "users/:id/*" resources.router.routes.user.defaults.controller = users resources.router.routes.user.defaults.action = profile resources.router.routes.user.reqs.id = "\d+" resources.router.routes.page.route = "pages/:date/*" resources.router.routes.p...

Advantages of PHP 5.3's PHAR archives

PHP 5.3 has a new feature called PHAR similar to JAR in JAVA. It's basically a archive of PHP files. What are its advantages? I can't understand how they can be helpful in the web scenario. Any other use other than "ease of deployment" - deploy an entire application by just copying one file ...

PHP: force an image download from above directory root?

I'm attempting to force a download of an image that is in a directory above my website root. The download happens ok, and the correct filename is saved. However, the end-file is not a valid image and will not open or display properly. Here's my code: $photograph = new ViewPhotograph($photograph_id); $photograph->setPh...

PHP code for generating decent-looking coupon codes (mix of alphabets and numbers)

Hi, For an ecommerce site I want to generate a random coupon code that looks better than a randomly generated value. It should be a readable coupon-code, all in uppercase with no special characters, only letters (A-Z) and numbers (0-9). Since people might be reading this out / printing it elsewhere, we need to make this a simple-to-com...

Accessing SimpleXMLElements within an array

Hi, I've had a look round similar articles such as this one and I can't quite get it to work, quite possible I'm just misunderstanding. I've got a simple script which parses a bit of xml and prints out specific fields - what I'm having trouble doing is accessing the data of SimpleXMLElement Objects. XML (simplified for clarity) <cha...

Auto back-end generator

Is there any PHP application that can automatically generate add/edit forms and listing pages by just reading the database. Like PhpMyAdmin but highly customizable through code or configuration files. The main reason is to avoid time spent on development of back-end of web applications. ...

Problem with two requests on a table in one action

Hello, I have an action with two requests on an unique table. The results of the requests must be different. But, the result is the same for my two requests and it comes from my second request. // Récupération du (ou des) locataire(s) actuel(s) du logement $this->locataires = Doctrine_Query::create() ->from('logement l')...

AJAX Submit Form.. data not sending

Hi, I have been battling with this piece of code for literally days now... Would appreciate any help The script calls the php file without a problem when the submit key is hit. However, it doesnt post the form data with it. The HTML form <form id="image_form" name="image_form" method="POST" action="" ...

Broadcast-style IPC

Given all the options to have processes or threads interact with each other (locks, mutex, semaphores, message queues, shared memory, etc), I'm a bit lost about what's best to do what I want. I want several processes to wait for a certain event to happen. That is, I want them to block either until a certain timeout is reached, or a...

Get data from flash object, is it possible?

I use curl for grabing data from sites, but now i need to grab content from flash objects. i haven't any experience in flash, so could you tell me is it possible in general? if yes, what i need to learn for it? Thanks ...

Changing MySQL server timing for one website

I have one website which does not use US timings. Is it possible to change PHP and MySQL timings for one website? If so what do I need to do? ...

Drupal 6 - Get node->links in blocks

I want to display $node->links in a block, but node_load only loads the node object without the links. How do I get the links? ...

Will enabling XDebug on a production server make PHP slower ?

The title pretty much says it all...is it a bad idea ? I'd like to have the enhanced debug messages that XDebug provides on the server. [edit] Just to make things clear. I'm aware there are security risks involved. Perhaps I should complement my question and give more precise reasons why I would want to do this. Our production server h...

PHP, I18n and gettext not working properly?

Hey Guys, I'm currently internationalizing an existing PHP project and thought the easiest way to do this is by just integrating I18n + gettext. Currently I have a I18n.php: <?php setlocale(LC_ALL, 'de_DE.UTF-8'); bindtextdomain('cms', './locale'); textdomain('cms'); ?> Which is being included in every file that needs some transla...

to implement a advanced login functionality help needed

I'm developing a system with codeigniter, php and jquery these days, still in the login form, in my login scenario i have a advanced situation i think. i have different kinds of users in my system,this is a hospital system, first of all there is a person to register people, a person to search old records(files), a person to check eye si...

PHP language problem.

I have a php page that sends mails to a specific email with the data included in the form on this page. The mail has to be sent in the native language of the website (Arabic) but when I click the submit button on the form, the mail is received half readable (Arabic language) and the other part is unreadable (Symbols). I want to know how ...

Problems with utf8, php, and mysql

I'm fetching the JSON timeline from twitter and parsing it through PHP. I then want to store the text in my database. The PHP script is in UTF8, I set the header to utf8 using this code, just in case: header('Content-type: text/html; charset=UTF-8'); The table in the database uses utf8_general_ci, ... Not even encoding the text usin...

php renaming (unknown) uploaded file extension

hi guys i have to rename the (unknown) uploaded file extension from .MP3 to .zip please help I have been stuck with this for a few days now. Thanks in advance:) if (!copy($file, $newfile)) { echo "failed to copy $file...\n"; } $filename = "members/$id/music" . "/" . $_FILES["file"]["name"]; function replace_extension($filename, ...

Trouble using indexed arrays with preg_replace() PHP

Hi there. First time i post here and hope somebody will be able to help me. I have a file whos numbering starts at 610 and goes on to 1019. I want to use PHP's preg_match() function to start the numbering from 0 and go on till 410. Here is some code i've been working on. But i cant get the function to replace the numbers. I don't know ...

Rotating images using PHP and jQuery the fast way

I wrote a python script that rotates an image 90 degrees. I am including the python code in case you want to see it; #! /usr/bin/python # This Python file uses the following encoding: utf-8 #argv[1] needs to be send formatted meaning spaces and paranthesis ARE problems __author__="john" __date__ ="$Aug 17, 2010 1:48:36 PM$" server_d...