⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 show_blocked.php

📁 通达OA部分源代码
💻 PHP
字号:
<?
include "logincheck.php";
include_once "myconnect.php";
$msg1="";
$to_delete="";
$to_delete_countries="";
$items_removed=0;
if ( count($_POST)<>0 )
{
/////////////////////////// A REQUEST TO DELETE SOME blocked ///////////////

for($i=1;$i<=$_REQUEST["cnt"];$i++)
{
	if ( isset($_REQUEST["checkbox" . $i]) )  //Is the checkbox ticked
	{
	if ($to_delete!="") { $to_delete.="," ; }  //To insert comma??
	$to_delete.= $_REQUEST["checkbox" . $i];  //Add another item to delete
	$items_removed++;
	}

	if ( isset($_REQUEST["checkbox2" . $i]) )  //Is the checkbox ticked
	{
	if ($to_delete_countries!="") { $to_delete_countries.="," ; }  //To insert comma??
	$to_delete_countries.= $_REQUEST["checkbox2" . $i];  //Add another item to delete
	$items_removed++;
	}
} //End For
if (($to_delete=="")&&($to_delete_countries==""))
{
$msg1=" Unable to remove any entry from the Block List ";
}
else
{
$del_str="  Delete from sbbleads_blocked where sb_id IN (" . $to_delete .")";
mysql_query($del_str);
$del_str="  Delete from sbbleads_blocked_countries where sb_id IN (" . $to_delete_countries .")";
mysql_query($del_str);

$msg1= $items_removed . " Entry(ies) have been removed from your Block List";
}
header("Location:"." msg_confirm_mem.php?errmsg=".urlencode($msg1));
die();

/////////////////////////////blocked HAVE BEEN REMOVED /////////////////////
}

