📄 save_search_popup.php
字号:
<?php
//include_once("logincheck.php");
include_once("session.php");
include_once("myconnect.php");
include_once "styles.php";
$errcnt=0;
$showform=true;
/*if( count($_REQUEST) <> 0)
{
foreach($_REQUEST as $i => $j)
echo "Name: $i, Value= $j<br>";
}*/
if( (count($_POST) > 0) && (isset($_POST["insert_confirm"])) )// && ($_REQUEST["Submit"]=='Save Now') ) )
{ //main
// echo "hi";
$sb_title=$_REQUEST["sb_title"];
$sb_keyword=$_REQUEST["sb_keyword"];
$sb_search_method=$_REQUEST["sb_search_method"];
$sb_cid=$_REQUEST["sb_cid"];
$sb_type=$_REQUEST["sb_type"];
$sb_country=$_REQUEST["sb_country"];
$sb_day=$_REQUEST["sb_day"];
$sb_month=$_REQUEST["sb_month"];
$sb_year=$_REQUEST["sb_year"];
$sb_day1=$_REQUEST["sb_day1"];
$sb_month1=$_REQUEST["sb_month1"];
$sb_year1=$_REQUEST["sb_year1"];
if(strlen(trim($sb_title)) == 0)
{
$errs[$errcnt]="Search Title must be provided";
$errcnt++;
}
else
{
if(!get_magic_quotes_gpc())
$sb_title_chk=str_replace('$','\$',addslashes($_REQUEST["sb_title"]));
else
$sb_title_chk=str_replace('$','\$',$_REQUEST["sb_title"]);
$sbq_sea_chk="select * from sbbleads_search_results where sb_title='$sb_title_chk' and sb_uid=".$_SESSION["sbbleads_userid"];
// echo $sbq_sea_chk;
$sbrs_sea_chk=mysql_query($sbq_sea_chk);
if(mysql_num_rows($sbrs_sea_chk) > 0)
{
$errs[$errcnt]="Search Title already exists";
$errcnt++;
}
}
if($errcnt == 0)
{
if(!get_magic_quotes_gpc())
{
$sb_title=str_replace('$','\$',addslashes($_REQUEST["sb_title"]));
$sb_keyword=str_replace('$','\$',addslashes($_REQUEST["sb_keyword"]));
}
else
{
$sb_title=str_replace('$','\$',$_REQUEST["sb_title"]);
$sb_keyword=str_replace('$','\$',$_REQUEST["sb_keyword"]);
}
$sb_search_method=(int)$_REQUEST["sb_search_method"];
$sb_cid=(int)$_REQUEST["sb_cid"];
$sb_type=(int)$_REQUEST["sb_type"];
$sb_country=(int)$_REQUEST["sb_country"];
$sb_day=(int)$_REQUEST["sb_day"];
$sb_month=(int)$_REQUEST["sb_month"];
$sb_year=(int)$_REQUEST["sb_year"];
$sb_day1=(int)$_REQUEST["sb_day1"];
$sb_month1=(int)$_REQUEST["sb_month1"];
$sb_year1=(int)$_REQUEST["sb_year1"];
$sb_uid=$_SESSION["sbbleads_userid"];
$sbq_sea="insert into sbbleads_search_results (sb_uid, sb_title, sb_keyword, sb_search_method, sb_cid, sb_type, sb_country, sb_day, sb_month, sb_year, sb_day1, sb_month1, sb_year1) values ($sb_uid, '$sb_title', '$sb_keyword', $sb_search_method, $sb_cid, $sb_type, $sb_country, $sb_day, $sb_month, $sb_year, $sb_day1, $sb_month1, $sb_year1)";
// echo $sbq_sea;
mysql_query($sbq_sea);
if(mysql_affected_rows() == 1)
{
$msg1="Search result has been saved";
}
else
{
$msg1="Unable to save search result, please try again";
}
?><strong><font class="red"><?php echo $msg1; ?></font></strong><?php
$showform=false;
} //end if errcnt ==0
} //end if count(post)
else
{
if (!isset($_SESSION["sbbleads_userid"]) )
{ //unauthorised access ?>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" class="seperatorstyle">
<tr>
<td height="25" class="titlestyle"> Error</td>
</tr>
<tr>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="5" class="innertablestyle">
<tr>
<td><table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><font class="red"><strong>You must be logged to perform this operation</strong></font></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table><?php
die();
} //end if session[userid]
$sb_keyword=$_REQUEST["sb_keyword"];
$sb_search_method=$_REQUEST["sb_search_method"];
$sb_cid=$_REQUEST["sb_cid"];
$sb_type=$_REQUEST["sb_type"];
$sb_country=$_REQUEST["sb_country"];
$sb_day=$_REQUEST["sb_day"];
$sb_month=$_REQUEST["sb_month"];
$sb_year=$_REQUEST["sb_year"];
$sb_day1=$_REQUEST["sb_day1"];
$sb_month1=$_REQUEST["sb_month1"];
$sb_year1=$_REQUEST["sb_year1"];
$sb_title='';
}
function main()
{
global $errs, $errcnt, $sb_title, $showform, $sb_keyword, $sb_search_method, $sb_cid, $sb_type, $sb_country, $sb_day, $sb_month, $sb_year, $sb_day1, $sb_month1, $sb_year1;
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> 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%"> <?php echo $i+1;?></td>
<td width="94%"><?php echo $errs[$i]; ?></td>
</tr>
<? } //end for ?>
</table>
<? } //end if errcnt <> 0
} //end if count (POST)
if($showform)
{
?>
<script language="JavaScript">
function validate(frm)
{
if(frm.sb_title.value=="")
{
alert("Please specify search title");
frm.sb_title.focus();
return false;
}
return true;
}</script>
<form name="form1" onSubmit="return validate(this);" action="save_search_popup.php" method="post">
<table width="95%" border="0" cellspacing="0" cellpadding="0" class="onepxtable">
<tr>
<td height="25" align="left" class="titlestyle"> Save Search
Result </td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="5" cellpadding="2">
<tr>
<td width="40%" height="25" align="right" valign="top" class='innertablestyle'><font class='normal'> <b>Search
Title</b></font></td>
<TD align=right valign="top"><font class='red'>* </FONT></TD>
<td width="60%"> <font class='normal'>
<input type="text" name="sb_title" MAXLENGTH="120" SIZE="35" value="<?php echo $sb_title; ?>">
</font></td>
</tr>
<tr>
<td width="40%" height="25" class='innertablestyle'><font class='normal'> </font></td>
<td><font class='normal'> </font></td>
<td width="60%"><font class='normal'>
<input name="Submit" type="submit" id="Submit" value="Save Now">
<input name="sb_year1" type="hidden" id="sb_year" value="<?php echo $sb_year1; ?>">
<input name="sb_month1" type="hidden" id="sb_month1" value="<?php echo $sb_month1; ?>">
<input name="sb_day1" type="hidden" id="sb_day1" value="<?php echo $sb_day1; ?>">
<input name="sb_year" type="hidden" id="sb_month" value="<?php echo $sb_year; ?>">
<input name="sb_month" type="hidden" id="sb_day" value="<?php echo $sb_month; ?>">
<input name="sb_day" type="hidden" id="sb_country" value="<?php echo $sb_day; ?>">
<input name="sb_country" type="hidden" id="sb_search_method4" value="<?php echo $sb_country; ?>">
<input name="sb_type" type="hidden" id="sb_search_method3" value="<?php echo $sb_type; ?>">
<input name="sb_cid" type="hidden" id="sb_cid" value="<?php echo $sb_cid; ?>">
<input name="sb_search_method" type="hidden" id="sb_search_method" value="<?php echo $sb_search_method; ?>">
<input name="sb_keyword" type="hidden" id="sb_keyword" value="<?php echo $sb_keyword; ?>">
<input name="insert_confirm" type="hidden" id="insert_confirm" value="yes">
</font></td>
</tr>
</table></td>
</tr>
</table>
</form>
<?php
} //end if showform
} //end main
main();
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -