June 2013
JavaScript parseInt() for type casting
The parseInt() function parses a string and returns an integer. Syntax parseInt(string, radix) Parameter Description string Required. The string to be parsed radix Optional. A number (from 2 to 36) that represents the numeral system to be used
PHP type cast float to int
Description int intval ( mixed $var [, int $base = 10 ] ) Parameters Description $var : The value which converted to an integer $base : Conversion base Examples <?phpecho intval(42); // 42echo intval(4.2); // 4echo intval(’42’); // 42
PHP file Download Script
This article represent you how to download any files from php web server to local machine. This application works mainly on the header of the PHP. Demo: <?php $file = ‘monkey.gif’; if (file_exists($file)) { header(‘Content-Description: File Transfer’); header(‘Content-Type: application/octet-stream’); header(‘Content-Disposition: attachment; filename=’.basename($file)); header(‘Content-Transfer-Encoding: binary’); header(‘Expires: 0’); header(‘Cache-Control: must-revalidate’); header(‘Pragma: public’); header(‘Content-Length: ‘ . filesize($file)); ob_clean(); […]
How to restart nginx?
For Restart nginx server /etc/init.d/nginx restart will restart nginx as will service nginx restart
Install Send Mail Function in nginx Server ubuntu
First of all check send mail function is install in to that server to check that Please execute this command in termianal vds@vps:/etc$ netstat -ntpl You Found result like this (No info could be read for “-p”: geteuid()=1000 but you should be root.)Active Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program […]
Send Mail in php
Description bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] ) Using mail() to send a simple email: <?php// The message$message = “Line 1rnLine 2rnLine 3”;// In case any of our lines are larger than 70 characters, we should use wordwrap()$message = wordwrap($message, 70, “rn”);// Sendmail(‘caffeinated@example.com’, ‘My Subject’, $message);?>