Skip to main content

Posts

Get Remote IP Address in PHP

How to Get Remote IP Address using Core PHP You can use following function to Get Remote IP Address function getRemoteIPAddress() { $ip = $_SERVER['REMOTE_ADDR']; return $ip; } The above code will not work in case your client is behind proxy server. In that case use below function to get real IP address of client. function getRealIPAddr() { if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet { $ip=$_SERVER['HTTP_CLIENT_IP']; } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy { $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip=$_SERVER['REMOTE_ADDR']; } return $ip; }

How To Add Syntax Highlighter For Blogger

Adding syntax highlighter to your Blogger will make more beautiful and specific code with formatting to look at. You can use this method to highlight for HTML, CSS, JavaScript, PHP, Python, C, C++, JAVA, PERL, XML, XHTML and much other typical codes by using  code-prettify . Why you will choose code-prettify: 1. code-prettify is built by  Google . 2. It is fully responsive. 3. Easy to use. 4. Faster loading than other syntax highlighters. 5. Access several themes. Click here to view more....

Base64 Encode and Decode String in PHP

How to Encode and Decode String in PHP using Base64 Algorithm You can use following function to Encode and Decode String in PHP function base64url_encode($plainText) { $base64 = base64_encode($plainText); $base64url = strtr($base64, '+/=', '-_,'); return $base64url; } function base64url_decode($plainText) { $base64url = strtr($plainText, '-_,', '+/='); $base64 = base64_decode($base64url); return $base64; }

Send Mail using mail function in PHP

How to Send Mail using mail function in PHP $to = "reciever@gmail.com"; $subject = "Test Message"; $body = "Body of your message here you can use HTML too"; $headers = "From: Your Name\r\n"; $headers .= "Reply-To: info@yoursite.com\r\n"; $headers .= "Return-Path: info@yoursite.com\r\n"; $headers .= "X-Mailer: PHP5\n"; $headers .= 'MIME-Version: 1.0' . "\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail($to,$subject,$body,$headers); ?

How to Hide File using VB.Net

Private Sub HideFile(ByVal strFilePath As String) Try Dim strFInfo As New FileInfo(strFilePath) strFInfo.Attributes = FileAttributes.Hidden MessageBox.Show("Successfully Applied.") Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub