php

Amazon S3 interface with PHP?

I need to provide a utility on a PHP site for a client to upload files to an amazon S3 bucket. Are there any open source utilities available that I can use? ideally, this utility would allow the client to select a local file, press the upload button, and then would tell him the URL of the newly uploaded file. Bonus points if this can ...

Should I use mb_* or iconv_* functions for multibyte strings?

Hi there! As we all now, handling multibyte strings is not that easy in PHP. For example I want to get the length of the following string: ä strlen('ä'); // 2, because ä equals 2 bytes mb_strlen('ä', 'UTF-8'); // 1 iconv_strlen('ä', 'UTF-8'); // 1 Which functions should I use? The mb_* or iconv_*? Why? Considering that the encoding ...

PHP Directory Listing Code Malfunction

I tried to write a script to list all files in directories and subdirectories and so on.. The script works fine if I don't include the check to see whether any of the files are directories. The code doesn't generate errors but it generates a hundred lines of text saying "Directory Listing of ." instead of what I was expecting. Any idea w...

Connect to MySQL with hashed password?

Hi, I was wondering (and used Google with no clear result) if there is any way to connect to a MySQL database with PHP using a hashed password. Say I have the following: Password (plain): 'foobar' Password (sha1): '8843d7f92416211de9ebb963ff4ce28125932878' Now I would like to connect to MySQL like this (using the mysql_* function as ...

Apache: VirtualHost with [PHP|Python|Ruby] support

Hi there, I am experimenting with several languages (Python, Ruby...), and I would like to know if there is a way to optimize my Apache Server to load certain modules only in certain VirtualHost, for instance: http://myapp1 <- just with Ruby support http://myapp2 <- just with Python support http://myapp3 <- just with Php support ... ...

How to replace http:// or www with <a href.. in PHP

I've created this regex (www|http://)[^ ]+ that match every http://... or www.... but I dont know how to make preg_replace that would work, I've tried preg_replace('/((www|http://)[^ ]+)/', '<a href="\1">\1</a>', $str); but it doesn't work, the result is empty string. ...

Supply extra parameter to autocomplete according to Zend Framework

I have a form with (at least) the following two fields: country club The club is a field that is generated via the ZendX_JQuery_Form_Element_AutoComplete Element, that also generates the following javascript code: $("#club").autocomplete({"url":"\/mywebsite\/\/mycontroller\/autocomplete"}); I have a database of clubs per country. ...

Layering PHP Applications for other DBMS

I'm currently on my way to write a web application implementing the MVC and well reducing complex things. Yet I've been pondering for a few hours what to do for future database systems like Oracle, PostgreSQL, Firebird, etc. Then again to implement these adapters in the logic is what gets me, should I just trigger-happy it with tons of...

How do I execute a command contained within a variable in PHP?

Currently, I'm passing a command into a user-defined function in PHP. How do I have PHP execute this when I ask it to? ...

Highlight an item in Open Flash Chart 2

How can I highlight exactly one item (particularly a line on the x axis) in open flash chart 2? Note: Highlight can be a change of color or bold. ...

Url replacing

I'm trying to make some nice urls. CREATE TABLE IF NOT EXISTS `games` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `title` varchar(200) DEFAULT NULL, `about` text, `release_date` int(10) NOT NULL DEFAULT '0' php $id = str_replace('_', ' ', $_GET['title']); $query = mysql_query("SELECT * FROM games WHERE title = '$id'"); $row = my...

UTF-8 Problem, no Idea

Hi, I have a strange problem with some documents on my webpage. My data is stored in a MYSQL Database, UTF8 encoded. If read the values my webbpage displays Rezept : Gem�se mal anders (Gem�selaibchen) I need ü / ü! Content in the database is "Gemüse ... " .. The raw data in my error_log looks like this [title] => Rezept...

how to get the values of the radio button which has been checked , jquery

hi ,, can we get the values of the radio buttons , only those which has been checked , cause i have to implement a form in which there are many radio buttons , so how can i get all the values which has been checked what i have to do is i have 13 subjects like : physics , math , biology ..... and the students can choose any number of...

re-indexing a search engine every few minutes

Hi, I'm running a search service on my development computer, and I have to run an indexer (.exe file) and restart a service every 1-5 minutes (I'm using sphinx search). How would I go about doing this in Windows? My thought is to run a batch file through windows task scheduler, but what do you do? ...

PHP - split a string of HTML attributes into an indexed array

Hi, I've got a string with HTML attributes: $attribs = ' id= "header " class = "foo bar" style ="background-color:#fff; color: red; "'; How to transform that string into an indexed array, like: array( 'id' => 'header', 'class' => array('foo', 'bar'), 'style' => array( 'background-color' => '#fff', 'color' => 'red' ...

How can I let the vistors publish a post in wordpress ?

hi How can I let the visitors publish a post without registration in wordpress ? Any programming modifications suggestions ? ...

Zend Sessions problem with IE8

I'm running a Zend Framework powered website and it seems to have serious problems with sessions. I have a 5 step process where I save the form data in the session between the steps and then save it into the database on the last step. When we built the site sometimes the session just went away and forced us to restart. Now it seems to w...

Help in PHP Regx

Using PHP Regx, I need to make the user input arabic,english,digits and the following characters(_ and - and space) user can input string as the following: 10-abc 10-من 10-abcمن _abcمن-10 and so on. Advice me please. ...

How to find out programmatically if a web server instance supports url rewrite.

Hello, This would be my first question on SO, so please be gentle with me. What I want to ask is if there is a way to find out if a web-server instance has URL Rewriting enabled. I need this in order to be able to instantiate the correct type of URL handler. Theoretically you know in advance if you have it enabled or not and can us...

cross domain cookies

Hi, I have a small problem, how do I set a cookie for multiple domains? I do understand the security problems, and I am sure it has been done before. The reason for this is SSO. ie. account.domain.com will need to set domain logged in for: domain.com domain1.com domain2.com Is there any easy way, using PHP and cookies, or any alte...