php

Add dynamic video content (YouTube like) (PHP)

I'm looking to setup video uploads for users on a site and want to have them viewed through a Flash player. The site is already partially built (by someone else) and I'm wondering what kind of technologies there are to deal with the video files, specifically in PHP. I'm thinking the files need to be converted to an FLV. After that I thi...

How to call c++ binary from Perl or PHP (CGI-BIN using Apache on Linux ) ?

I have a website cgi-bin program that is written in c++. Unfortunately the website provider for my friend's site only allows Perl or PHP cgi-bin scripts. Is there an easy way to simply have a very small Perl or PHP wrapper that just calls the c++ compiled binary? Would the c++ program still be able to read from stdin for POST comman...

can UPDATE clause in MYSQL using PHP update multiple records in one query?

well i have this messages table with sample values like these: msg_id recipient_id read locked new 0 1 N Y Y 2 1 Y N N ok, so lets just say this is a messaging table, and i want to reset all messages addressed to recipient with id=1 i was wondering why UPDATE `m...

Have you switched from CodeIgniter to Kohana?

Hi All, I usually just work with straight PHP, but want to try MVC and see if a framework will really speed up development. After much waffling, analysis paralysis, and many dumb SO questions, I thought I had settled on CodeIgniter for my next PHP project. However, I am now seriously considering Kohana. Has anyone made the switch fro...

PHP app using Twitter API works on some accounts, not others

I have this PHP script that I wrote to automatically follow users that post messages with certain terms. It works 100% of the time on a bunch of test accounts but then does not work on the account I'd like to use it with. I've checked the account's API rate limit and it's well within the boundaries. I've also verified that the userna...

Using loops to create arrays

I am extremely new at php and I was wondering if someone could help me use either a for or while loop to create an array 10 elements in length ...

Getting the name of a child class in the parent class (static context)

Hi everybody, I'm building an ORM library with reuse and simplicity in mind; everything goes fine except that I got stuck by a stupid inheritance limitation. Please consider the code below: class BaseModel { /* * Return an instance of a Model from the database. */ static public function get (/* varargs */) { //...

PHP MySQL SQL parser (INSERT and UPDATE)

I am looking to parse INSERT and UPDATE MySQL SQL queries in PHP to determine what changes where made from what original data. Now this would be pretty easy to create, but I want to see if there are any existing libraries in PHP to do this. Basically what I have is a table with all of the above queries that have been run on a database. ...

Best way to substitute variables in plain text using PHP

What's the best way to take some plain text (not PHP code) which contains PHP-style variables, and then substitute in the value of the variable. This is kinda hard to describe, so here's an example. // -- myFile.txt -- Mary had a little $pet. // -- parser.php -- $pet = "lamb"; // open myFile.txt and transform it such that... $newConten...

Add / Remove the word 'The' to specific countries

I've spent hours trying to get my code to work, its a rats nest of if/elses. Basically I want to check a country name against these two arrays: //if its in this array add a 'THE' $keywords = array("bahamas","island","kingdom","republic","maldives","netherlands", "isle of man","ivory","philippines","seychelles","usa...

Zend framework; Getting controller to use different viewer.

I am using the Zend Framework. I have a controller named 'UserController' that has a public function displayAction(). I would like to know how I can get that action method to use a different viewer than the default display.phtml. Any help is appreciated. ...

PHP replaces spaces with underlines

Hello, I have the problem, that PHP replaces all spaces with underlines in POST and GET variables. For example if I have the URL: http://localhost/proxy.php?user name=Max the browser will convert it to http://localhost/proxy.php?user%20name=Max. But if I give the $_GET parameters out, the key is not user name but user_name! Is there ...

Maximum number of cookies allowed

As far as Google searches tell me, the maximum allowed number of cookies depends very much on the browser, however I cannot find any recent data as to how much cookies are allowed on modern browsers. I need to store a somewhat large number of user preferences in cookies (for not-yet-registered users), so what would be the best way of do...

How to redirect to the requested URI after authentication using Zend_Auth?

Hi everyone, I am using a simple Zend_Auth setup to authenticate users for one of my applications, using a check in the preDispatch() method in a controller plugin. When anonymous users navigate to /users/view/id/6 for example, they should be redirected to the above URI after authentication. What is the best way to do this? I'd pre...

Distributing a small PHP application

I wrote a small PHP application that I'd like to distribute. I'm looking for best practices so that it can be installed on most webhosts with minimal hassle. Briefly: It's simple tool that lets people download files once they login with a password. So my questions are: 1) How should I handle configuration values? I'm not using a datab...

duplicate tags in nusoap

I'm using nusoap to connect to a soap webservice. The xml that the class sends to the service is constructed from an array, ie: $params = array("param1" => "value1", "param2" => "value1"); $client->call('HelloWorld', $params, 'namespace', 'SOAPAction'); This works fine. A multidimensional array also constructs a nice nested xml messag...

Why is doctrine returning more fields than I asked for?

I am messing around with Doctrine (version 1.0.3) to see if would make a good fit for the collection of apps I am writing. I am trying to do a query and return only 3 fields. I am getting the correct fields in one table, but the join table I am getting everything when I only want one field. I have written out the what the SQL should b...

What is the prefered method for a 'WSDL' for REST webservice?

I have build plenty of SOAP webservices, but am building a REST webservice for a specific project, and I was wondering what people used for a 'WSDL' for REST services or if it is even needed. ...

Php precision with floating point - complex equation = 1

I have the following equation 1 - ((.5 * 0.83333333333333) ^ 2 + (.5 * 0.83333333333333) ^ 2 + (.5 * (1 - 0.83333333333333)) ^ 2 + (.5 * (1 - 0.83333333333333)) ^ 2) In Php5, this results in an answer of 1 as opposed to .63 (on two machines, OSx and Centos). Should I be exclusively using the bc math functions of Php to do equations l...

Fatal error: Unsupported operand types in .. ?

Hi, The line where this error was called from is this: $celkova_suma=mysql_result($c_res, 0, 0)+mysql_result($d_res, 0, 0)-$zlava_suma+$arr[$_POST['sp_platby']]; Can someone tell me what I should be looking for?? ...