0

Hi all,
I am developing an website which is required to hide and show HTML. like if visitors user and password are correct then will show "You are logged in as "Namd " "Edit" "Logout" ,as
and if logout is pressed then "user name " "password " "forgot password ?" "registration"
as
very urgent . link www.csoftindia.net ,example :www.csoft.com
Subrata Nandi, Kolkata, West Bengal,India

Attachments blogin.JPG 35.13 KB blogoff.JPG 29.43 KB
2
Contributors
8
Replies
10
Views
5 Years
Discussion Span
Last Post by pritaeas
0

First image is user and password: if visitor's user and password is correct then first image(actually HTML) will be hidden showing the second image(html) . when logged out using second image(actually html) then second will be hidden show the first image(html). Is it clear ?
Subrata

0

ok again I am giving : Initially I had this html:
<tr>
<td width="1" bgcolor="#94C0E9"><img src="/img/ui/spacer.gif" width="1" height="1" border="0" alt="CSoft - Hybrid Graphics Editor and Raster to Vector Converter (R2V)"></td>
<td width="148" bgcolor="#ffffff" align="left" valign="top">

<table width="148" class="leftMenuText">
<form name="login" action="/include/logincheck.cfm" method="post">
<tr>
<td width="4"></td>
<td width="140">Username:<br><input class="inputbox" type="text" name="usr" size="15" maxlength="255"></td>

<td width="4"></td>
</tr>
<tr>
<td width="4"></td>
<td width="140">Password:<br><input class="inputbox" type="password" name="psw" size="10" maxlength="50">&nbsp;&nbsp;&nbsp;
<input type="hidden" name="menuid" value="2">
<input class="inputButton" type="submit" value="go">
</td>

<td width="4"></td>
</tr>
</form>
<tr>
<td class="logincontent" colspan="3">
<a href="/index.cfm?notPage=register&action=view&menuid=2">Register here!</a><br>
<a href="/index.cfm?notPage=password&action=view&menuid=2">Forgot your password?</a>
</td>

</tr>
</table>

</td>
<td width="1" bgcolor="#94C0E9"><img src="/img/ui/spacer.gif" width="1" height="1" border="0" alt="CSoft - Hybrid Graphics Editor and Raster to Vector Converter (R2V)"></td>
</tr>


when login is successful giving user and password then this html will be shown given below hiding the above html :

<tr>
<td width="1" bgcolor="#94C0E9"><img src="/img/ui/spacer.gif" width="1" height="1" border="0" alt="CSoft - Hybrid Graphics Editor and Raster to Vector Converter (R2V)"></td>
<td width="148" bgcolor="#ffffff" align="left" valign="top">

<table border="0" width="100%" cellspacing="4" cellpadding="0" bgcolor="#ffffff">
<tr>
<td class="leftLogin" align="center">
Logged in as:<br>
<b>

subrata nandi
</b>
<br>
<br>
<a href="/index.cfm?notPage=register&action=edit&menuid=2">Edit</a>
<!-- <a href="/login/register/edit.htm#2">Edit</a> --->
<!-- <a href="/login/register/edit_2.htm">Edit</a> -->
&nbsp;&nbsp;|&nbsp;&nbsp;
<a href="/include/logout.cfm">Log out</a>

<!-- <a href="/login/logout/logout.htm">Log out</a> -->
</td>
</tr>
</table>

</td>
<td width="1" bgcolor="#94C0E9"><img src="/img/ui/spacer.gif" width="1" height="1" border="0" alt="CSoft - Hybrid Graphics Editor and Raster to Vector Converter (R2V)"></td>
</tr>
when logged out ,this will show the login portion again hiding the logout portion
SUBRATA

0

