Jump to content

Help Me Please!


saifialbab

Recommended Posts

Hi everybody,

I am new to MySQL. It's been almost 3 days to find a solution. Actually I have a member's area.

I want to display the current user's details. Like when someone logs in, he see his specific code that is defined at the database. I managed to display the username and id .

I had made a column say val in my database, If i put val's value to 1 The user should see "verified" or else "not verified"

 

Please help me, any help will be strongly appreciated

Thanks in advance.

Here are my codes

 

Login.php:

 

<?php
        session_start();
        include "dbConfig.php";

        if ($_GET["op"] == "login")
  {
  if (!$_POST["username"] || !$_POST["password"])
        {
        die("You need to provide a username and password.");
        }
      $username = $_POST['username'];
      $password = $_POST['password'];
      $q = "SELECT * FROM `master_users` WHERE e_mail = '$username' AND pass = MD5('$password')";
  $r = mysql_query($q);
  if ( $obj = @mysql_fetch_object($r) )
        {
        $_SESSION["valid_id"] = $obj->id;
        $_SESSION["valid_user"] = $_POST["username"];

        Header("Location: members.php");
        }
  else
        {
        die("Sorry, could not log you in. Wrong login information.");
        }
  }
        else
  {
echo '<html>';
echo '<head>';
echo '<title>Login To Your Status Account</title>';
  echo '</head>';
    echo '<body style="background-color:#0189c3">';
    echo "<p> </p>";
    echo "<p> </p>";
        echo '<center><h1><font face="Tahoma" color="#FFFFFF"><font="Tahoma"> <font size="6">';
        echo '<body id="login"><div class="login-container"><div id="Loginbox">';
                          echo "<p> </p>"; 
                           echo "<p> </p>";
        echo '<font color="black">LOGIN</font>';
                                                  
  echo "<form action=\"?op=login\" method=\"POST\">";
  echo "Username: <input name=\"username\" size=\"15\" class=\"text big\" value=\"                   Your Email\" onBlur=\"if (this.value == '')  
                    {this.value = '                   Your Email';}\"  
                    onfocus=\"if (this.value == '                   Your Email')  
                    {this.value = '';}\"><br />";
    echo "<p> </p>";
  echo "Password: <input type=\"password\" name=\"password\" size=\"15\" class=\"text big\" value=\"                  Your Password\" onBlur=\"if (this.value == '')  
                    {this.value = '                  Your Password';}\"  
                    onfocus=\"if (this.value == '                  Your Password')  
                    {this.value = '';}\"><br />";
      echo "<p> </p>";
  echo "<input type=\"submit\" name=\"btnLogin\" id=\"btnLogin\" style=\"width:154px; height:34px;\" value=\"Login\">";
  echo "</form>";
  echo '</body>';
  echo '</html>';
  }
        ?>

 

 

Members.php:

 

<?php
session_start();
include "dbConfig.php";

if (!$_SESSION["valid_user"])

        {
        Header("Location: login.php");
        }

// ...

echo '<html>';
echo '<head>';
echo '<title>Your Status Account</title>';
  echo '</head>';
echo '<body style="background-color:#0189c3">';
        echo "<p> </p>";
                echo "<p> </p>";
            echo "<p> </p>";
    echo "<p> </p>";
    echo "<p> </p>";
        echo '<center><h1><font face="Tahoma" color="#FFFFFF"><font="Tahoma"> <font size="6">';
        echo '<body id="login"><div class="login-container"><div id="Loginbox">';
echo "<p>User ID: " . $_SESSION["valid_user"];
echo "<p>Username: " . $_SESSION["valid_user"];
echo "<p>Logged in: " . date("m/d/Y", $_SESSION["valid_time"]);
echo '</font>';
echo "<font color=\"black\"><p>Status: Not Verified</font></p>";
  echo '</body>';
  echo '</html>';

  
echo "<p><a href=\"logout.php\">Click here to logout!</a></p>";

?>

 

MySQL server version -- 5.1.63

No Errors

Everything else has been mentioned and rest I dont know where to get cuz I am a newbie, :P

PLEASE HELP :)

Link to comment
https://forums.phpfreaks.com/topic/265180-help-me-please/
Share on other sites

  Quote

Sorry, didn't see that _object call -- bizarre.

 

Table structure?

 

# Column Type Collation Attributes Null Default Extra Action

1 e_mail varchar(50) latin1_swedish_ci No None   Change   Drop More

2 pass varchar(32) latin1_swedish_ci No None   Change   Drop More

3 join_date date No None   Change   Drop More

4 val varchar(30) latin1_swedish_ci No None   Change   Drop More

 

 

&

 

 

                                                                                                e_mail                                pass                        join_date val

  Edit   Inline Edit   Copy Delete mr.abcdefgh@gmail.com 5f4dcc3b5aa765d61d8327deb882cf99 2012-07-02 1

  Edit   Inline Edit   Copy Delete dj.ijklmn@rediffmail.com bda9f42e0c8a294ecdf5cc72aae6a701 2012-07-03 0

  Edit   Inline Edit   Copy Delete opqrst@yahoo.com.br 54940e09ecb5fea678ef48b6f2d6ab60 2012-07-04 1

  Edit   Inline Edit   Copy Delete uvwxyz@gmail.com         bb410a756c4f338c3089ec1cb1b2abdf 2012-07-05 1

 

Link to comment
https://forums.phpfreaks.com/topic/265180-help-me-please/#findComment-1359869
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.