I am using the core Auth component. I have created a user login that manages all of the permissions. The way I am implementing the login monitoring is by checking for $this->Auth->user() in the app_controller. Each time the app_controller cycles the beforeFilter() function and !$this->Auth->user(), it will increment the Captcha.LoginAtte...
I've heard many places that PHP's eval function is often not the answer. In light of PHP 5.3's LSB and closures we're running out of reasons to depend on eval or create_function.
Is there is any conceivable cases where eval is the best (only?) answer in PHP 5.3?
This question is not about whether eval is evil in general, as it obviousl...
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
...
I have this line in one of my scripts and its throwing a deprecated error.
eregi_replace( '\.([a-z]{3,4})$', "-{$width}x{$height}.\\1", $src );
Can someone show me how to turn this into preg_replace and tell me why and which bits of it need to change so I can learn for future changes? I have had a go myself but where this bit of code...
are there build in functions in latest versions of php specially designed to aid in this task ?
...
Inorder to split the string i have used the following code.
$string = "-sev*yes-sev1*no-sev2*yes";
split('[-*]', $string).
As split is deprecated, can you please suggest an alternative to split the string into an array. I have tried with explode, but it is not serving my purpose.
The output should look like,
Array
(
[0] => sev
...
With PHP is it even Possible to Pass arrays by Reference ? or its a Bug Only for Me.
class MyStack{
private $_storage = array();
public function push(&$elem){//See I am Storing References. Not Copy
$this->_storage[] = $elem;
}
public function pop(){
return array_pop($this->_storage);
}
publi...
Hello.
Using latest php in order to create a function that adds a row to table user.
class targil_db {
private $_pdo;
public function __construct() {
// username: root password: <blank> database: targil
$this->_pdo = new PDO(
'mysql:host=127.0.0.1;dbname=targil',
'root',
...
example if i have
follow table
company one ( cid = 1 ) following two ( cid = 2 )
company one ( cid = 1 ) following three( cid = 3 )
feeds table
company one ( cid = 1 ) type 'product' description 'hello ive updated a product';
company two ( cid = 2 ) type 'product' description 'hello ive updated a product im from company 2';
company ...
I have just upgraded from php 5.1 to 5.3 and had previously been using cakephp 1.1 on my server. Since the upgrade (or possibly earlier, I can't be sure), I'm getting the following errors. Can anyone shed some light:
Deprecated: Assigning the return value of new by reference is deprecated in /home/vhosts/bbblh.co.uk/httpdocs/cake/dispat...
The PHP manual for split() says
This function has been DEPRECATED as
of PHP 5.3.0. Relying on this feature
is highly discouraged...Use explode()
instead.
But I can't find a difference between split() and explode(). join() hasn't been deprecated, so what gives?
...
Hey everyone,
I have had a slight problem with autoloading in my namespace. As shown on the PHP manual here: http://us.php.net/manual/en/language.namespaces.rules.php you should be able to autoload namespace functions with a full qualified name e.g. \glue\common\is_email().
Thing is I have a function spl_autoload_register(array($import...
Hello.
I created an ErrorController using the zend framework tool,
what I don't understand is how do i actually use it?
I want instead of throwing an Exception that will shown on the screen, to throw an error
that will be shown in the Error Controller.
using Zend Framework v1.10.7
any ideas?
thanks
...
On my development machine my application used up about 4-6MB of memory per request. After switching to a production machine those numbers went as high as 21+MB per request, without any speed improvement (0.30 - 1.2 seconds, which I really hoped to improve on my production machine). Some portions of application (like database bootstrappin...
I have the following line of code which worked in PHP 5.1, but isn't working in PHP 5.3.
$input = array('ss','john','programmer');
call_user_func_array(array($mysqli_stmt, 'bind_param'), $input);
In PHP 5.3, I get the following warning message:
Warning: Parameter 2 to mysqli_stmt::bind_param() expected to be a reference, value given ...
Hi,
I'm trying to recompile PHP 5.3.3 on mac os snow leopard with iconv and getting the following error:
Undefined symbols:
"_libiconv_open", referenced from:
_php_iconv_string in iconv.o
__php_iconv_strlen in iconv.o
__php_iconv_substr in iconv.o
__php_iconv_substr in iconv.o
__php_iconv_strpos in iconv...
For my project I wrote a small config class that loads its data from a .ini file. It overwrites the magic __get() method in order to provide simplified access to the (read only) config values.
Example config.ini.php:
;<?php exit; ?>
[General]
auth = 1
user = "halfdan"
[Database]
host = "127.0.0.1"
My config class (singleton pattern...
Hi,
I have a requirement where I need to work my login form logic using a csv file. 'A' column in csv file has all Usernames and 'T' column has website names. Now the user logs in by typing in their usernames, and depending on that I have to redirect them to the website entered in column T. How will I use php to accompalish this?
A ...
Hi,
I am using a csv file to authenticate user login. Is it possible to password protect the CSV file? I do not want anybody to be able to download the csv file through url. I googled and I found out that it is not possible to password protect a csv file. Is there any other way I can password protect the file?
...
I am currently hosting my site on my computer on WAMP, however I am looking to take it live. The problem is that it uses both CodeIgniter and PHP 5.3. It will not however, draw very much in the way of traffic to start. Is there some way I can get greater control of my server (so that I can use 5.3 and CI) without having to pay the expens...