Simply Program

Simply programming - It’s a life style

Archive for May, 2008...

Filed under Annoucements

TutorialMachine.com has finally launched, time to start loading Tutorials from photoshop to css design.

Comments (0) Posted by sp on Monday, May 26th, 2008

Filed under Programming, Javascript

Please review this great example by Dav Glass:

http://blog.davglass.com/files/yui/animseq/

Comments (0) Posted by sp on Saturday, May 24th, 2008

Filed under Programming, Javascript

Just an example.

CODE:
  1. /**
  2. * Collects all inner elements and resizes accordingly.
  3. * @method resizeAll
  4. */
  5. this.resizeAll = function () {
  6. var tempEL = el;
  7. var tempObj = tempEL.getElementsByTagName("img");
  8. for(i=0;i<tempObj.length;i++){
  9. var tempAnimation = new YAHOO.util.Anim(tempObj[i].getAttribute("id"), this.attributes, this.duration, this.method);
  10. tempAnimation.animate();
  11. }
  12. var tempObj = tempEL.getElementsByTagName("input");
  13. for(i=0;i<tempObj.length;i++){
  14. var tempAnimation = new YAHOO.util.Anim(tempObj[i].getAttribute("id"), this.attributes, this.duration, this.method);
  15. tempAnimation.animate();
  16. }
  17.  
  18. }

Comments (0) Posted by sp on Friday, May 23rd, 2008

Filed under Programming, Server

I am always on the lookout for a nice simple htpasswd generator and I found a pretty nice one.

http://www.htaccesstools.com/htpasswd-generator/

Enjoy!

Comments (0) Posted by sp on Thursday, May 22nd, 2008

Filed under Programming, PHP

Hey all,

So how can you read a user who just logged in with htacess?

CODE:
  1. $auth_username = $_SERVER['REMOTE_USER']

Make sure you have it right by checking phpinfo().

Comments (0) Posted by sp on Monday, May 12th, 2008

Filed under Programming, PHP

My problem - when a user logged into my website and then went to my "blog" area (which did not require any logging in) Wordpress would removed all the sessions I had set.

Why did it do this?

If we open wp-settings.php the first few lines of code completely remove all session information (as well as other).

CODE:
  1. function wp_unregister_GLOBALS() {
  2. if ( !ini_get('register_globals') )
  3. return;
  4.  
  5. if ( isset($_REQUEST['GLOBALS']) )
  6. die('GLOBALS overwrite attempt detected');
  7.  
  8. // Variables that shouldn't be unset
  9. $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
  10.  
  11. $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset($_SESSION) && is_array($_SESSION) ? $_SESSION : array());
  12. foreach ( $input as $k => $v )
  13. if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) {
  14. $GLOBALS[$k] = NULL;
  15. unset($GLOBALS[$k]);
  16. }
  17. }

To fix this issue I did the following:

CODE:
  1. function wp_unregister_GLOBALS() {
  2. if ( !ini_get('register_globals') )
  3. return;
  4.  
  5. if ( isset($_REQUEST['GLOBALS']) )
  6. die('GLOBALS overwrite attempt detected');
  7.  
  8. // Variables that shouldn't be unset
  9. $noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix','_SESSION');
  10.  
  11. $input = array_merge($_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES);
  12. foreach ( $input as $k => $v )
  13. if ( !in_array($k, $noUnset) && isset($GLOBALS[$k]) ) {
  14. $GLOBALS[$k] = NULL;
  15. unset($GLOBALS[$k]);
  16. }
  17. }

Comments (0) Posted by sp on Thursday, May 8th, 2008