Advertisement
mobilefish

Untitled

Jan 4th, 2021
1,116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.20 KB | None | 0 0
  1. <?php
  2. include 'include.php';
  3. mysql_connect("$host", "$username", "$password")or die("cannot connect");
  4. mysql_select_db("$db_name")or die("cannot select DB");
  5. $mode='';
  6. $id='';
  7. session_start();
  8. if(!isset($_SESSION['username']) || trim($_SESSION['username'])=='')
  9. {
  10.     header("location:index.php");
  11. }
  12. else
  13. {
  14.     $username=$_SESSION['username'];
  15.     $usertype=$_SESSION['usertype'];
  16.  
  17. }
  18. ?>
  19.  
  20. <?php
  21.     $mode=$_GET["mode"];
  22.     $id=$_GET["id"];
  23.    
  24.     if ($mode=='A')
  25.     {
  26.         $result1=mysql_query("update member_master set m_active=1 where m_id=".$id);
  27.         header("location:activate_user.php");  
  28.  
  29.     }
  30.     if ($mode=='D')
  31.     {
  32.         $result1=mysql_query("update member_master set m_active=0 where m_id=".$id);   
  33.         header("location:activate_user.php");  
  34.  
  35.    
  36.     }
  37.    
  38.  
  39.  
  40. ?>
  41.  
  42.  
  43. <html>
  44.  
  45. <head>
  46. <meta http-equiv="Content-Language" content="en-us">
  47. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  48. <title>eExamination :: Users Admin</title>
  49. <link href="style/Style1.css" rel="stylesheet" type="text/css" />
  50.  
  51. </head>
  52.  
  53. <body>
  54. <form name="form1"   method="post" action="activate_user.php" >
  55. <div align="center">
  56.     <table border="0" width="100%" cellspacing="1" height="100%" id="table1">
  57.         <tr>
  58.             <td  align="center" class ="td_top">
  59.                            
  60.                        <?php
  61.             include 'header.php';
  62.             ?> 
  63.                         </td>
  64.         </tr>
  65.         <tr>
  66.             <td  align="left" class ="td_topvav" >
  67.             <table width ="100%" align ="left">
  68.                 <tr>
  69.                     <td width="33%" align ="left" style="padding-left: 10px" valign="top">
  70.                         Welcome <b><?php echo($username.'</b> ('.$usertype.')') ?>  
  71.                     </td>
  72.                     <td  width="64%" align="right" style="padding-right: 10px" valign="top">
  73.                    
  74.  
  75.                                         <?php
  76.                                             include 'menu.php';
  77.                     ?>
  78.                     </td>
  79.                 </tr>
  80.  
  81.  
  82.             </table>
  83.            
  84.            
  85.            
  86.             </td>
  87.         </tr>
  88.        
  89.         <tr >
  90.             <td align="center" >
  91.             &nbsp;
  92.  
  93.                
  94.                 <br>
  95. &nbsp;<?php
  96.                
  97.                     //get feedback
  98.                     $result = mysql_query("select * from member_master order by m_id ");
  99.                     $count=mysql_num_rows($result);
  100.                    
  101.                 ?>
  102.             <table border="1" width="660" cellspacing="1" id="table12" style="border-collapse: collapse">
  103.                 <tr>
  104.                     <td colspan="4" class="td_tablecap"><?php echo($count); ?>
  105.                     Members&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
  106.                 </tr>
  107.                 <tr>
  108.                     <td width="100" class="td_tablehead">Join Date</td>
  109.                     <td width="200" class="td_tablehead">Name</td>
  110.                     <td width="205" class="td_tablehead">Email ID</td>
  111.                     <td width="98" class="td_tablehead">Activate</td>
  112.                 </tr>
  113.                
  114.                 <?php
  115.                
  116.                 if ($count>0)
  117.                 {
  118.                     $i=0;
  119.                     $j='';
  120.                     for($i=0;$i<$count; $i++)
  121.                     {
  122.                         $j=$i+1;
  123.                         echo("<tr>");
  124.                             echo("<td width='170' align ='center' valign ='top'>".mysql_result($result,$i,"m_createdate")."</td>");
  125.                             echo("<td width='200' align ='left' valign ='top'>".mysql_result($result,$i,"m_name")."</td>");
  126.                             echo("<td width='205' align ='left' valign ='top'>".mysql_result($result,$i,"m_emailid")."</td>");
  127.                            
  128.                             if (mysql_result($result,$i,"m_active")==0)
  129.                             {
  130.                                    
  131.                                                             $link_text="<a href='activate_user.php?mode=A&id=".mysql_result($result,$i,"m_id")."'>Activate</a>";
  132.  
  133.                             }
  134.                             else
  135.                             {
  136.  
  137.                                                             $link_text="<a href='activate_user.php?mode=D&id=".mysql_result($result,$i,"m_id")."'>Deactivate</a>";
  138.  
  139.                             }
  140.                            
  141.                            
  142.                             echo("<td width='98' align ='left' valign ='top'>".$link_text."</td>");
  143.                         echo("</tr>");
  144.                     }
  145.                 }
  146.                 else
  147.                 {
  148.                             echo("<td width='51' align ='center' valign ='top'>&nbsp;</td>");
  149.                             echo("<td width='205' align ='left' valign ='top'>&nbsp;</td>");
  150.                             echo("<td width='98' align ='left' valign ='top'>&nbsp;</td>");
  151.                 }
  152.                
  153.                 ?>
  154.             </table>
  155.             <p>&nbsp;</td>
  156.         </tr>
  157.         <tr>
  158.             <td  align="center" class ="td_copyright">
  159.                            
  160.                                         <?php
  161.             include 'footer.php';
  162.             ?>
  163.                         </td>
  164.         </tr>
  165.        
  166.        
  167.     </table>
  168. </div>
  169. </form>
  170. </body>
  171.  
  172. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement