php

Cakephp inflection, how to change a plural to a singular.

Hi, I have a controller called "Shops", this is the way the routing system looks for it, however I want to be able to called this controller and what not 'shop'. Is it possible to do this. Cheers! ...

osCommerce Redirecting To Credit Card Step on Confirmation Page

Previously I had an issue where the SSL Cert was not working properly but that had been taking care of. However, the current issue is as follows: Click Item to put in basket -- Success Step 1 - Select Delivery -- Success Step 2 - Enter valid CC# (using authorize.net test cc#) -- Success Step 3 - Order Confirmation .. Shows me my ord...

Only variables can be passed by reference

I had the bright idea of using a custom error handler which led me down a rabbit hole. Following code gives (with and without custom error handler): Fatal error: Only variables can be passed by reference function foo(){ $b=array_pop(array("a","b","c")); return $b; } print_r(foo()); Following code gives (only with a custom err...

UTF-8 BOM in php response to mootools xmlhttprequest

Hi, I'm writing my first little AJAX-enabled Joomla component. I'm using mootools. I got a xmlhttprequest to contact my Joomla component, and the component returns a response - just plain text echoed by php, like echo 'Hello World!'; It's all working fine, except wireshark tells me that the response is prepended with \357\273\277\35...

What's the best way to add i18n to a web application?

I'm looking to i18n-ize a web app. The site will be constantly changing: text will be rewritten, new stuff added etc. The web app is written in PHP, but the same applies to any language. Basically I want: 1) The code to be readable and maintainable 2) Translators to be sent an email when new stuff is added in English OR the English is...

Zend_DB union() : Zend_Db_Table_Abstract vs Zend_Db_Table::getDefaultAdapter()

So i have this raw SQL that i want to call via the zend framework select t.type, t.tid,t.tname,t.cid,t.cname, ls.* from ( select t.type, t.id as tid, t.name as tname, c.id as cid, c.name as cname from team t join company c on t.parent=c.id and t.type='C' and c.sector=20 and t.status='ACTIVE' union select t.ty...

PHP Session var through AJAX problem

Hi, is it possible to define a PHP Session var through AJAX? I'm doing it in the background of a script and it seems to be kind of random. ...

How to make a user access security certificate.

I have a web application that I would like to allow persistent access to that is not dependent on the browser cookie system. Is there something that will allow me to, upon the first user authentication, send the browser a certificate which the app can check for periodically or upon future returns to the site? Maybe some take on an SSL? ...

How to make a CodeIgniter project portable with redirects

I would like to set up my codeigniter projects so I can use it in any folder on my webserver. Unfortunately codeigniter requires me to specify the location in several variables of the config. This is a problem for portability. There are 3 places where I see this: 1) $config['base_url'] 2) $config['base_path'] 3) .htaccess RewriteRule...

Is there any Example of PHP user to user chat on sockets?

Is there any Example of PHP user to user chat on sockets? ...

Replace the content of a tag with a certain class

I am looking for suitable replacement code that allows me replace the content inside of any HTML tag that has a certain class e.g. $class = "blah"; $content = "new content"; $html = '<div class="blah">hello world</div>'; // code to replace, $html now looks like: // <div class="blah">new content</div> Bare in mind that: It wont nece...

Issue with 'selected' value within form

I currently have a form built in which after validation, if errors exist, the data stays on screen for the consumer to correct. An example of how this works for say the 'Year of Birth' is: <select name="DOB3"> <option value="">Year</option> <?php for ($i=date('Y'); $i>=1900; $i--) { echo "<option value='$i'"; i...

How to open PHP socket onto some URL? (like www.ex.com:8080/mySock/)

How to open PHP socket onto some URL? (like www.ex.com:8080/mySock/) I want to send user to a user Chart Room 1 if ho goes to www.ex.com:8080/mySock/Chart1 and www.ex.com:8080/mySock/Chart2 to some other chart room if he goes into another (live php multy useres chart on sockets (Flash backend)) ...

How to use two sessions for one user in codeigniter ?

I am using the cart class for a shoping cart. Now I want to use the Simplelogin library, but the cart session is erased when I login. How can this be solved ? It is possible to use two sessions for one user ? Or maybe merge all in the same session ? ...

Getting the correct headers automatically given a filetype in PHP...

Sorry - looks like this is a duplicate of: http://stackoverflow.com/questions/1232769/how-to-get-the-content-type-of-a-file-in-php A few times I've run into situations where I'd like to be able to include a file using PHP, and depending on the included filetype, output the appropriate headers. In the past I've just done this manually ...

For securing forms, when do I issue the token?

So, I have a form, to make it a little more secure and potentially help prevent CSRF attacks I want to add a random token value in a hidden field that value is also stored server side in my session data. When should I issue a new token? Per form? Per page load where there is any form? Per session? I can render it invalid as soon as a fo...

It ok for AJAX to take place over non-SSL?

Say I have an https page can I make ajax calls to non SSL without getting warnings in browsers? I want to do it for non sensitive data so its faster ...

How to write a regular expression for "everything between X and Y" for use with preg_replace

I want to take a variable called $encoded_str and and remove cd1, CD1 and anything between the first 'l' and the last blank space. So for example "lp6 id4 STRINGcd1" would return "STRING". I'm using PHP 4 for now so I can't use str_ireplace, I have this: $encoded_str=str_replace('CD1','',$encoded_str); $encoded_str=str_replace('cd1',''...

C# to php translator

Is there a C# to php translator (capable of dealing with byte operations, TCPSockets)? ...

Is there an event for customer account registration in Magento?

I would like to be able to run some functionality with a module that I am building whenever a customer registers an account, but I can't seem to find any events that are fired upon a new customer registration. Does anybody know of an event that is dispatched for that? ...