Jump to content

cmgmyr

Members
  • Posts

    1,278
  • Joined

  • Last visited

    Never

Posts posted by cmgmyr

  1. try something like this:

    <?php 
    
    function login(){
    include 'lib/config.php';
    include 'lib/db_open.php';
    
    // username and password sent from signup form
    $user=$_POST['username'];
    $pass=$_POST['password'];
    
    $sql="SELECT * FROM $tbl_login WHERE username='$user' and password='$pass'";
    $result=mysql_query($sql);
    
    // Mysql_num_row is counting table row
    $count=mysql_num_rows($result);
    
    // If result matched $myusername and $mypassword, table row must be 1 row
    if($count==1){
    // Register $user and redirect to users location
    session_register("username");
    header("location:index2.php");
    } elseif($count!=1) {
    echo "<div style='text-align:center'>";
    echo "<form name='form1' method='post' action='<?php echo $PHP_SELF;?>'>";
    echo "<table border='0' cellpadding='3' cellspacing='3' style='padding-top:15px;margin:0 auto;'>";
    echo "<tr>";
    echo "<td>Username:</td>";
    echo "<td><input name='username' id='username' type='text' size='20'></td>";
    echo "</tr>";
    echo "<tr>";
    echo "<td>Password:</td>";
    echo "<td><input name='password' id='password' type='password' size='20'></td>";
    echo "</tr>";
    echo "<tr align='right'>";
    echo "<td colspan='2'><input name='Login' type='submit' id='Login' value='  Login  '><input type=\"hidden\" name=\"action\" value=\"checklogin\"></td>";
    echo "</tr>";
    echo "</table>";
    echo "</form>";
    echo "</div>";
    } else {
    echo "<b>Error:</b> Wrong Username or Password";
    }
    }
    
    function checklogin(){
    include 'lib/config.php';
    include 'lib/db_open.php';
    
    // username and password sent from signup form
    $user=$_POST['username'];
    $pass=$_POST['password'];
    
    $sql="SELECT * FROM $tbl_login WHERE username='$user' and password='$pass'";
    $result=mysql_query($sql);
    
    // Mysql_num_row is counting table row
    $count=mysql_num_rows($result);
    // If result matched $myusername and $mypassword, table row must be 1 row
    
    if($count==1){
    // Register $user and redirect to users location
    session_register("username");
    header("location:this_script.php"); // can also be header("location:this_script.php?action=login");
    }
    else {
    echo "Wrong Username or Password";
    }
    
    }
    
    switch ($action){
    
    case "login":
    	login();
    	break;
    
    case "checklogin":
    	checklogin();
    	break;
    
    default:
    	login();
    	break;
    }
    
    ?>

     

     

    *** notice the hidden value in your login form

     

    hope this helps

  2. I seem to recall seeing that template before. Is there a point in getting critique on something you did not make?

    ...it looks like businessman's template that he used

     

    @mreish - If you are not good at designing, why don't you hire someone to do that for you instead of using a template?

  3. Add this to the top of the page:

    <?php 
       $mtime = microtime(); 
       $mtime = explode(" ",$mtime); 
       $mtime = $mtime[1] + $mtime[0]; 
       $starttime = $mtime; 
    ?>

     

    and this to the bottom:

    <?php 
       $mtime = microtime(); 
       $mtime = explode(" ",$mtime); 
       $mtime = $mtime[1] + $mtime[0]; 
       $endtime = $mtime; 
       $totaltime = ($endtime - $starttime); 
       echo "This page was created in ".number_format($totaltime,6)." seconds"; 
    ?>

  4. you should probably look into making a DB. This would be good for future use. I'm sure you would like to upgrade in the future or even sell you "system" to someone else...it would be pretty hard to keep track of 500+ users in a text file... (besides using a flat file DB...but thats still a DB)

  5. when they sign up they will have to select their service provider from a list. When they submit the form, write all of the data into your DB. Then when you send out your "SMS" (email) you will have to search for the provider's info and add that onto the user's phone number.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.