php

Framework for administrating users

I'm looking for a framework I can use in my new webproject. The main concern for me is handling my users, therefore I'm on the lookout for a framwork that can handle them for me. I develop in PHP, so preferably that's the language it should use. I would like the framework to take care of new users signing up and I would also like it to ...

Is there something like Acegi for PHP?

In Java world, Acegi is a powerful security framework based on Spring that allows you to simply manage authentication and authorization. AFAIU, it supports OpenID, and Facebook Connect, LDAP, NTLM, Kerberos, etc. via Grails. If you are interested how it works, take a look at diagrams in this tutorial Anyway, this is all cool, but I'm de...

Converting a frozen production symfony project back to development project

Hey there! I need some advice on going about converting a production version of a symfony project which is in frozen state back to a development state so I can work on the project locally. I need to do this because I'm having to download the latest working copy from the server down onto my personal macbook so that I can work on some fil...

PHP and FFMPEG - Performing intelligent video conversion

I have an oddly difficult task to perform. I thought it would be easy, but all my efforts have been fruitless. I'm converting videos uploaded to a php script from various formats (.avi, .mpg, .wmv, .mov, etc.) to a single .flv format. The conversion is working great but what I'm having trouble with is the resolution of the videos. Th...

Are objects in PHP passed by value or reference?

In this code: <?php class Foo { var $value; function foo($value) { $this->setValue($value); } function setValue($value) { $this->value=$value; } } class Bar { var $foos=array(); function Bar() { for ($x=1; $x<=10; $x++) { $this->foos[$x]=new Foo("Foo...

Condensing this code

I have the following code I want to run, but the problem is $this->type is set when the class is created by specifying either petition, proposal, or amendment. As you can see my $sql statement is a UNION of all three, and I want to specify which table (pet,prop,or amend) each row of data comes from. public function userProposals() { ...

Multilingual php class - shortcut function.

Good evening, In my app that I'm currently developing, I have a class that handles multilinguism. It does so by externally loading an associative array, where a translation source would be defined something like this: 'Source input' => 'Zdroj vstupního' Currently this works flawlessly by addressing and using the class the following w...

How can I make sure one thing matches, and one doesn't, in a single regex?

This is simple, but I am taking an entire directory listing (in PHP with dir()), and making sure it both: isn't "." or "..", and ends in a file extension .jpg, .jpeg, .gif, or .png. Right now I have function isValidFile($filename) { $dirDotExpr = "/^\.{1,2}$/"; //matches against "." and ".." $extExpr = "/\.(jpg|jpeg|gif|png)...

PHP - remove <img> tag from string

Hey, I need to delete all images from a string and I just can't find the right way to do it. Here is what I tryed, but it doesn't work: preg_replace("/<img[^>]+\>/i", "(image) ", $content); echo $content; Any ideas? ...

use string in a $_COOKIE[] ?

so is there any way to do it. i want to put a string as the cookie name instead of a definite cookie name? ...

Optional parameters with PHP SoapClient class on wsdl mode

With the SoapClient class on PHP5.x and working against a SOAP web service that has optional parameters in its methods, you won't have any problem if you use the non-wsdl mode. But, at least by default, with the wsdl mode, if you don't fill all the parameters you will get an error like: SOAP-ERROR: Encoding: object hasn't 'xxx' property...

PHP cli Memory usage optimization

Hello I am trying to code a custom url_rewriter for squid. & also with using some other url_rewriter programs like squidGuard so have to use a wrapper to able use both or any other program. when i try to loop with php. (that's the way how squid communicates with external programs. STDIN/STDOUT. it gives you a url & you have to sen...

Doctrine_RawSql custom Select

I having problems to generate a doctrine_rawsql with a custom select. this is my rawsql $distance = glength(linestringfromwkb(linestring(asbinary(GeomFromText('POINT( FLOAT('30') FLOAT('-3')),asbinary({l.point})))) as distance $q->select($distance) ->from('place p INNER JOIN location l ON p.location_id = l.id') ...

Php redirection of a form with search query term between url

Hi! I'm using PHP in order to redirect some search query. There is some example of code here (click). And my PHP code is: audio_action.php : <?php $search_field = trim($_POST['audio_field']); $search_engine = trim($_POST['audio']); $url_params = preg_replace('/(\ )+/', '+', $search_field); $url = array('deezer'=>'http://www.deezer.co...

how to put two function together

I want to write a function to make user click the table header double click and change into descending or ascending order, and I have finished the sorting function, but don't know how to put together, now I just put one of them into the header as following: function sortBy(sKey) { document.sortResultsForm.sSortBy.value=sKey; docum...

Custom PHP Event Calendar Help

Hi, I'm making a custom event calendar with PHP. I am trying to get the current day box to show up white, to let the user know that's the current day. I have all the <td> boxes with an id of row-calendar-cell and I want a way to detect that the certain box is the current day and to change the id to current-day. Any help on that? Also,...

Will the save method in a Cakephp model class choose between creating and updating a record?

Basically, I want to achieve the same thing as ON DUPLICATE KEY in MySQL. Here's a contrived example: $rec = array('Foo' => array( 'id' => 999, // Assume there isn't already a record with this id 'website' => 'google' )); $this->Foo->save($rec); // save with different 'website' value $rec['Foo']['website'] = 'stackoverflow'; $th...

101 connections to self error

Hi, my site keeps going down on my shared hosting account and this is what my host said: It appears that the IP address of your site is being blocked on the firewall due to your site causing excessive connections to itself. "101 connections to self" Anyone know what this means, i've never heard of a 101 error before. My...

Setting up multiple mysql databases

I have a Mysql/ PHP application. I want to sell it SAS. I am thinking of a hosting company that has multiple databases available. I want a page were they login and I take them to their database. I will have many databases with identical structure. I need a way to switch them into that folder( I may modify some code for them like css) and...

PHP - Script Execution Speed Command Line vs In Browser

I have a PHP script that makes a few calculations and SQLite3 queries/transactions using PDO. Its both hosted and tested on my laptop running a windows/nginx/fastcgi php5.2 server. I ran it both in the console and in the browser, and to my surprise, the console version took 78 seconds while it took firefox only 55 seconds to finish. Si...