function main()
{

$rs0_query=mysql_query("Select * from sbbleads_members,sbbleads_blocked  where sbbleads_blocked.sb_blocked_id=sbbleads_members.sb_id and sb_uid =" .$_SESSION["sbbleads_userid"] );
$block_cntry_q=mysql_query("Select * from sbbleads_blocked_countries  where sb_uid =" .$_SESSION["sbbleads_userid"] );

$contact_count=mysql_num_rows($rs0_query)+mysql_num_rows($block_cntry_q);

	?>
<script language="JavaScript">
//<!--
function select_all()
{
  for (var i=0;i<document.form2.elements.length;i++)
  {
    var e =document. form2.elements[i];
    if ((e.name != 'check_all') && (e.type=='checkbox'))
    {
       e.checked = document.form2.check_all.checked;
    }
  }

}

function select_all2()
{
  for (var i=0;i<document.form3.elements.length;i++)
  {
    var e =document. form3.elements[i];
    if ((e.name != 'check_all') && (e.type=='checkbox'))
    {
       e.checked = document.form3.check_all.checked;
    }
  }

}

//-->
</script>

<table width="100%" border="0" cellpadding="0" cellspacing="0" dwcopytype="CopyTableRow">
  <tr> 
    <script language="JavaScript">
	function onselect_username()
	{
	document.form1.radio[0].checked=true;
	document.form1.email.value=""; 
	document.form1.country.selectedIndex=0;
	}
	function onselect_email()
	{
	document.form1.radio[1].checked=true;
	document.form1.username.value=""; 
	document.form1.country.selectedIndex=0;
	}
	function onselect_country()
	{
	document.form1.radio[2].checked=true;
	document.form1.email.value=""; 
	document.form1.username.value=""; 
	}
function validate(form)
{
	if((form.radio[0].checked==true)&&(form.username.value==""))
	{
	alert('Please specify Member ID');
	form.username.focus();
	return false;
	}
	if((form.radio[1].checked==true)&&(form.email.value==""))
	{
	alert('Please specify Email ID');
	form.email.focus();
	return false;
	}
	if((form.radio[2].checked==true)&&(form.country.selectedIndex==0))
	{
	alert('Please choose a country');
	form.country.focus();
	return false;
	}
	return true;
}
	</script>
    <form name="form1" method="post" action="addblock.php" onSubmit="return validate(this);">
      <td colspan="3" valign="top"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr> 
            <td class="titlestyle">&nbsp;Add to Block List</td>
          </tr>
          <tr> 
            <td><table width="100%" border="0" align="center" cellpadding="2" cellspacing="5" class="onepxtable">
                <tr> 
                  <td colspan="3" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td height="25" class="innertablestyle"> <div align="center"><font class="normal">&nbsp;<font class="red">NOTE:</font><font class="normal"> 
                            Once you blocked a user, you will not receive messages 
                            from that user any more.</font><br>
                            </font></div></td>
                      </tr>
                    </table></td>
                </tr>
                <tr valign="top"> 
                  <td width="40%" align="right" class="innertablestyle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr align="right"> 
                        <td width="60%"><font class="normal"><strong><font class='normal'> 
                          <input name="radio" type="radio" value="1" checked>
                          </font></strong></font></td>
                        <td><font class="normal"><strong><font class='normal'>Member 
                          ID</font></strong></font></td>
                      </tr>
                    </table></td>
                  <td width="6">&nbsp;</td>
                  <td width="60%"><font face="Arial, Helvetica, sans-serif" size="2"> 
                    <input type="text" name="username" onFocus="onselect_username();">
                    </font></td>
                </tr>
                <tr valign="top"> 
                  <td align="right" class="innertablestyle"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr align="right"> 
                        <td width="60%"> <input type="radio" name="radio" value="2"></td>
                        <td><font class="normal"><strong><font class='normal'>Email 
                          ID</font></strong></font></td>
                      </tr>
                    </table></td>
                  <td>&nbsp;</td>
                  <td><input name="email" type="text" id="email2" onFocus="onselect_email();"></td>
                </tr>
                <tr valign="top"> 
                  <td align="right" class="innertablestyle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr align="right"> 
                        <td width="60%"> <input type="radio" name="radio" value="3"></td>
                        <td><font class="normal"><strong><font class='normal'>Country</font></strong></font></td>
                      </tr>
                    </table></td>
                  <td>&nbsp;</td>
                  <td><font face="Arial, Helvetica, sans-serif" size="2"><strong><font color="#004566"> 
                    <select name="country" onFocus="onselect_country();">
                      <option selected value="">Select Country</option>
                      <?
$rs_t_query=mysql_query ("select * from sbbleads_country order by country");
while ($rs_t=mysql_fetch_array($rs_t_query))    
{
?>
                      <option  value="<? echo $rs_t["id"]  ?>"><? echo $rs_t["country"]  ; ?></option>
                      <?
		  }
		  		  ?>
                    </select>
                    </font></strong></font></td>
                </tr>
                <tr valign="top"> 
                  <td align="right" class="innertablestyle"><font class="normal"><strong><font class='normal'>Description</font></strong></font></td>
                  <td>&nbsp;</td>
                  <td> <input name="description" type="text" id="description2" value="" size="50" maxlength="100"></td>
                </tr>
                <tr valign="top"> 
                  <td align="right" class="innertablestyle">&nbsp;</td>
                  <td>&nbsp;</td>
                  <td><input type="submit" name="Submit2" value="Block User"></td>
                </tr>
              </table></td>
          </tr>
        </table> 
        
      </td>
    </form>
  </tr>
  <tr> 
    <td height="25" colspan="3" align="center" valign="middle">&nbsp;</td>
  </tr>
  <tr> 
    <td  valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td valign="top"> <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="onepxtable">
              <tr > 
                <td valign="top"> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" class="innertablestyle">
                    <tr> 
                      <td height="25" class="titlestyle">&nbsp;Block List</td>
                    </tr>
                    <tr> 
                      <td height="25" valign="top"><font class='normal'>Your block 
                        list contains <strong><font class='red'><?php echo $contact_count; ?></font></strong> 
                        entries.</font></td>
                    </tr>
                    <tr> 
                      <td height="25"><font class='normal'>To remove an entry 
                        from your block list just click the check box and click 
                        the remove button below.</font></td>
                    </tr>
                    <tr> 
                      <td valign="top"> <form name="form2" method="post" action="show_blocked.php">
                          <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1">
                            <tr class="subtitle"> 
                              <td width="10" align="right"> <input name="check_all" type="checkbox" id="check_all" onClick="select_all();" value="yes"></td>
                              <td width="50%" height="25"><b><font class='normal'>Username</font></b></td>
                              <td width="50%"><b><font class='normal'>Description</font></b></td>
                            </tr>
                            <?
$cnt=0;
while ($rs0=mysql_fetch_array($rs0_query))
{
$cnt++;
?>
                            <tr> 
                              <td width="10" align="right" ><font class='normal'> 
                                <input type="checkbox" name="checkbox<?php echo $cnt;?>" value="<?php
							   echo $rs0["sb_id"];?>">
                                </font></td>
                              <td ><font class='normal'> <?php echo $rs0["sb_username"];?> 
                                </font></td>
                              <td ><font class='normal'> <?php echo $rs0["sb_desc"];?> 
                                </font></td>
                            </tr>
                            <?
}
?>
                            <tr > 
                              <td colspan="2" align="left"> <input type="hidden" name="cnt" value="<?php echo $cnt; ?>"> 
                                <input type="submit" name="Submit3" value="Remove"> 
                              </td>
                              <td width="50%">&nbsp;</td>
                            </tr>
                          </table>
                        </form></td>
                    </tr>
                    <tr> 
                      <td valign="top"> <form name="form3" method="post" action="show_blocked.php">
                          <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1">
                            <tr class="subtitle"> 
                              <td width="10" align="right"> 
                                <input type="checkbox" name="check_all" value="yes" onClick="select_all2();"></td>
                              <td width="50%" height="25" align="left"><b><font class='normal'>Country</font></b></td>
                              <td width="50%"><b><font class='normal'>Description</font></b></td>
                            </tr>
                            <?
							$cnt=0;
							while ($rs0=mysql_fetch_array($block_cntry_q))
							{
							$cnt++;
							?>
                            <tr> 
                              <td width="10" align="right" ><font class='normal'> 
                                <input type="checkbox" name="checkbox2<?php echo $cnt;?>" value="<?php
							   echo $rs0["sb_id"];?>">
                                </font></td>
                              <td width="50%" align="left" ><font class='normal'> 
                                <?php 
						  $country=mysql_fetch_array(mysql_query("select * from sbbleads_country
						  where id=".$rs0["sb_blocked_id"]));
							  echo $country["country"];?>
                                </font></td>
                              <td width="50%" ><font class='normal'> <?php echo $rs0["sb_desc"];?> 
                                </font></td>
                            </tr>
                            <?
							}
							?>
                            <tr > 
                              <td colspan="2" align="left"> <input name="cnt" type="hidden" id="cnt" value="<?php echo $cnt; ?>"> 
                                <input type="submit" name="Submit32" value="Remove"> 
                              </td>
                              <td width="50%">&nbsp;</td>
                            </tr>
                          </table>
                        </form></td>
                    </tr>
                  </table></td>
              </tr>
            </table></td>
        </tr>
        <tr> 
          <td>&nbsp;</td>
        </tr>
        <tr> 
          <td valign="top"> <div align="center"></div></td>
        </tr>
      </table></td>
  </tr>
</table>
  <?
}// end main
include "template1.php";
?> 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -