We can achieve using the php and ajax.The following ajax call execute in every 10 seconds to check the status of session.If it expired the user redirected to seesionout page. Ajax call in every 10 seconds var check_current_session; function CheckForCurrentSession() { var strSession=”check_current_session=true”; jQuery.ajax({ type: “GET”, url: “check_current_session.php”, data: strSession, cache: false, success: function(result){…
Category: PHP
Major security issues facing by the websites
Vulnerabilities Severity 1) Cross Site Scripting HIGH 2) File Upload Vulnerability HIGH 3) Directory Listing Vulnerability HIGH 4) Unencrypted Login Pages HIGH 5) Session Hijacking HIGH 6) Cross Site Request Forgery(csrf) HIGH 7) Weak Captcha Implementation MEDIUM 8) Cross Frame Scripting(css) MEDIUM 9)Internal Error Handling MEDIUM 10)Cookies are not marked as HTTPOnly LOW Recommendations…
Add multiple products to Paypal Cart with One Click
Paypal is a payment gateway used in number of websites in world wide.We can post shopping cart info to paypal from the website The following code shows the syntax of code used to post multiple cart items to paypal <form id=”paypalform” action=”https://www.paypal.com/cgi-bin/webscr” method=”post” name=”paypal_auto_form”> <input name=”rm” type=”hidden” value=”2″ /> <input name=”cmd” type=”hidden” value=”_cart” /> <input…
Find Country Name By IP Address using PHP
Use the following Code to get geo location details based on Your IP $country data=getLocationInfoByIp(); echo $country data[‘country’]; echo $country data[‘city’]; function getLocationInfoByIp() { $current_ip = @$_SERVER[‘HTTP_CLIENT_IP’]; $forwardip = @$_SERVER[‘HTTP_X_FORWARDED_FOR’]; $remoteip = @$_SERVER[‘REMOTE_ADDR’]; $geo_data = array(‘country’=>”, ‘city’=>”); if(filter_var($current_ip, FILTER_VALIDATE_IP)) { $ipaddress = $current_ip; } elseif(filter_var($forwardip, FILTER_VALIDATE_IP)) { $ipaddress = $forwardip; } else { $ipaddress = $remoteip; }…
Restrict ckeditor to basic toolbar
We can use javascript or jquery to apply ckeditor configuration HTML <textarea id=”textarea” cols=”15″ name=”txtdesc” rows=”5″></textarea> Javascript Must be included ckeditor.js Take the instance of ckeditor and replace with new configuration <script type=”text/javascript”> var editor = CKEDITOR.instances[‘txtdesc‘]; if (editor) { editor.destroy(true); } var editorContent =CKEDITOR.replace(‘txtdesc‘, { toolbar: [ { name: ‘document’, items: [ ‘Source’, ‘-‘,…