Warning: base64_decode() has been disabled for security reasons in /home/entroduc/public_html/wp-content/plugins/easy-adsenser/easy-adsenser.php on line 44
php archive at entroducing.com

Archive for the 'php' Category



27
Dec

Symfony error : Call to undefined method myUser::setReferer.

If you have this error

Call to undefined method myUser::setReferer.

and if you are using sfGuard plugin, go to

apps\[project]\lib\myUser.class.php

and change


class myUser extends sfBasicSecurityUser
{
}

to


class myUser extends sfGuardSecurityUser
{
}
VN:F [1.9.15_1155]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.15_1155]
Rating: +1 (from 1 vote)
23
Oct

You are not allowed to access this file. Check frontend_dev.php for more information.

If you had deployed to production/LIVE environment and encounter this error message when you tried to access fontend_dev.php, it is due to a security IP check in fontend_dev.php to check for 127.0.0.1 before it continue.

Thus, you need to add your public IP address in fontend_dev.php to tell symfony to let you through in the production environment. Here’s how to do it

In your fontend_dev.php file, put in the below line to print out your public ip address

echo $_SERVER['REMOTE_ADDR']. "<br/>"

Access frontend_dev.php and copy the IP address as shown.

Edit frontend_dev.php and change the line

if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1')))

to

if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1', '111.222.333.444')))

Where 111.222.333.444 is the IP address you copied.

Upload back the frontend_dev.php and try again

VN:F [1.9.15_1155]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.15_1155]
Rating: +1 (from 1 vote)
30
Sep

building new app with symfony : week 1

Going to build a new photography website which will be maintain by my friend and myself.

Am looking at the current popular PHP frameworks which need to fufil the following requirement

  1. rapid development
  2. easy maintainance
  3. user account management
  4. file upload
  5. able to integrate easily with image manipulation library (GD lib)
  6. Suitable for a shared-hosting environment

Currently shortlisted

  1. CakePHP (which I have some experience with version 1.2)
  2. Symfony

Had do some googling and below are the pros and cons for each frameworks

CakePHP

Pro

  1. easy to code
  2. built in security access
  3. access of data via arrays

Cons

  1. Quite new as compare to Symony
  2. No (or little?) test functionality?

Symfony

Pros

  1. able to build an enterprise app (otherwise why would yahoo use it?)
  2. access of data via propel or doctrine (i.e. object oriented) as they are well supported
  3. Able to reload data easily
  4. Able to create test cases

Cons

  1. steep learning curve
  2. Complicated?

I decided to give myself a week to learn Syfmony before I decide which framework to use.

VN:F [1.9.15_1155]
Rating: 8.0/10 (1 vote cast)
VN:F [1.9.15_1155]
Rating: +1 (from 1 vote)
22
Nov

Array sorting problem posted from hardwarezone

Saw this challenging question posted in the hardwarezone forum on sorting an array with one for loop without using array list.

The question is


This is a simple programming question...very simple and short question, but its really hard to solve..
Anyone who could do it, you are god of programming. 

 Given an array of random numbers let say..

 arrayX = {15, 20, 35, 45, 10, 40, 1, 3, 45};You are supposed to use ONLY ONE loop to swap the above into the following:
 arrayX = {15, 20, 3, 1, 10, 40, 45, 35, 45};

 NOTE: The purpose of your loop is to move all digits < 25 from the right hand side to the left side, and move all digits >= 25 to the right side. You can't sort the array but to use a single loop to scan the array from left and scan the array from right...and do the necessary swapping.

 You can try do it with C, C++...etc..
 Not easy as it seems to be!

Since the night is still young, I took some time to sit down and figure out the solution.

Continue reading ‘Array sorting problem posted from hardwarezone’

VN:F [1.9.15_1155]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.15_1155]
Rating: 0 (from 0 votes)