HTTP Authentication in PHP

PHP, Techniques, Tips, Tutorials
Sometimes you might wish to make certain pages of your site just perceptible to a chosen few. you can do this by utilizing Phps constructed within Http Authentication. The code ought to go right at the highest point of your php page so don't get 'headers Already Sent' mistakes. You can see that we've specified the username and secret word in the variables at the highest point of the script you can change these to reflect your own particular username and watchword. You could effortlessly make this verification more dynamic by checking a database for the username and watchword. We can get whatever the client sorted into the dropdown box by tagging the accompanying superglobals. //Username: <?php echo $_SERVER['PHP_AUTH_USER'];?> //Password: <?php echo $_SERVER['PHP_AUTH_PW'];?> The Code <?php $config['admin_username'] = "demo"; $config['admin_password']…
Read More

20 Complete scripts to download

PHP, PHP Scripts, Techniques, Tips, Web Design & Programming
I've assembled a superb small accumulation of scripts over the previous year or thereabouts, and have chosen as its approaching summer in the Uk (sorry winter in Australia!) to do a download heap of 20 different scripts where you can get the parcel in a single click gratis! In spite of the fact that gifts are likewise highly acknowledged. Look at the record underneath for all the portions of the bundle. This accumulation is dependent upon a mixture of diverse systems, from Css, Php jquery to Mysql. jQuery Drag & Drop Using jQuery PHP and MySQL a complete drag and drop script that updates the database. jQuery Delete Delete items using PHP jQuery using an AJAX request. PHP jQuery and MySQL Autosuggest A powerful autosuggest script that searches a MySQL…
Read More

Display Facebook likes / Shares PHP function

PHP, PHP Scripts, Techniques
The CodeBelow is a super simple function that retrieves a JSON feed of comments, likes and shares for any URL you provide. function facebook_shares($url){ $fql = "SELECT url, normalized_url, share_count, like_count, comment_count, "; $fql .= "total_count, commentsbox_count, comments_fbid, click_count FROM "; $fql .= "link_stat WHERE url = '".$url."'"; $apifql="https://api.facebook.com/method/fql.query?format=json&query=".urlencode($fql); $fb_json=file_get_contents($apifql); return json_decode($fb_json); } How to use $fb = facebook_shares('https://www.facebook.com/redbull'); // facebook share count echo $fb[0]->share_count; // facebook like count echo $fb[0]->like_count; // facebook comment count echo $fb[0]->comment_count;
Read More

Show Google Plus’s – PHP function

PHP, PHP Scripts, Techniques
To get prefers and impart information for a Url here's a capacity to get Google Plus' for any Url. The Code It’s worth pointing out you must have CURL enabled on your web server, I believe it’s enabled by default on PHP5 setups. Also the Key below Isn’t a unique API key you must leave the key as is to ensure the code works properly. function gplus_shares($url){ // G+ DATA $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, '[{"method":"pos.plusones.get","id":"p", "params":{"nolog":true,"id":"' . $url . '","source":"widget","userId":"@viewer","groupId":"@self"}, "jsonrpc":"2.0","key":"p","apiVersion":"v1"}]'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json')); $result = curl_exec ($ch); curl_close ($ch); return json_decode($result, true); } Example Usage $gplus = gplus_shares('https://facebook.com'); echo $gplus[0]['result']['metadata']['globalCounts']['count'];
Read More

How To Secure Your WordPress Blog

Techniques, Tips, WordPress
By following some simple steps you can protect your Wordpress Blog by malware attacks: 1. Always backup your all data 2. Use strong passwords: 3. Number of login attempts need to be restricted to a certain number 4. Avoid using any free themes and plugins and choose your plugins wisely 5. Hide your wordpress version by using remove_action('wp_head', 'wp_generator');  in function.php file 6. Keep your blog with updated version of wordpress 7. Use .htaccess file for hide indexes 8. Change the database prefix other than "wp_" 9. Change default username from "admin" 10. Remove unused themes and plugins 11. File permission need to set correctly 12. Create custom secret keys for wp-config.php file 13. Remove sample page & post 14. Protect your wordpress admin access 15. Choose the right web…
Read More

Alter and save a passage of content in a Html page

PHP, PHP Scripts, Software Development, Techniques, Tips, Tutorials, Web Design & Programming
This class might be utilized to alter and save a passage of content in a Html page. It copartners the vital Javascript occasion taking care of code to transform a given passage in a Html page into editable content when the client clicks on it. The point when the client completes the process of altering the produced Javascript submit the passage content to the Web server utilizing Ajax demand so it might be safeguarded. Download Script
Read More

Show month datebooks browseable utilizing Ajax

PHP, PHP Scripts, Techniques, Tutorials, Web Design & Programming
This class might be utilized to presentation month timetables browseable utilizing Ajax. It can create Html and Javascript to presentation a month timetable with connections to peruse the months utilizing Ajax to stay away from page reloading. The class can make given days be shown as connections to occasion pages. The skimming may be limited to given dates. The months and week day names are customizable. The presentation items may be tweaked utilizing CSS. Download Script
Read More

10 Easy Steps For WordPress MU Installation

PHP, Techniques, Tutorials, WordPress
10 simple steps for installation WPMU are: 1 Download WPMU from http://mu.wordpress.org/download/ and unpack it. 2 If you want your WPMU installation in a subdirectory then rename the “wordpress-mu” folder to whatever you want. Upload the entire folder to your server. If you want your installation directly on the root then don’t worry about the folder. Simply upload all of the files inside (not the directory itself) to your server. 3 Create a MySQL database for WordPress MU on your web server, as well as a MySQL user who has all privileges for accessing and modifying it. 4 Navigate to index.php at your domain and you will be presented with the install script: http://example.com/index.php { Root Installation } http://example.com/subdirectory/index.php { Subdirectory Installation } 5 Delete your .htaccess file and change…
Read More

Offline Access to Google and other OAuth based API – PHP OAuth API – Part 2

PHP, Techniques, Tips, Tutorials, Web Design & Programming
Retrieving Access Tokens from a MySQL database The database_oauth_client_class is just a generic SQL database storage class. It really does not execute SQL queries because that depends on the type of database you want to store your tokens. A more specialized sub-class is necessary to execute the SQL queries to a specific type of database. This package also comes with another sub-class named mysqli_oauth_client_class that is specialized in executing the SQL queries to a MySQL database using the mysqli extension. If you use a different type of database, you can use this sub-class as model to execute SQL queries using the appropriate PHP extension. Lets see how you can make this work in practice to make the tokens be stored and retrieved in a MySQL database. The first thing you…
Read More