here is the code

 <?php 
                                          if(!empty($_REQUEST['txtuser']) && !empty($_REQUEST['txtpassword']))
                                             {
                                                $txtuser=$_REQUEST['txtuser'];
                                                $txstpassword=$_REQUEST['txtpassword'];
                                                $usersql="select * from register where email='$txtuser' and password='$txstpassword'";
                                                $userqry=mysql_query($usersql);
                                                $userrow=mysql_num_rows($userqry);

                                                $userres=mysql_fetch_array($userqry);
                                                if($userrow>0)
                                                   {?>
                                                  <tr>
            <td width="1" bgcolor="#94C0E9"><img src="/img/ui/spacer.gif" width="1" height="1" border="0" alt="CSoft - Hybrid Graphics Editor and Raster to Vector Converter (R2V)"></td>
            <td width="148" bgcolor="#ffffff" align="left" valign="top">

             <table width="148" class="leftMenuText">
              <form name="login" action="/include/logincheck.cfm" method="post">
              <tr>
               <td width="4"></td>
               <td width="140">Username:<br><input class="inputbox" type="text" name="usr" size="15" maxlength="255"></td>

               <td width="4"></td>
              </tr>
              <tr>
               <td width="4"></td>
               <td width="140">Password:<br><input class="inputbox" type="password" name="psw" size="10" maxlength="50">&nbsp;&nbsp;&nbsp;
                <input type="hidden" name="menuid" value="2">
                <input class="inputButton" type="submit" value="go">
               </td>

               <td width="4"></td>
              </tr>
              </form>
              <tr>
               <td class="logincontent" colspan="3">
                <a href="/index.cfm?notPage=register&action=view&menuid=2">Register here!</a><br>
                <a href="/index.cfm?notPage=password&action=view&menuid=2">Forgot your password?</a>
               </td>

              </tr>
             </table>

            </td>
            <td width="1" bgcolor="#94C0E9"><img src="/img/ui/spacer.gif" width="1" height="1" border="0" alt="CSoft - Hybrid Graphics Editor and Raster to Vector Converter (R2V)"></td>
           </tr>
                                                   <?php
                                                else
                                                  {
                                                  ?>
                                                 <tr>
            <td width="1" bgcolor="#94C0E9"><img src="/img/ui/spacer.gif" width="1" height="1" border="0" alt="CSoft - Hybrid Graphics Editor and Raster to Vector Converter (R2V)"></td>
            <td width="148" bgcolor="#ffffff" align="left" valign="top">

             <table border="0" width="100%" cellspacing="4" cellpadding="0" bgcolor="#ffffff">
              <tr>
               <td class="leftLogin" align="center">
                Logged in as:<br>
                  <b>

    subrata nandi
                  </b>
                  <br>
                  <br>
                   <a href="/index.cfm?notPage=register&action=edit&menuid=2">Edit</a>
<!--                   <a href="/login/register/edit.htm#2">Edit</a> --->
<!--                  <a href="/login/register/edit_2.htm">Edit</a> -->
                  &nbsp;&nbsp;|&nbsp;&nbsp;
                   <a href="/include/logout.cfm">Log out</a> 

<!--                  <a href="/login/logout/logout.htm">Log out</a> -->
               </td>
              </tr>
             </table>

            </td>
            <td width="1" bgcolor="#94C0E9"><img src="/img/ui/spacer.gif" width="1" height="1" border="0" alt="CSoft - Hybrid Graphics Editor and Raster to Vector Converter (R2V)"></td>
           </tr>
                                             <?php     }
                                             }
                                            ?>

SUBRATA

Edited by Dani: Formatting fixed

0

Use code tags next time please.

The logic of your if's appear to be in the wrong order, and your curly brackets appear in the wrong place. It should be something like this:

if(!empty($_REQUEST['txtuser']) && !empty($_REQUEST['txtpassword']))
{
  $txtuser=$_REQUEST['txtuser'];
  $txstpassword=$_REQUEST['txtpassword'];
  $usersql="select * from register where email='$txtuser' and password='$txstpassword'";
  $userqry=mysql_query($usersql);
  $userrow=mysql_num_rows($userqry);
  $userres=mysql_fetch_array($userqry);
}
else
{
  $userrow = 0;
}

if ($userrow == 0)
{
  // NOT LOGGED IN CODE HERE
}
else
{
  // LOGGED IN CODE HERE
}

Fill in the blanks.

Edited by pritaeas: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.