📄 companyprofile.php
字号:
//------------------------------------------------------------------------------------------
mysql_query("delete from sbbleads_profile_cats where sb_profile_id=".$_POST["profile_id"]);
foreach($cat as $cid)
{
$check_cat=mysql_fetch_array(mysql_query("select * from sbbleads_profile_cats
where sb_cid=$cid and sb_profile_id=".$_POST["profile_id"]));
if(!$check_cat)
{
mysql_query("insert into sbbleads_profile_cats (sb_cid,sb_profile_id) values ($cid,".$_POST["profile_id"].")");
}
}
mysql_query("delete from sbbleads_profile_markets where sb_profile_id=".$_POST["profile_id"]);
foreach($markets_arr as $market)
{
$check_market=mysql_fetch_array(mysql_query("select * from sbbleads_profile_markets
where sb_market=$market and sb_profile_id=".$_POST["profile_id"]));
if(!$check_market)
{
mysql_query("insert into sbbleads_profile_markets (sb_market,sb_profile_id) values ($market,".$_POST["profile_id"].")");
}
}
if(mysql_affected_rows()>0)
{
if($approved=="yes")
{
header ("Location: gen_confirm_mem.php?sb_type=4&id=$sb_profile_id&errmsg=".urlencode($sb_msg));
}
else
{
header ("Location: gen_confirm_mem.php?errmsg=".urlencode($sb_msg));
}
die();
}
header("Location: gen_confirm_mem.php?err=companyprofile&errmsg=".urlencode("Sorry, no updations carried out."));
die();
}
}// end if no errs
}//if form posted
function main()
{
global $errs, $errcnt;
$sql="Select * from sbbleads_groups where sb_memtype=".$_SESSION["sbbleads_memtype"];
$rs0_query=mysql_query($sql);
$rs0=mysql_fetch_array($rs0_query);
$cats=$rs0["sb_profilecat_cnt"];
$allowed= $rs0["sb_profile"];
$posturl= $rs0["sb_posturl"];
if ($allowed!="yes")
{
?>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="errorstyle">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"> You are not allowed to post/edit company profile.</td>
</tr>
<tr>
<td colspan="2"> You can consider upgrading your membership level if
you are at bronze or silver level.</td>
</tr>
</table>
<?php
}
else
{
?>
<script language="JavaScript" type="text/javascript" src="richtext.js"></script>
<script language="JavaScript">
<!--
/* function add_category()
{
if(document.form123.cats.value!=0)
{
var id=document.form123.cats.selectedIndex;
if(document.form123.category.value=="")
{
document.form123.cid.value=document.form123.cats.value;
document.form123.category.value=document.form123.cats.options[id].text;
document.form123.category.focus();
document.form123.cats.selectedIndex=0;
}
else
{
document.form123.cid.value=document.form123.cid.value+";"+document.form123.cats.value;
document.form123.category.value=document.form123.category.value+";"+document.form123.cats.options[id].text;
document.form123.category.focus();
document.form123.cats.selectedIndex=0;
}
}
else
{
alert('Choose a Category to add!');
}
}
*/
function add_category()
{
if(document.form123.cats.value!=0)
{
var id=document.form123.cats.selectedIndex;
//////-------checking duplicate category
var cid_list=form123.cid.value.split(";");
var cnt=0;
var posted="no";
while(cnt<cid_list.length)
{
if(cid_list[cnt]==document.form123.cats.value)
{ posted="yes";}
cnt++;
}
if(posted=="yes")
{
alert('This category is already in the list');
return false;
}
//////-------end checking duplicate category
//////-------checking max no. of categories
var sblength;
if(document.form123.category.value == "")
sblength=0;
else
sblength=cid_list.length
if( sblength >= <?php echo $cats; ?> )
{
alert("You can't choose more than <?php echo ($cats==1)?$cats.' category':$cats.' categories'; ?>");
return false;
}
//////-------checking max no. of categories
if(document.form123.category.value=="")
{
document.form123.cid.value=document.form123.cats.value;
document.form123.category.value=document.form123.cats.options[id].text;
document.form123.category.focus();
document.form123.cats.selectedIndex=0;
}
else
{
document.form123.cid.value=document.form123.cid.value+";"+document.form123.cats.value;
document.form123.category.value=document.form123.category.value+";"+document.form123.cats.options[id].text;
document.form123.category.focus();
document.form123.cats.selectedIndex=0;
}
}
else
{
alert('Choose a Category to add');
}
}
function remove_category()
{
var s1=window.document.form123.category.value;
var s2=s1.split(";");
var i=0;
var id=document.form123.cats.selectedIndex;
var s3=document.form123.cats.options[id].text;
var id_list=document.form123.cid.value;
var id_split=id_list.split(";");
var rem_id=document.form123.cats.value;
window.document.form123.category.value="";
window.document.form123.cid.value="";
while(i<s2.length)
{
//alert('Checking '+s2[i]+' nnn with'+s3+' mm');
if(s3==s2[i])
{
//continue;
// alert('Removing'+s3);
}
else
{
if(document.form123.category.value=="")
{
document.form123.category.value=s2[i];
}
else
{
document.form123.category.value=document.form123.category.value+";"+s2[i];
}
}
if(rem_id==id_split[i])
{
//continue;
// alert('Removing'+s3);
}
else
{
if(document.form123.cid.value=="")
{
document.form123.cid.value=id_split[i];
}
else
{
document.form123.cid.value=document.form123.cid.value+";"+id_split[i];
}
}
i++;
}
//window.document.form123.related.value="";
//window.document.form123.rel_id.value="";
}
function attachment(box)
{
str="fileupload.php?box=" + box;
window.open(str,"Attachment","top=5,left=30,toolbars=no,maximize=yes,resize=yes,width=350,height=450,location=no,directories=no,scrollbars=yes");
}
function category(box)
{
str="choosecategory.php?box=" + box;
window.open(str,"Category","top=5,left=30,toolbars=no,maximize=yes,resize=yes,width=550,height=450,location=no,directories=no,scrollbars=yes");
}
function removeattachment(box)
{
window.document.form123.list1.value=""
}
function validate(form)
{
updateRTEs();
if ( form.companyname.value == "" ) {
alert('Please Specify Companyname!');
form.companyname.focus();
return false;
}
if(form.companyname.value.match(/[&<>]+/))
{
alert("Please remove Invalid characters from Companyname (e.g. & < >)");
form.companyname.focus();
return(false);
}
if ( form.businesstype.value == "" ) {
alert('Please Choose a Business Type!');
form.businesstype.focus();
return false;
}
if(form.cid.value == "")
{
alert('Please Choose atleast a Category!');
form.cats.focus();
return false;
}
if ( form.services.value == "" ) {
alert('Please Specify Products/Services!');
return false;
}
var checked='no';
var count=form.cnt.value;
var i=1;
for(i=1;i<form.elements.length;i++)
{
if(form.elements[i].checked==true)
{
checked='yes';
}
}
if((checked=='no')&&(form.othermarkets.value==""))
{
alert(' Please choose atleast one market.')
form.othermarkets.focus();
return false;
}
if ( form.productfocus.value == "" ) {
alert('Please Choose Main Product Focus!');
form.productfocus.focus();
return false;
}
if ( form.employees.value == "" ) {
alert('Please Choose Number of Employees!');
form.employees.focus();
return false;
}
if ( form.companyprofile.value == "" ) {
alert('Please Specify Company Profile!');
return false;
}
if ( form.ceo.value == "" ) {
alert("Please Specify CEO/Owner's Name!");
form.ceo.focus();
return false;
}
if(form.ceo.value.match(/[&<>]+/))
{
alert("Please remove Invalid characters from CEO/Owner's Name (e.g. & < >)");
form.ceo.focus();
return(false);
}
return true;
}
//-->
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?
$pofile_id=0;
$rs=mysql_query("Select * from sbbleads_companyprofiles where sb_uid =" . $_SESSION["sbbleads_userid"] );
$profile=mysql_fetch_array($rs);
if($profile)
{
$profile_id=$profile["sb_id"];
$companyname=$profile["sb_companyname"];
$logo=$profile["sb_logo"];
$businesstype=$profile["sb_businesstype"];
$services=$profile["sb_services"];
$yearestablished=$profile["sb_yearestablished"];
/*$markets=$profile["sb_markets"];*/
$markets="-1";
$mkt_q=mysql_query("select * from sbbleads_profile_markets where sb_profile_id=$profile_id");
while($mkt=mysql_fetch_array($mkt_q))
{
$markets.=",".$mkt["sb_market"];
}
$markets.=",-1";
$othermarkets=$profile["sb_othermarkets"];
$productfocus=$profile["sb_productfocus"];
$companyprofile=$profile["sb_companyprofile"];
$employees=$profile["sb_employees"];
$ceo=$profile["sb_ceo"];
$website=$profile["sb_website"];
$cat_list="";
$cid_list="";
$profile_cat_query=mysql_query("select * from sbbleads_profile_cats where sb_profile_id=".$profile["sb_id"]);
while($profile_cat=mysql_fetch_array($profile_cat_query))
{
$cat=mysql_fetch_array(mysql_query("select * from sbbleads_categories where sb_id=".$profile_cat["sb_cid"]));
$cat_path=$cat["sb_cat_name"];
$par=mysql_query("select * from sbbleads_categories where sb_id=".$cat["sb_pid"]);
while($parent=mysql_fetch_array($par))
{
$cat_path=$parent["sb_cat_name"].">".$cat_path;
$par=mysql_query("select * from sbbleads_categories where sb_id=".$parent["sb_pid"]);
}
if($cat_list=="")
{
$cat_list=$cat_path;
$cid_list=$cat["sb_id"];
}
else
{
$cat_list.=";".$cat_path;
$cid_list.=";".$cat["sb_id"];
}
}
$phone_arr=explode("-",$profile["sb_phone"]);
$phone=$phone_arr[0];
$phone1=$phone_arr[1];
$phone2=$phone_arr[2];
$fax_arr=explode("-",$profile["sb_fax"]);
$fax=$fax_arr[0];
$fax1=$fax_arr[1];
$fax2=$fax_arr[2];
}
else
{
$cid_list="";
$companyname="";
$logo="";
$businesstype="";
$services="";
$yearestablished="";
$markets="";
$othermarkets="";
$productfocus="";
$companyprofile="";
$employees="";
$ceo="";
$website="";
$cat_list="";
$phone="";
$phone1="";
$phone2="";
$fax="";
$fax1="";
$fax2="";
}
//IF SOME FORM WAS POSTED DO VALIDATION
if ( count($_POST)<>0 )
{
$companyname=$_REQUEST["companyname"];
$logo=$_REQUEST["list1"];
$businesstype=$_REQUEST["businesstype"];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -