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

📄 choose_membership.php

📁 通达OA部分源代码
💻 PHP
字号:
<?
include_once'logincheck.php';
include_once("session.php");
include_once "myconnect.php";

function main()
{

	$rs0=mysql_query("select * from sbbleads_levels order by sb_id");
	$row0=mysql_fetch_array($rs0);
	$sbtop=$row0["sb_levelname"];
	$sbtop_desc=$row0["sblevel_text"];

	$row0=mysql_fetch_array($rs0);
	$sbmiddle=$row0["sb_levelname"]; 
	$sbmiddle_desc=$row0["sblevel_text"];

	$row0=mysql_fetch_array($rs0);
	$sblowest=$row0["sb_levelname"]; 
	$sblowest_desc=$row0["sblevel_text"];


?>
<div align="center"> 
  <table width="90%" border="0" cellspacing="0" cellpadding="0">
    <tr> 
      <td> <div align="center">
          <?  
	$rs_group=mysql_query("select * from sbbleads_groups order by sb_id");
	$group=mysql_fetch_array($rs_group);
	$sbgold_cat=$group["sb_cat_cnt"];
	$sbgold_img=$group["sb_img_cnt"];

	$group=mysql_fetch_array($rs_group);
	$sbsilver_cat=$group["sb_cat_cnt"];
	$sbsilver_img=$group["sb_img_cnt"];
	
	$group=mysql_fetch_array($rs_group);
	$sbbronze_cat=$group["sb_cat_cnt"];
	$sbbronze_img=$group["sb_img_cnt"];
	$config=mysql_fetch_array(mysql_query("select * from sbbleads_config"));
	$errcnt=0;
	$showform="";
	if ( count($_POST)<>0 )
	{
	
		if ( !isset( $_REQUEST["upgradeto"] ) || $_REQUEST["upgradeto"]=="" )
		{
			$errs[$errcnt]="You have not chosen a membership level to upgrade to.";
			$errcnt++;
		}
		elseif( isset($_REQUEST["upgradeto"]) && ($_REQUEST["upgradeto"]==$_SESSION["sbbleads_memtype"]))
		{
			$errs[$errcnt]="You have not chosen a membership level to upgrade to.";
			$errcnt++;
		}
		
		if(($errcnt==0))
		{
		
			$showform='no';
//////--------------
		//SENDING MAIL TO MEMBER////////////////////////

			if( ($_REQUEST["upgradeto"]==1) && ($_SESSION["sbbleads_memtype"]==3))
			{
				$current_level=$sblowest;
				$upgrade_level=$sbtop;
				$upgrade_fee=SBCURRENCY.$config["sbfee_bg"];
			}
			elseif( ($_REQUEST["upgradeto"]==1) && ($_SESSION["sbbleads_memtype"]==2))
			{
				$current_level=$sbmiddle;
				$upgrade_level=$sbtop;
				$upgrade_fee=SBCURRENCY.$config["sbfee_sg"];
			}
			elseif( ($_REQUEST["upgradeto"]==2) && ($_SESSION["sbbleads_memtype"]==3))
			{
				$current_level=$sblowest;
				$upgrade_level=$sbmiddle;
				$upgrade_fee=SBCURRENCY.$config["sbfee_bs"];
			}
	$row_con=mysql_fetch_array(mysql_query("select * from sbbleads_config where sb_id=1"));
	$sb_null_char=$row_con["sb_null_char"];
	$login_url=$row_con["sb_site_root"]."/signin.php";
	$ondate=sb_date(date(time()));

	$sbq_mem="select * from sbbleads_members where sb_id=".$_SESSION["sbbleads_userid"];
	$sbrow_mem=mysql_fetch_array(mysql_query($sbq_mem));
	
	

//Reads email to be sebt
$sql = "SELECT * FROM sbbleads_mails where sb_mailid=25";
//echo $sql; 
$rs_query=mysql_query($sql);

if ( $rs=mysql_fetch_array($rs_query)  )
  {
			 $from =$rs["sb_fromid"];
			 $to = $sbrow_mem["sb_email"];
			 $subject =$rs["sb_subject"];
		     $header="From:" . $from . "\r\n" ."Reply-To:". $from  ;

			 $body=str_replace("%email%", $sb_null_char,str_replace("%password%",$sb_null_char,str_replace("%lname%", $sbrow_mem["sb_lastname"],str_replace("%fname%", $sbrow_mem["sb_firstname"],str_replace("%username%",$sbrow_mem["sb_username"], $rs["sb_mail"]) )))); 
				
			$body=str_replace("%signup_url%",$sb_null_char,str_replace("%login_url%",$login_url,$body));

		 $body=str_replace("%message_text%",$sb_null_char,str_replace("%message_title%",$sb_null_char,str_replace("%sender_username%",$sb_null_char,str_replace("%message_date%",$sb_null_char,$body))));	
 
 		$body=str_replace("%visitor_name%",$sb_null_char,$body);

 		$body=str_replace("%current_level%",$current_level,str_replace("%upgrade_level%",$upgrade_level,str_replace("%upgrade_fee%",$upgrade_fee,$body)));
		
	 	if(isset($rs["sb_html_format"])&&($rs["sb_html_format"]=="yes"))
		{
			$header .= "\r\nMIME-Version: 1.0";
			$header .= "\r\nContent-type: text/html; charset=iso-8859-1\r\n";
	//		$body=str_replace("\n","<br>",$body);
		}
 
 //	echo "--from:-$from----to:-$to---sub:-$subject----head:-$header----";
//	 echo "<pre>$body</pre>";
//	 die();
	if( $rs["sb_status"]=='yes')
	 	@mail($to,$subject,$body,$header);
  } ?>
          <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="onepxtable">
            <tr height="10"> 
              <td class="titlestyle">&nbsp;Upgrade Membership</td>
            </tr>
            <tr valign="top" > 
              <td height="25" valign="middle" class="innertablestyle">&nbsp;&nbsp;A 
                mail has been sent to you please follow the instructions given 
                in that to complete this process.</td>
            </tr>
          </table>
<?php
//die();
///////////---------			
		}
	
	}
  
  
if  (count($_POST)>0)
{

if ( $errcnt > 0 )
{
?>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="errorstyle">
  <tr> 
    <td colspan="2"><strong>&nbsp;Your request cannot be processed due to following 
      reasons</strong></td>
  </tr>
  <tr height="10"> 
    <td colspan="2"></td>
  </tr>
  <?

for ($i=0;$i<$errcnt;$i++)
{
?>
  <tr valign="top"> 
    <td width="6%">&nbsp;<?php echo $i+1;?></td>
    <td width="94%"><?php echo  $errs[$i]; ?></td>
  </tr>
  <?
}
?>
</table>
<br>
<?

}

}

  
    if($showform<>"no")
	{
	?><script language="JavaScript">
	function validate(frm)
	{
		
		if(frm.upgradeto[frm.upgradeto.length-1].checked == true)
		{
			alert("Please select membership type other than current");
			frm.upgradeto[0].focus();
			return false;
		}
		return true;
	}
	</script>
            
          <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
            <?php 
		if($_SESSION["sbbleads_memtype"]<>1)
		{
		?>
            <form name="form1" method="post" action="choose_membership.php" onSubmit="return validate(this);">
              <?php 
			  if( ($_SESSION["sbbleads_memtype"] > 1) && ($_SESSION["sbbleads_memtype"] <= 3) )
			  {?>
              <tr> 
                <td class="onepxtable"> <table width="100%" border="0" cellspacing="0" cellpadding="0" class=innertablestyle>
                    <tr> 
                      <td height="25" class="titlestyle"> <font face="Arial, Helvetica, sans-serif" size="2"><strong> 
                        <input name="upgradeto" type="radio" value="1" <?php echo ($_SESSION["sbbleads_memtype"]==1)?'checked':''; ?>>
                        </strong></font><strong><?php echo $sbtop; ?></strong><font color="#333333" size="2" face="Arial, Helvetica, sans-serif"><strong> 
                        <input name="id" type="hidden" id="id2" value="<? echo $_REQUEST["id"];?>">
                        </strong></font></td>
                    </tr>
                    <tr> 
                      <td> <p align="left"><strong>&nbsp;By getting this level 
                          membership you can:</strong></p>
                        <ul>
                          <li> 
                            <div align="left"><strong>Post each product in <? echo $sbgold_cat;?> 
                              Categories</strong></div>
                          </li>
                          <li> 
                            <div align="left"><strong>And <? echo $sbgold_img;?> 
                              images per product</strong></div>
                          </li>
                          <!--li><strong>A custom company website</strong></li-->
                          <?php 
						  	if($_SESSION["sbbleads_memtype"] > 1)
						  	{
						  ?>
                          <li><strong>Fee ( 
                            <? 
						echo SBCURRENCY;
						 if($_SESSION["sbbleads_memtype"]==3)
						  	echo $config["sbfee_bg"];
						 elseif($_SESSION["sbbleads_memtype"]==2)
						 	echo $config["sbfee_sg"];
						 ?>
                            /Yr) </strong></li>
                          <?php 
							}	//end if ?>
                        </ul>
                        <table width="100%" border="0" cellspacing="0" cellpadding="4" class="innertablestyle">
                          <tr>
                            <td><p align="left"><strong>Other benefits:</strong></p>
                        <strong><?php echo $sbtop_desc; ?></strong></td>
                          </tr>
                        </table>
                        </td>
                    </tr>
                    
                  </table></td>
              </tr>
              <?php 
			  } //end if 
			  if( ($_SESSION["sbbleads_memtype"] == 3) || ($_SESSION["sbbleads_memtype"] == 2))
			  {?>
              <tr> 
                <td>&nbsp;</td>
              </tr>
              <tr> 
                <td class="onepxtable"> <table width="100%" border="0" cellspacing="1" cellpadding="1" class="innertablestyle">
                    <tr> 
                      <td height="25" class="titlestyle"> <input type="radio" name="upgradeto" value="2" <?php echo ($_SESSION["sbbleads_memtype"]==2)?'checked':''; ?>> 
                        <strong><?php echo $sbmiddle; ?></strong><?php echo ($_SESSION["sbbleads_memtype"]==2)?'&nbsp;&nbsp;(Your Current Membership Type)':''; ?></td>
                    </tr>
                    <tr> 
                      <td class="tdblue"><p align="left"><strong>&nbsp;By getting 
                          this level membership you can:</strong></p>
                        <ul>
                          <li> 
                            <div align="left"><strong>Post each product in <? echo $sbsilver_cat;?> 
                              Categories</strong></div>
                          </li>
                          <li> 
                            <div align="left"><strong>And <? echo $sbsilver_img;?> 
                              images per product</strong></div>
                          </li><?php 
						  if($_SESSION["sbbleads_memtype"] > 2)
						  {
						  ?>
                          <li> 
                            <div align="left"><strong>Fee (<?php echo SBCURRENCY.$config["sbfee_bs"]; ?>/Yr) 
                              </strong></div>
                          </li><?php 
						  }		//end if
						  ?>
                        </ul><table width="100%" border="0" cellspacing="0" cellpadding="4" class="innertablestyle">
                          <tr>
                            <td><p align="left"><strong>Other benefits:</strong></p>
                        <strong><?php echo $sbmiddle_desc; ?></strong></td>
                          </tr>
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
              <?php 
			  } //end if  ?>
              <?php 
			  if( ($_SESSION["sbbleads_memtype"] == 3) )
			  {?>
              <tr> 
                <td>&nbsp;</td>
              </tr>
              <tr> 
                <td class="onepxtable"> <table width="100%" border="0" cellspacing="1" cellpadding="1" class="innertablestyle">
                    <tr> 
                      <td height="25" class="titlestyle"> <input type="radio" name="upgradeto" value="3" <?php echo ($_SESSION["sbbleads_memtype"]==3)?'checked':''; ?>> 
                        <strong><?php echo $sblowest; ?></strong><?php echo ($_SESSION["sbbleads_memtype"]==3)?'&nbsp;&nbsp;(Your Current Membership Type)':''; ?></td>
                    </tr>
                    <tr> 
                      <td class="tdblue"><p align="left"><strong>&nbsp;By getting 
                          Silver level membership you can:</strong></p>
                        <ul>
                          <li> 
                            <div align="left"><strong>Post each product in <? echo $sbbronze_cat;?> 
                              Categories</strong></div>
                          </li>
                          <li> 
                            <div align="left"><strong>And <? echo $sbbronze_img;?> 
                              images per product</strong></div>
                          </li>
						  <?php 
						  if($_SESSION["sbbleads_memtype"] > 3)
						  {
						  ?>
                          <li> 
                            <div align="left"><strong>Fee (<?php echo SBCURRENCY.$config["sbfee_bs"]; ?>/Yr) 
                              </strong></div>
                          </li><?php 
						  }		//end if mshiptype
						  ?>
                        </ul><table width="100%" border="0" cellspacing="0" cellpadding="4" class="innertablestyle">
                          <tr>
                            <td><p align="left"><strong>Other benefits:</strong></p>
                        <strong><?php echo $sblowest_desc; ?></strong></td>
                          </tr>
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
              <?php 
			  } //end if  ?>
              <tr> 
                <td>&nbsp;</td>
              </tr>
              <tr> 
                <td>&nbsp;</td>
              </tr>
              <tr> 
                <td><input type="submit" name="Submit2" value="Continue"></td>
              </tr>
            </form>
            <?php 
			}		//end if mshiptype <> 1
			else
			{
			?>
            <tr> 
              <td class="titlestyle" height="25">&nbsp;Upgrade Membership</td>
            </tr>
            <tr > 
              <td height="25" class="onepxtable">
			  <table width="100%" border="0" cellspacing="0" cellpadding="0" class="innertablestyle">
                  <tr>
                    <td height="25"><font class='normal'>&nbsp;&nbsp;Your current 
                      membership level is 
                      <?php 
					switch($_SESSION["sbbleads_memtype"])
					{
						case 1:
							echo $sbtop;
							break;
						case 2:
							echo $sbmiddle;
							break;
						case 3:
							echo $sblowest;
							break;
					}
				
				?>
                      , which is the maximum level any one can attain.</font></td>
                  </tr>
                </table>
				</td>
            </tr>
            <?php 		}	//end else mshiptype=1	?>
          </table>
         
         </div></td>
    </tr>
  </table>
  <?
  }
  ?>
</div>
<?php 
}		//end main
include_once"template1.php";
?>

⌨️ 快捷键说明

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