free stats
 
 
 
Copyright © How To Do!!!
Design by Dzignine
Friday, January 24, 2014

Make a Login System for Your Website: PHP and MySQL



Use These Tips to Create a Website Login

Login system in website
This is a simple website login system that has been very reliable and secure for me. I use it myself on my websites, when a simple system is needed. If you know a little MySQL and PHP, it is very easy to use. Here's how to create a website login system using PHP and MySQL.
    First, you will need to have MySQL installed on your computer. I have XAMMP installed and I use PHPmyADMIN for accessing my databases. They are free for download; just search for them online. You also need tocreate a database in your MySQL. And as you proceed, remember that linux server file names are always case sensitive. LOGIN.PHP is not equal to login.php like it would be on WINDOWS servers.
      1. Run this SQL command in your MySQL database (you must have one):
        CREATE TABLE `users` (
        `id` int(3) NOT NULL auto_increment,
        `login` varchar(8) default NULL,
        `password` varchar(8) default NULL,
        PRIMARY KEY (`id`)
        ) TYPE=MyISAM AUTO_INCREMENT=3 ;
        This will create the table that will record the usernames and passwords.
      2. Then, create the LOGIN.PHP file. This page will contain the form that will submit the user´s data.
        <?
        session_name
        ("MyLogin");session_start();session_destroy();
        if($_GET['login'] == "failed") {print $_GET['cause'];
        }
        ?><form name="login_form" method="post" action="log.php?action=login">
        Login: <input type="text" name="user"><BR>
        Password: <input type="password" name="pwd"><BR>
        <input type="submit">
        </form>
      3. Now, create the LOG.PHP. This is the file that performs the action of the form.
        <?
        session_name
        ("MyLogin");session_start();
        if($_GET['action'] == "login") {$conn mysql_connect("localhost","user","password"); // your MySQL connection data$db mysql_select_db("DATABASENAME"); //put your database name in here
        $name 
        $_POST['user'];$q_user mysql_query("SELECT * FROM USERS WHERE login='$name'");
        if(mysql_num_rows($q_user) == 1) {
        $query 
        mysql_query("SELECT * FROM USERS WHERE login='$name'");$data mysql_fetch_array($query);if($_POST['pwd'] == $data['password']) { session_register("name");header("Location: yourpage.php"); // success page. put the URL you want exit;} else {header("Location: login.php?login=failed&cause=".urlencode('Wrong Password'));exit;}} else {header("Location: login.php?login=failed&cause=".urlencode('Invalid User'));exit;}
        }
        // if the session is not registeredif(session_is_registered("name") == false) {header("Location: login.php");
        }
        ?>
      4. If you paid enough attention, you noticed that the login will lead the user toYOURPAGE.PHP. Add these lines of code to any webpage that you want to secure (including yourpage.php):
        <?require("log.php");?>
        Printing the user name in the screen is very easy. Just add this code:
        <? print $_SESSION["name"]; ?>
      That´s it. You can now use PHP and MySQL to create a simple website login. It works out fine, but if you have any trouble with it, please contact me!!!
      Marcos Riso
      WebDeveloper - marcos@chipweb.com.br
       

      Enhance and Resize a Craigslist Photo: Image Editing and Resizing



      Learn How To Make Top Quality Photos with a Free Online Photo Editor

      In Part 1, How To Use ImageShack Photo Hosting for Craigslist Ads, I described what photo hosting was all about and why you want to avoid use of Craigslist's own tools for adding photos to your product listings. I introduced you to ImageShack and theirfree online photo editor service. I discussed the virtues of ImageShack's free hosting service and its other uses, and explained that the procedures are easy to follow. Now it's time to get your photos ready for the show by enhancing and resizing them. I'll show you how to enhance and resize photos for Craigslist.
      Anyway, let's say you've decided to sell an assortment of obsolete wired networking hardware (you recently switched to wireless, right?). You've got a LinkSys router and two Netgear hubs of different sizes. With your new 8 megapixel Canon camera, you'll shoot pictures of each. You already know how to download these photos from camera to computer. You've placed the photos in a folder named C:\craigslist\NetworkHardware4Sale.
      1. Using a photo editor, crop the photos and enhance them for best contrast and brightness. If they look good in the photo editor, they'll appear great in your listing. Select one image that looks best for each item, and save each with a sensible name, such as:
        • LinkSysRouter
        • NetgearHub-4port
        • NetgearHub-8port
        In some cases you may want to shoot front and rear photos. For example, customers may want to see the connectors on the Netgear hubs. Just add the word "front" and "rear" to the photo file names. If you do it for all three products, now you've got six photos to upload:
        • LinkSysRouterFront
        • LinkSysRouterRear
        • NetgearHub-4portFront
        • NetgearHub-4portRear
        • NetgearHub-8portFront
        • NetgearHub-8portRear
      2. Make sure you are familiar with your camera. Since your camera takes photos up to 8 megapixels, each photo can be quite large -- much more than 1 megapixel each. You have a choice to make at this point. You can resize the photos with your photo editor, or you can let ImageShack do the work for you. Virtually all digital cameras let you select image size before you shoot, so there's a third choice; you make it before taking the photos. Read the next four paragraphs, then consult your camera manual.
        As a general rule of thumb, a 3 megapixel camera is more than sufficient for Craigslist photos. Even an old, cheap 2 megapixel camera (buy one on Craigslist) will produce excellent images for the web. In fact, the images you are going to display in your Craigslist ads should never be larger than 500K (about half a megapixel) and usually won't exceed 250K. So, if you've mastered your camera, you can set it to take smaller pictures. Downloads to your computer will be faster, and subsequent uploads to ImageShack will also be quicker.
      3. Choose the right size for Craigslist photos. Your six images are ready to go through image editing and you've decided to let ImageShack resize them on the fly as they are being uploaded. How big do you want them to appear in your listing?
        The answer to photo resizing is based on screen size. Most desktop and notebook computer users (>75%) have displays measuring 15" to 17" with resolutions of 1024 pixels wide (15") to 1280 pixels wide (17"). Size your photos to 1024 pixels and they will display full screen on a 15" monitor. In fact, it's good to leave some "white space" around a photo (that's what ad experts say) so I routinely size my Craigslist photos to 800 pixels wide. This is still much larger than the meager 300 pixel width of a standard Craigslist photo, but it's ample for products like the surplus network hardware in this how-to.
        Of course, if you are attempting to show fine detail in a product, then by all means go big, up to 1024 pixels when you resize an image. If you go beyond this size, your photos will overflow the visible 15" screen. Viewers won't see the whole photo unless they scroll to the right. A good example of "going big" is an ad for a valuable coin or stamp where you want to be certain that buyers can see flaws or no flaws. Of course, you must master the macro mode of digital photography to shoot such photos in the first place. I digress...so let's get back to the photos.
        OK, you've cropped and enhanced your photos and decided to display them in your ad at 800 pixels wide. The photos are stored on your hard drive in the folder named C:\craigslist\NetworkHardware4Sale\. Remember this.
      4. Open an on-screen scratch pad. You'll need an on-screen scratch pad to capture the code that's going to be generated in the next steps. Our Windows-based computers come with a couple of good ones -- Notepad and WordPad. You'll find both by clicking Start - Program - Accessories. Select Notepad and it will open a text processing window into which you'll paste the code you copy in the next series of steps. You can reduce the size of the on-screen Notepad window to temporarily get it out of the way, or minimize it to the bottom of the screen.
        1. Upload and resize images on ImageShack. Now, using your browser, go to ImageShack. If you go to imageshack.com, you're in the wrong place. Follow these steps to automatically upload your six photos.
          Let's assume you have not registered with the site. The first task is to enter your email address in the window to register upon upload. Then... 
          1. Click the round radio button "image".
          2. Click the Browse button.
          3. Using the navigation tools in the window, find and open the folder C:\craigslist\NetworkHardware4Sale\. Your six photos will be listed.
          4. Select the first photo and click "open".
          5. Select "Resize Image?" and use the drop-down window to pick 800 x 600.
          6. Click "host it". The photo begins to upload. When complete (this can take a minute or more if the photo is big and you're on dial-up), you'll see a long list of code choices and some advertising (ImageShack needs to pay bills like the rest of us).
          7. Of these many choices, the one you want is found on the lower half of the screen (you may need to scroll down) and begins <a href=...>. It's named "Hotlink for Websites" on the right hand side. The photo to the right shows how it appears.
          8. Place your mouse in this window and click once, highlighting the selection. Then, press CTRL-C to copy. Minimize the ImageShack window and bring up Notepad.
          9. Click anywhere in the scratchpad's white space, then press CTRL-V to paste the entry, which will look something like this:
            <a href="http://imageshack.us"><img src="http://img161.imageshack.us/img161/1161/
            imageshackuploadresult1en9.jpg"
            border="0" alt="Image Hosted by ImageShack.us"/></a><br/
          10. Put a carriage return (Enter key) at the end of the code segment if you like.
        2. You'll repeat the process for each photo, building up your scratchpad with subsequent entries. It's a good idea to save the scratchpad in the same folder where you placed the photos. You can name it NetworkHardware4sale.txt and save it as a txt file. Then, shrink or minimize the window.
          Now that you know how to resize and enhance your images for Craigslist, let's continue to the next topic: putting big images into the Craigslist ad.

        How To Convert AVI to WMV



        Changing AVI files to WMV files with a Free Converter

        You have lots of AVI files and want to turn them into WMV files? I'll show how to do this using freeware software in a few easy steps. Here's how to convert AVI to WMV.
        1. First, download Prism video file converter. It's a freeware software to convert multiple kinds of video files. Here you can find a free AVI to WMV converter. You can click the following link to start the setup
        2. Install the software. If you want, install the other features also, but for this task just the video converter is needed.
        3. Open Prism video converter. On the upper left corner, you'll see a plus symbol for "add file".
        4. Click on this "add file". Now open the AVI file you want to convert.
        5. On the left bottom corner is written "output format". Choose WMV to convert your file into a WMV file.
        6. Click "browse". Now choose the folder where you want to save your WMV file.
        7. Click "convert", on the righ bottom corner. If the program says that you need a codec, say yes; it will download and take just a few moments. The conversion will start.
        8. Wait. The conversion may take several minutes, depending on the size of the file.
        After that, the WMV file is ready for you to watch or burn. But be aware that the conversion usually takes quality from the AVI file. If you want to convert AVI to DVD directly, you can use another type of video file converter.
        Enjoy this very easy way to convert AVI files into WMV files.
         

        How To Connect 2 PCs Directly



        Easy Instructions for Windows XP and Windows Vista Users

        Photo of computer sets
        Sometimes people need to connect two PCs. When and why?
        Imagine this situation. You come to your friend's house with your laptop to show him the video about your last vacation in Brazil. He wants to have this video, too, and he wants to have it now. What can you do? Use your 2GB USB flash card? No, the size of the video file is much larger. Burn the video on DVD? No, that would take several hours.
        Here's another situation. Your elder son found a new PC strategy game. It's so cool, and he wants to play network game with you next weekend. You have a laptop  and home computer, but how do you connect them for this network game?
        So many different situations...
        What you need in order to connect 2 PCs:
        In networking two computers. both computers should have network adapters. You also need anethernet crossover cable to connect PCs. Ethernet crossover cables can be purchased in any computer shop; the cable looks like normal patch cord, but it is used for the direct connection of 2 PCs. Ask the shopkeepers -- they know what you need. 
        How To
        Okay, you connected your computers using crossover cable. But now you need to set up network properties on both computers to help them to 'see' each other.
        We will show how to do that under Windows XP and Windows Vista. You should do these actions on both computers:
        1. Setup network properties on both computers.
        • Windows XP: Press Start -> Settings -> Network Connections. Windows Vista: Press Start -> Connect To -> View network computers and devices -> Network and Sharing Center.
        • Windows XP: Find Local Area Connection in the window (it must be connected) and right-click it. Select Properties, and the Local Area Connection Properties dialog box appears.Windows Vista: Select Manage Network Connections, find Local Area Connection in the window and double click it. Press Properties button, Local Area Connection Properties dialog box appears.
        • Windows XP: Select Internet Protocol (TCP/IP) and press Properties button. The Internet Protocol (TCP/IP) Properties dialog box appears. Windows Vista: Select Internet Protocol version 4 (TCP/Ipv4) and press Properties button. The Internet Protocol (TCP/IP) Properties dialog box appears.
        • Both systems: Select Use the Following IP Address.
        • IP addresses 192.168.1.x (where is any number from 1 to 255 -- these numbers are reserved for local networks). So you need to select an address from this range. As you have only two computers in your network, we recommend that you use 1 and 2. Both systems:Set 192.168.1.1 (192.168.1.2 for the second computer) in IP address field. 255.255.255.0 in Subnet mask (for both computers). Press OK.
        TCP/IP Properties
        2.Create Workgroup for our local network.
        • Windows XP: Open System Properties using Win+Break. Windows Vista: Open System Properties using Win+Break, click Advanced system settings.
        • Windows XP: Select Computer Name tab, click Change, Computer Name Changes dialog box appears. Windows Vista: Click Computer Name tab, click Change, Computer Name/Domain Changes dialog box appears.
        • Both systems: Specify computer name in Computer name field, select Member of Workgroup, and enter the name of workgroup (HOME on the picture below).
        • Both systems: Press OK, and then reboot the computer after the system prompt.
        Computer Name Changes
        Again, please do all of these on both computers you would like to connect.
        3. Create a shared folder.
        After reboot, you have the local network consisting of two computers connected directly. You have access to all shared resources of one computer (such as shared folders, printers or other devices) from another computer. Let's look at an example of how to create a shared folder.
        • Both systems: Click the folder you want to share by clicking the right mouse button, select Properties.
        • Both systems: Select Sharing tab.
        • Windows XP: Select Share this folder, enter the name for the folder you want, press OK.Windows Vista: Press Share button, enter the name for the folder you want, press OK.  Now the shared folder is accessible from the network.
        • Windows XP: In order to access it from another computer: press Start -> Settings ->Network Settings. Click My Network Places, click Entire Network, double click Microsoft Windows Network, double click HOME workgroup, the name of the second PC appears. When you double click it, you will see all shared resources of the second PC. Windows Vista: In order to access it from another computer: press Start ->Network, double click HOME workgroup, the name of the second PC appears. When you double click it, you will see all shared resources of the second PC.
        Now you are able to exchange files between these computers, print remotely to the printer connected to one of them, play network games, and perform all options you have within the local network.
         

        How To Add Day, Hour, Minute, Second to a Date Value in Oracle

        Date arithmetic is very common in database application. In Oracle, you can add, subtract and compare DATE columns, but you can not multiply or divide it. Oracle stores century, year, month, day, hour, min and seconds as part of the DATE column.
        Now let’s take a look at how to add day/hour/minute/second to a date value. Oracle expects a number constant in date arithmetic as number of days. In other words, you need to convert hour, minute and seconds to fraction of a day and then you can add or subtract that value from a date value. Here are some examples:
        1. Add a day.
          select to_date('02-22-2008 10:30:30','mm-dd-yyyy hh24:mi:ss') today,
          to_date('02-22-2008 10:30:30','mm-dd-yyyy hh24:mi:ss')+1 next_day
          from dual;
          TODAY NEXT_DAY
          ------------------------- -------------------------
          02-22-08 10:30:30 02-23-08 10:30:30
        2. Add an hour.
          select to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss') today,
          to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss')+ 1/24 next_hour
          from dual;
          TODAY NEXT_HOUR
          ------------------------ ------------------------
          02-22-08 10:30:30 02-22-08 11:30:30
        3. Add a minute.
          select to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss') today,
          to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss')+ 1/(24*60) next_min
          from dual;
          TODAY NEXT_MIN
          ------------------------ ------------------------
          02-22-08 10:30:30 02-22-08 10:31:30
        4. Add a second.
          select to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss') today,
          to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss')+ 1/(24*60*60) next_sec
          from dual;
          TODAY NEXT_SEC
          ------------------------ ------------------------
          02-22-08 10:30:30 02-22-08 10:30:31
        5. Subtract a day.
          select to_date('02-22-2008 10:30:30','mm-dd-yyyy hh24:mi:ss') today,
          to_date('02-22-2008 10:30:30','mm-dd-yyyy hh24:mi:ss') - 1 prev_day
          from dual;
          TODAY PREV_DAY
          ------------------------- -------------------------
          02-22-08 10:30:30 02-21-08 10:30:30
        6. Subtract an hour.
          select to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss') today,
          to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss') - 1/24 prev_hour
          from dual;
          TODAY PREV_HOUR
          ------------------------ ------------------------
          02-22-08 10:30:30 02-22-08 09:30:30
        7. Subtract a minute.
          select to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss') today,
          to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss') - 1/(24*60) prev_min
          from dual;
          TODAY PREV_MIN
          ------------------------ ------------------------
          02-22-08 10:30:30 02-22-08 10:29:30
        8. Subtract a second.
          select to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss') today,
          to_date('02-22-08 10:30:30','mm-dd-yy hh24:mi:ss') - 1/(24*60*60) prev_sec
          from dual;
          TODAY PREV_SEC
          ------------------------ ------------------------
          02-22-08 10:30:30 02-22-08 10:30:29

        Date value in Oracle has two components, date and time. Oracle stores hour, minute and seconds along with date. As you can see from the above examples, date arithmetic in Oracle is simple and easy to use.