Spiga

‘ Uncategorized ’ category archive

how to recover a passwords stored behind the asterisks

October 26, 08 by Gabi Solomon

If you are like me and have a lot of accounts that have many usernames and passwords, then you are likely to use the save password option quite a lot. But what happens if you would like to see that password again, maybe to use it elsewhere ?

That happend to me just the other day, i had some FTP passwords stored in a FTP client, and now that i switched to a new one, i couldnt remember it.

The solution

I finaly found a spyware free and open software that can do just that, show you the passwords behind asterisks. Its called Password Spectator and is available for download here cand can see a demo clip of it in action here.

How to update your profile on social networks and other websites ?

August 11, 08 by Gabi Solomon

A while ago i wrote about a cool new way to update your status on various networks called ping.fm, well today i have a new service to recommend to you guys to update the profile data this time.

During this time we tend to create a lot of profiles / accounts all other the place, either being social networks like myspace or hi5, or maybe jobsites. The problem for is that i dont have time to update them all .. and lets face it even if i wanted to it would take ages to update them all the time. But i would like to keep all of them updated just in case someone is viewing my profile to have the latest information and “version” of my profile, wouldn’t like for him to be seeing information 2 years old, especially on job sites.

Well i found a website that helps me to update all of this services. At Atomkeep, you can solve the problem of information redundancy. Atomkeep will keep your accounts in sync on all social networks, job boards and other sites.

We’ll make sure that your profiles are up to date everywhere with one click of a button. We’ll make sure that your resume is recent on all job boards that you are signed into. We’ll make sure that your potential clients will always get your actual contacts and will find you easily.

We know that it’s hard to manage a lot of data. And we also know that problems tend to increase as information network grows up. As far as our team is 100% committed to user satisfaction, that’s why we have decided to build something that really solves user problems. We are solving the problem of information redundancy.

It doesn’t matter how many accounts or profiles that you have. Atomkeep is the only place that you need to keep them in sync. We don’t force other sites to partner with us, although, we would appreciate any partnership opportunities. All we do is making your life easier. Atomkeep is completely user oriented product.

How to upload & resize images in PHP with thumb creation

August 02, 08 by Gabi Solomon

Many times in my coding projects i had to do an upload form that will upload an image. This by it self is not so hard to do, and i bet many of you can write the code in under a minute :) ). But as we all know webspace is not free ( excluding free hosting ) and certainly not unlimited, so we must try and make the best use out of it and most of the time you will need to resize the images uploaded to a certain size, and maybe even make a thumb image.

This where the fun starts, every coder has his own methods of dealing with image resizing, as do I :D .
I came across a class on phpclasses.org called class.upload.php and fall in love with it :) ).

It is the ideal class to quickly integrate file upload and image manipulation in your site. That's all you need for a gallery script for instance.

It manages the uploaded file and allows you to do whatever you want with the file as many times as you want. If the file is an image, you can convert and resize it, rotate it, crop it in many ways; You can also add borders, frames, bevels, add of text labels and watermarks or apply graphic filters such as contrast or brightness correction, colorization, negative, threshold, greyscale, reflections and more. Transparency and true color are fully supported. JPEG, PNG, GIF and BMP are supported.

Security features and file management functions are provided. The class can also work on local files, which is useful for batch processing images online, and can circumvent open_basedir restrictions. Uploaded files can also be output directly to the browser.

The class is mature and well documented, already widely used around the world. From version 0.25, the class is fully internationalized. It is also compatible with PHP 4 and 5.

Example of usuage

PHP:
  1. $foo = new Upload($_FILES['form_field']);
  2. if ($foo->uploaded) {
  3.   // save uploaded image with no changes
  4.   $foo->Process('/home/user/files/');
  5.   if ($foo->processed) {
  6.     echo 'original image copied';
  7.   } else {
  8.     echo 'error : ' . $foo->error;
  9.   }
  10.   // save uploaded image with a new name
  11.   $foo->file_new_name_body = 'foo';
  12.   $foo->Process('/home/user/files/');
  13.   if ($foo->processed) {
  14.     echo 'image renamed "foo" copied';
  15.   } else {
  16.     echo 'error : ' . $foo->error;
  17.   }
  18.   // save uploaded image with a new name,
  19.   // resized to 100px wide
  20.   $foo->file_new_name_body = 'image_resized';
  21.   $foo->image_resize = true;
  22.   $foo->image_convert = gif;
  23.   $foo->image_x = 100;
  24.   $foo->image_ratio_y = true;
  25.   $foo->Process('/home/user/files/');
  26.   if ($foo->processed) {
  27.     echo 'image renamed, resized x=100
  28.           and converted to GIF';
  29.     $foo->Clean();
  30.   } else {
  31.     echo 'error : ' . $foo->error;
  32.   }
  33. }

Small problems i had with this class

Even though it is a great class that i use every time i need to do an upload, i had a few problems with it, and have toke me a while to solve. As a suggestion for debug do a print of "$foo->log" variable to see what happened during the preparation of the image.

1. Handling uploads from flash uploader

It took me a while to solve this one, since images uploaded with flash were not being re sized, but after a some debugging and searching i managed to figure out the cause: the mime type for the file was application/octet-stream so the class didnt treat it as an image.
Solution:
You can find it on the class forum

2. Handling very large images

This one really put me to the test, every time i uploaded an image that was large ( above 1,5 Mb ) it just show an empty page, not an error ... nothing. Couldn't figure it out. I looked in the php error log ... nothing. After like 2 hours of almost throwing my monitor out the window i managed to find a solution. It was because of the server, more exactly the memory limit. During the processing of large images, the script would use a lot of memory which would cause the script to stop once it reached the limit with no error message.
Solution:
Add this in your script:
ini_set ( "memory_limit", "40M")

Or in a .htaccess file:
php_value memory_limit 40M

That is it i dindt had any more troubles with this class, it is a pretty stable class witch didnt gave me to much trouble.

I hope you will enjoy it too.
Cheers.

How to Reload the Page With JavaScript

June 08, 08 by Gabi Solomon

There are a few ways you can reload a page with javascript. I will post them all below, and for demonstration i will put them as button onclick action.

Using location.reload

HTML:
  1. <input onclick="window.location.reload()" type="button" value="Reload Page" />

Using history method

HTML:
  1. <input onclick="history.go(0)" type="button" value="Reload Page" />

Using location.href

HTML:
  1. <input onclick="window.location.href=window.location.href" type="button" value="Reload Page" />