Sunday, January 12, 2014

How to Upload Large Files in PHP

One of the most popular uses is image uploads. Your users can submit photographs from a form without resorting to FTP or other convoluted methods. HTML5 and Flash also permit drag and drop, so the operation is likely to become easier as browsers evolve.
This is where the problems can begin. Camera manufacturers continually brag that they have a larger set of megapixels than their competitors. It’s all rubbish, of course — unless you’re a professional photographer or need to print extremely large images, anything over 4MP is fairly pointless and lens quality is much more important. However, even low-end compacts have 12MP and mobile phones have more than 5MP. The result is that a typical snapshot can easily be 6MB in size.
By default, PHP permits a maximum file upload of 2MB. You can ask users to resize their images before uploading but let’s face it: they won’t. Fortunately, we can increase the limit when necessary.
Two PHP configuration options control the maximum upload size: upload_max_filesize andpost_max_size. Both can be set to, say, “10M” for 10 megabyte file sizes.
However, you also need to consider the time it takes to complete an upload. PHP scripts normally time-out after 30 seconds, but a 10MB file would take at least 3 minutes to upload on a healthy broadband connection (remember that upload speeds are typically five times slower than download speeds). In addition, manipulating or saving an uploaded image may also cause script time-outs. We therefore need to set PHP’s max_input_time and max_execution_time to something like 300 (5 minutes specified in seconds).
These options can be set in your server’s php.ini configuration file so that they apply to all your applications. Alternatively, if you’re using Apache, you can configure the settings in your application’s.htaccess file:

php_value upload_max_filesize 10M
php_value post_max_size 10M
php_value max_input_time 300
php_value max_execution_time 300

Sunday, October 27, 2013

How to create google app engine

Go to the link https://code.google.com/apis/console
 Login with your gamil account
 Click on create project
 Select following services
Google calendar API, google+ API
 Rename your project to PWAME
 Click on API Access from left panel
 Create an OAuth client ID
 Give your site information.

Use app ID and app secret in your APP.

Wednesday, October 23, 2013

Face book developer: How to get permanent Access Token

Hit to this URL and get Access token.

https://graph.facebook.com/oauth/access_token?client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET&grant_type=client_credentials

Sunday, October 13, 2013

How to remove index.php? from url in Codeigniter 2 or upper version

Go to system->config file
Line # 207(site url method )
change '?' to only ' '

and Null index file of config.

Wednesday, July 3, 2013

How to make your laptop as a hotspot (Wireless router)

 Before we begin, you should make sure that you've got a laptop or desktop with a wireless card that isn't currently connected—if your laptop is connected to the wired network, your wireless card should be free, and we can use it to allow access to the internet. Note that you have to be plugged into a wired connection in order to share the connection wirelessly with others, or have a second wireless card. Readers should also note that this won't work on (some) work networks that use group policies to enforce TPS report cover sheet boredom and prevent you from having any fun at all.
Turn Your Windows PC Into a Wireless Hotspot
You'll want to start out by heading into the Network and Sharing Center through the Control Panel, or you can quickly get to it by right-clicking on the network icon in the system tray. Once you are there, find the link for "Set up a new connection or network".
You'll be prompted with a wizard that allows you to connect to VPNs, dial-up, or create a new ad hoc wireless network, which is what we want to do. You can easily use an ad hoc network to share files back and forth between two computers, but today we'll be using it for sharing the internet connection.
Turn Your Windows PC Into a Wireless Hotspot
You'll need to give your network a name and choose some security options—remember that WEP is extremely easy to crack—and you'll want to make sure to use at least a decent sized key even for WPA2. The really important option on this page is to remember to check the box for "Save this network".
Turn Your Windows PC Into a Wireless Hotspot
At this point your ad hoc network should be running and ready to start connecting your devices, but you'll want to hold off just a minute.
Turn Your Windows PC Into a Wireless Hotspot
You'll notice that the ad hoc networks that you create get added to the quick-select wireless network list—when you disconnect from your ad hoc network, it's the same as stopping it. Connecting to the network is the same as starting it back up; this way you can quickly switch back and forth between connections with just a few clicks.
Turn Your Windows PC Into a Wireless Hotspot
The last step is enabling connection sharing through your regular network card, which will allow anybody connected to your ad hoc wireless to use your internet connection. To do so, you'll want to head into the Network and Sharing Center, click the "Change adapter settings" link on the left, and then find your network connection in the list—it's very important that you only enable internet connection sharing on the adapter that is actually connected to the internet. In this case, my internet access at work goes through my Local Area Connection, so I've enabled it there.
At this point, you should be able to connect any wireless device to your new ad hoc network and access the internet, or even share files directly with your laptop.

Roundcube Mail: How to redirect to an URL after logout

Open roundcubemail/index.php file and edit following code:

else if ($RCMAIL->task == 'logout' && isset($_SESSION['user_id']) && (!$RCMAIL->config->get('referer_check') || rcmail::check_referer())) {
  $userdata = array(
    'user' => $_SESSION['username'],
    'host' => $_SESSION['storage_host'],
    'lang' => $RCMAIL->user->language,
  );
  $OUTPUT->show_message('loggedout');
  header('location: https://redirect URL/'); die();
//  $RCMAIL->logout_actions();
//  $RCMAIL->kill_session();
//  $RCMAIL->plugins->exec_h

Tuesday, July 2, 2013

Roundecube Mail: How to change logo, favicon etc

search $rcmail_config['skin'] = 'currentSkin'; in main.inc.php file so that you can understand which skin is used. then Goto: rcmail root folder/skins/currentSkin/images and use your logo and favicon.