Skip to main content

Posts

Basic PHP File Handling — Create, Open, Read, Write, Append, Close, and Delete

I don't do a great deal of file handling in my PHP code -- most of my customers don't have a need for it or there's no room for file creation in the already tight budget. On the rare occasion that I do need to manipulate files, I keep the following tip sheet. Create a File $my_file = 'file.txt' ; $handle = fopen ( $my_file , 'w' ) or die ( 'Cannot open file: ' . $my_file ) ; //implicitly creates file Open a File $my_file = 'file.txt' ; $handle = fopen ( $my_file , 'w' ) or die ( 'Cannot open file: ' . $my_file ) ; //open file for writing ('w','r','a')... Read a File $my_file = 'file.txt' ; $handle = fopen ( $my_file , 'r' ) ; $data = fread ( $handle , filesize ( $my_file ) ) ; Write to a File $my_file = 'file.txt' ; $handle = fopen ( $my_file , 'w' ) or die ( 'Cannot open file: ' . $my_file ) ; $data = 'Th

Create a Pop-up div in jQuery

If you are new to jQuery, you should check out my  Beginner’s Guide to jQuery  article first, just to get to grips with the basics. Tutorial Demo This is an easy tutorial suitable for those fairly new to jQuery. This tutorial will teach you how to create a simple pop-up effect, showing a hidden div, when you hover over the trigger link. View the Tutorial Demo The HTML Create a new HTML document and insert all the usual code – doctype, html tags, head tags, body tags, etc. as shown below: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>jQuery Tutorial - Pop-up div on hover</title> </head> <body> </body> </html> Notice how I am using the HTML5 doctype –  <!DOCTYPE html>  – it is a good idea to get into the habit of using this. First we are going to create a  div with an id of container  to hold our page content and centralise it, just to make th

WORDPRESS CUSTOM REGISTRATION WITHOUT USING A PLUGIN

On past few days, I was posted an article about creating WordPress Custom Login Page without Using a Plugin and on previous month I’ve posted another wordpress related article which is How to Create Custom Reset or Forget Password in WordPress and to complete wordpress Meta I decided to create a new article “WordPress Custom Registration without Using a Plugin”, this sounds really interesting right? To add registration in your site you can find various wordpress plugins directly in wordpress plugin directory but this tutorial might helpful to all web developer who are willing to learn in wordpress. In this tutorial we’re using wp_insert_user() function to insert a user into the database, this functions can update a current user or insert a new user based on whether the user’s ID is present. Syntax <?php wp_insert_user( $userdata ) ?> 1 <?php wp_insert_user ( $userdata ) ?> PHP code This contains php script