Home

Forums

Web development

 

 

 

 
     
 
dna88 Web development and Technology Forum
 
Profile   Register   Memberlist   Usergroups   FAQ   Search  Log in
Session problem in user logon
Goto page Previous  1, 2
 
Post new topic   Reply to topic    dna88 Forum Index -> Web scripting language Discussion Forum
Author Message
tanveer
User
User


Joined: 21 Jun 2004
Posts: 85
Location: Dhaka,Bangladesh

Post Post subject: Reply with quote

Here are the codes that I used for login.
As u said I made php files for the needed html files
Code:

<?php
session_start();
include 'connect.php';

$sql=mysql_query("select * from user where user_id='$userid'");
$login_check=mysql_num_rows($sql);
 if($login_check==0)
     // html code with login link
        include 'home.html';
 else
     //  html code with logout link
          include 'home.html';
?>


member_registratioin.html
Code:

<form method='post' action='http://localhost/login.php'>
   <table style="border:1px solid #000000" width="554" height="89">
         <tr colspan="2">
               <td width="202" bgcolor="#B5C3DE" height="26">
         <font face="Haettenschweiler">&nbsp;&nbsp;
         Member ID</font></td>
         <td height="26" bgcolor="#B5C3DE" width="340">
         <input type="text" name="uid" size="16">  </td>
       </tr>
        <tr>
         <td width="202" bgcolor="#B5C3DE" height="23">
         <font face="Haettenschweiler">&nbsp;&nbsp; Current Password
         </font> </td>
         <td height="23" bgcolor="#B5C3DE" width="340">
         <input type="password" name="passwd" size="13"> 
          </td>
        </tr>
         <tr>
           <td colspan="2" align="center" width="546">
            <input type="submit" name="submit" value="SUBMIT">
            <input type="reset" name="reset" value="RESET" ></td>
        </tr>
   </table>
 </form>


login.php:-
Code:

<?php
session_start();

include 'connect.php';
 
$userid=$_POST['uid'];
$password=$_POST['passwd'];
       
$sql=mysql_query("select * from user where user_id='$userid' and passwd='$password'");
$login_check=mysql_num_rows($sql);
 
if($login_check==0)
      echo " You have not uccessfully logged in ";
else
  {
$_SESSION['userid']=$userid;
echo $userid;
echo '<a href="login_success.php">Login_success</a>';
}
?>


login_succees.php
Code:

<?php
session_start();
echo "$_SESSION[userid]";
echo "Want To go to Home Page <a href='index.html'> home </a>";
?>
Sat Jul 24, 04 9:16 am
Back to top
tanveer View user's profile Send private message
tanveer
User
User


Joined: 21 Jun 2004
Posts: 85
Location: Dhaka,Bangladesh

Post Post subject: Reply with quote

As u said I made php files for the needed html files
Code:

<?php
session_start();
include 'connect.php';

$sql=mysql_query("select * from user where user_id='$userid'");
$login_check=mysql_num_rows($sql);
 if($login_check==0)
     // html code with login link
        include 'home.html';
 else
     //  html code with logout link
          include 'home.html';
?>


Here are the codes that I used for login.

member_registratioin.html
Code:

<form method='post' action='http://localhost/login.php'>
   <table style="border:1px solid #000000" width="554" height="89">
         <tr colspan="2">
               <td width="202" bgcolor="#B5C3DE" height="26">
         <font face="Haettenschweiler">&nbsp;&nbsp;
         Member ID</font></td>
         <td height="26" bgcolor="#B5C3DE" width="340">
         <input type="text" name="uid" size="16">  </td>
       </tr>
        <tr>
         <td width="202" bgcolor="#B5C3DE" height="23">
         <font face="Haettenschweiler">&nbsp;&nbsp; Current Password
         </font> </td>
         <td height="23" bgcolor="#B5C3DE" width="340">
         <input type="password" name="passwd" size="13"> 
          </td>
        </tr>
         <tr>
           <td colspan="2" align="center" width="546">
            <input type="submit" name="submit" value="SUBMIT">
            <input type="reset" name="reset" value="RESET" ></td>
        </tr>
   </table>
 </form>


login.php:-
Code:

<?php
session_start();

include 'connect.php';
 
$userid=$_POST['uid'];
$password=$_POST['passwd'];
       
$sql=mysql_query("select * from user where user_id='$userid' and passwd='$password'");
$login_check=mysql_num_rows($sql);
 
if($login_check==0)
      echo " You have not uccessfully logged in ";
else
  {
$_SESSION['userid']=$userid;
echo $userid;
echo '<a href="login_success.php">Login_success</a>';
}
?>


login_succees.php
Code:

<?php
session_start();
echo "$_SESSION[userid]";
echo "Want To go to Home Page <a href='index.html'> home </a>";
?>
Sat Jul 24, 04 9:17 am
Back to top
tanveer View user's profile Send private message
quantum
Site Admin
Site Admin


Joined: 07 Mar 2004
Posts: 1048
Location: Dhaka, Bangladesh

Post Post subject: Reply with quote

Nice to see that you got it covered. And thanks for posting the code. Gentle smile
_________________

Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.
Sat Jul 24, 04 10:28 pm
Back to top
quantum View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    dna88 Forum Index -> Web scripting language Discussion Forum All times are GMT - 7 Hours
Goto page Previous  1, 2
Page 2 of 2

 

Partners and Resources

Bangladesh hosting company

Bangladesh web design

Driven by phpBB © phpBB Group