Excluding multiple urls in Strpos- why doesn't it work? - strpos

I'm trying to exclude several urls from appending a nofollow rule using strpos but it only works with 1 url, I can't get it to exclude all the urls I need to include.
This is the code that I've tried:
add_filter( 'custom_bbpress_nofollow', 'my_custom_bbpress_nofollow', 15, 2 );
function my_custom_bbpress_nofollow( $nofollow, $href ) {
if ( strpos( $href, 'https://www.examplelink1.com' ) === false && strpos( $href, 'https://www.examplelink2.com' ) === false && strpos( $href, 'https://www.examplelink3.com' ) === false && strpos( $href, 'https://examplelink4.to' ) === false) {
$nofollow = '';
}
return $nofollow;
}
I've tried it with == false and !== false as well and those don't seem to work.
This one DOES work, but it only excludes a single domain, I need to be able to exclude 5 in all.
add_filter( 'custom_bbpress_nofollow', 'my_custom_bbpress_nofollow', 15, 2 );
function my_custom_bbpress_nofollow( $nofollow, $href ) {
if ( strpos( $href, 'http://your-domain.here' ) !== false ) {
$nofollow = 'rel="dofollow"';
}
return $nofollow;
}
What is the correct strpos syntax to include multiple urls,
https://www.examplelink1.com AND/OR
https://www.examplelink2.com AND/OR
https://www.examplelink3.com AND/OR
https://www.examplelink4.com

I believe you want to use || (OR) instead of && (AND) in your if statement.
Your $href will never match ALL conditions, so using AND will never return true. With OR you tell it to set $nofollow = '' if ANY of those URLs is found.
add_filter( 'custom_bbpress_nofollow', 'my_custom_bbpress_nofollow', 15, 2 );
function my_custom_bbpress_nofollow( $nofollow, $href ) {
if ( strpos( $href, 'https://www.examplelink1.com' ) === false || strpos( $href, 'https://www.examplelink2.com' ) === false || strpos( $href, 'https://www.examplelink3.com' ) === false || strpos( $href, 'https://examplelink4.to' ) === false) {
$nofollow = '';
}
return $nofollow;
}
Edit: Actually, I'm not too sure what you're trying to do. Your 2 examples have opposite code, which is confusing. If you wish to return 'rel="nofollow"' if href equals ANY of the 5 urls, then try this:
add_filter( 'custom_bbpress_nofollow', 'my_custom_bbpress_nofollow', 15, 2 );
function my_custom_bbpress_nofollow( $nofollow, $href ) {
$nofollow = '';
if ( strpos( $href, 'http://your-domain.here' ) !== false ||
strpos( $href, 'https://www.examplelink1.com' ) !== false ||
strpos( $href, 'https://www.examplelink2.com' ) !== false ||
strpos( $href, 'https://www.examplelink3.com' ) !== false ||
strpos( $href, 'https://www.examplelink4.com' ) !== false
) {
$nofollow = 'rel="dofollow"';
}
return $nofollow;
}
You should also define $nofollow at the start of the function, otherwise nothing can be returned if the condition doesn't match.

Sorry, I want it to DOFOLLOW those 5 links and NOFOLLOW everything else.
add_filter( 'custom_bbpress_nofollow', 'my_custom_bbpress_nofollow', 15, 2 );
function my_custom_bbpress_nofollow( $nofollow, $href ) {
$nofollow = '';
if ( strpos( $href, 'https://www.link1.com' )!== false ||
strpos( $href, 'https://www.link2.com' ) !== false ||
strpos( $href, 'https://www.link3.com' ) !== false ||
strpos( $href, 'https://www.link4.com' ) === false
) {
$nofollow = 'rel="nofollow" target="_blank"';
}
return $nofollow;
}

Related

Hi i need to add multiple minimum minimum_order_amount for other postcodes

i'm using this code that i found here! the problem is i need to add multiple minimum minimum_order_amount for other postcodes! Help!
add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );
add_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' );
function wc_minimum_order_amount() {
$minimum = 20; // Set the minimum order value
$postcodes = array('26224', '26222', '26442', '26443'); // Define your targeted postcodes in the array
$postcode = ''; // Initializing
if ( isset($_POST['shipping_postcode']) && ! empty($_POST['shipping_postcode']) ) {
$postcode = $_POST['shipping_postcode'];
if ( empty($postcode) && isset($_POST['billing_postcode']) && ! empty($_POST['billing_postcode']) ) {
$postcode = $_POST['billing_postcode'];
}
} elseif ( $postcode = WC()->customer->get_shipping_postcode() ) {
if ( empty($postcode) ) {
$postcode = WC()->customer->get_billing_postcode();
}
}
if ( WC()->cart->total < $minimum && ! empty($postcode) && in_array( $postcode, $postcodes ) ) {
$error_notice = sprintf( 'Η παραγγελία σου είναι %s - Ελάχιστη Παραγγελία %s ' ,
wc_price( WC()->cart->total ),
wc_price( $minimum )
);
if( is_cart() ) {
wc_print_notice( $error_notice, 'error' );
} else {
wc_add_notice( $error_notice, 'error' );
}
}
}

Why are these equivalent functions producing a different result?

This is the original method, my intent was to abstract away many of the specifics of the code, to improve readability, by placing the specifics in functions which performed the same action, but with a more readable name.
With this first method I achieve the desired behavior and rows[x] is properly added to lineRows.
def getAllRowsForLine( rows, index ) {
def lineRows = [rows[index]]
def newOperatorNotFound
def x = index + 1
if ( x <= rows.size() - 1 ) {
newOperatorNotFound = true
while ( x <= ( rows.size() - 1 ) && newOperatorNotFound ) {
if ( rows[x].PGM_PROC_OPE.trim() == "" ) {
lineRows << rows[x]
} else if ( rows[x].PGM_PROC_TY == "AN" || rows[x].PGM_PROC_TY == "OR" ) {
lineRows << rows[x]
}
else {
newOperatorNotFound = false
}
x++
}
}
return lineRows
}
Here is the refactored code along with the relative methods for context.
This method is not resulting in the desired behavior, breaking the loop after the first rows[x] is added to lineRows.
def getAllRowsForLine2( rows, index ) {
def lineRows = [rows[index]]
def newOperatorNotFound
def i = index + 1
if ( moreRows( rows, i ) ) {
newOperatorNotFound = true
while ( moreRows( rows, i ) && newOperatorNotFound ) {
if ( operatorEmpty( rows, index ) ) {
lineRows << rows[i]
}
else if ( procTypeAnd( rows, i ) || procTypeOr( rows, i ) ) {
lineRows << rows[i]
} else {
newOperatorNotFound = false
}
i++
}
}
return lineRows
}
def operatorEmpty( rows, index ) {
return rows[index].PGM_PROC_OPE.trim() == ""
}
def procTypeAnd( rows, index ) {
return rows[index].PGM_PROC_TY == "AN"
}
def procTypeOr( rows, index ) {
return rows[index].PGM_PROC_TY == "OR"
}
def moreRows( rows, index ) {
return index <= ( rows.size() - 1 )
}
As far as I can tell these things are equivalent. I ran the below code to attempt testing the equivalency of the functions and it returns true.
println lineProcessor.getAllRowsForLine( rows, 0 ) == lineProcessor.getAllRowsForLine2( rows, 0 )
=> true
Oops, I realized that I had used index in the operatorEmpty function instead of i. If I change index to i the function performs as expected.

pdo update using bindParam show the error number of bound variables does not match number of tokens

I have a simple form for update image name into mysql database, but unfortunately it always throw the error SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens. The code seems OK, but I don't know it cannot update the database. Any help is appreciated.
Here is the image name and the SQL that I have printed out.
Array
(
[0] => 20141027103534_0.jpg
[1] => 20141027103534_1.jpg
[2] =>
[3] =>
[4] =>
[5] => 20141027103534_5.jpg
[6] => 20141027103534_6.jpg
[7] =>
[8] =>
[9] =>
)
UPDATE `image`
SET
`propertyPictureCate1` = :propertyPictureCate1,
`propertyPictureCate2` = :propertyPictureCate2,
`propertyPictureCate3` = :propertyPictureCate3,
`propertyPictureCate4` = :propertyPictureCate4,
`propertyPictureCate5` = :propertyPictureCate5,
`memo1` = :memo1,
`memo2` = :memo2,
`memo3` = :memo3,
`memo4` = :memo4,
`memo5` = :memo5,
`spotPictureCate1` = :spotPictureCate1,
`spotPictureCate2` = :spotPictureCate2,
`spotPictureCate3` = :spotPictureCate3,
`spotPictureCate4` = :spotPictureCate4,
`spotPictureCate5` = :spotPictureCate5,
`spotName1` = :spotName1,
`spotName2` = :spotName2,
`spotName3` = :spotName3,
`spotName4` = :spotName4,
`spotName5` = :spotName5,
`distance1` = :distance1,
`distance2` = :distance2,
`distance3` = :distance3,
`distance4` = :distance4,
`distance5` = :distance5,
`img1` = :img1,
`img2` = :img2,
`img6` = :img6,
`img7` = :img7
WHERE `buildingID` = :buildingID
the image name within bindParam that I tested to print out.
img1 20141027103534_0.jpg
img2 20141027103534_1.jpg
img6 20141027103534_5.jpg
img7 20141027103534_6.jpg
and below is my code for above result
if($_SERVER['REQUEST_METHOD'] == 'POST') {
$file_name = [];
for ($i = 0; $i < count($_FILES['file']['tmp_name']); $i++) {
if($_FILES['file']['error'][$i] != 4) {
$validextensions = array("jpeg", "jpg", "png","gif");
$ext = explode('.', basename($_FILES['file']['name'][$i]));
$file_extension = end($ext);
$file_name[$i] = date("Ymdhis") . "_". $i . "." . $ext[count($ext) - 1];
$target_path = $_SERVER['DOCUMENT_ROOT'] . "/".PROJ_DIR."/uploads/" . date("Ymdhis") . "_". $i . "." . $ext[count($ext) - 1];
move_uploaded_file($_FILES['file']['tmp_name'][$i], $target_path);
} else {
$file_name[$i] = "";
}
}
try {
$sql = "
UPDATE `image`
SET
`propertyPictureCate1` = :propertyPictureCate1,
`propertyPictureCate2` = :propertyPictureCate2,
`propertyPictureCate3` = :propertyPictureCate3,
`propertyPictureCate4` = :propertyPictureCate4,
`propertyPictureCate5` = :propertyPictureCate5,
`memo1` = :memo1,
`memo2` = :memo2,
`memo3` = :memo3,
`memo4` = :memo4,
`memo5` = :memo5,
`spotPictureCate1` = :spotPictureCate1,
`spotPictureCate2` = :spotPictureCate2,
`spotPictureCate3` = :spotPictureCate3,
`spotPictureCate4` = :spotPictureCate4,
`spotPictureCate5` = :spotPictureCate5,
`spotName1` = :spotName1,
`spotName2` = :spotName2,
`spotName3` = :spotName3,
`spotName4` = :spotName4,
`spotName5` = :spotName5,
`distance1` = :distance1,
`distance2` = :distance2,
`distance3` = :distance3,
`distance4` = :distance4,
`distance5` = :distance5".
$s1 = (($file_name[0] != "") ? ",\n`img1` = :img1" : NULL).
$s2 = (($file_name[1] != "") ? ",\n`img2` = :img2" : NULL).
$s3 = (($file_name[2] != "") ? ",\n`img3` = :img3" : NULL).
$s4 = (($file_name[3] != "") ? ",\n`img4` = :img4" : NULL).
$s5 = (($file_name[4] != "") ? ",\n`img5` = :img5" : NULL).
$s6 = (($file_name[5] != "") ? ",\n`img6` = :img6" : NULL).
$s7 = (($file_name[6] != "") ? ",\n`img7` = :img7" : NULL).
$s8 = (($file_name[7] != "") ? ",\n`img8` = :img8" : NULL).
$s9 = (($file_name[8] != "") ? ",\n`img9` = :img9" : NULL).
$s10 = (($file_name[9] != "") ? ",\n`img10` = :img10" : NULL).
" \nWHERE `buildingID` = :buildingID
";
echo '<pre>';
print_r($file_name);
echo '</pre>';
echo '<pre>';
print_r($sql);
echo '</pre>';
$stmt = $con->prepare($sql);
$stmt->bindParam(":propertyPictureCate1",$_POST['propertyPictureCate1']);
$stmt->bindParam(":propertyPictureCate2",$_POST['propertyPictureCate2']);
$stmt->bindParam(":propertyPictureCate3",$_POST['propertyPictureCate3']);
$stmt->bindParam(":propertyPictureCate4",$_POST['propertyPictureCate4']);
$stmt->bindParam(":propertyPictureCate5",$_POST['propertyPictureCate5']);
$stmt->bindParam(":memo1",$_POST['memo1']);
$stmt->bindParam(":memo2",$_POST['memo2']);
$stmt->bindParam(":memo3",$_POST['memo3']);
$stmt->bindParam(":memo4",$_POST['memo4']);
$stmt->bindParam(":memo5",$_POST['memo5']);
$stmt->bindParam(":spotPictureCate1",$_POST['spotPictureCate1']);
$stmt->bindParam(":spotPictureCate2",$_POST['spotPictureCate2']);
$stmt->bindParam(":spotPictureCate3",$_POST['spotPictureCate3']);
$stmt->bindParam(":spotPictureCate4",$_POST['spotPictureCate4']);
$stmt->bindParam(":spotPictureCate5",$_POST['spotPictureCate5']);
$stmt->bindParam(":spotName1",$_POST['spotName1']);
$stmt->bindParam(":spotName2",$_POST['spotName2']);
$stmt->bindParam(":spotName3",$_POST['spotName3']);
$stmt->bindParam(":spotName4",$_POST['spotName4']);
$stmt->bindParam(":spotName5",$_POST['spotName5']);
$stmt->bindParam(":buildingID",$_POST['buildingID']);
if($file_name[0] !== ""){
echo 'img1 '.$file_name[0].'<br>';
$stmt->bindParam(":img1", $file_name[0]);
}
if($file_name[1] !== ""){
echo 'img2 '.$file_name[1].'<br>';
$stmt->bindParam(":img2", $file_name[1]);
}
if($file_name[2] !== ""){
echo 'img3 '.$file_name[2].'<br>';
$stmt->bindParam(":img3", $file_name[2]);
}
if($file_name[3] !== ""){
echo 'img4 '.$file_name[3].'<br>';
$stmt->bindParam(":img4", $file_name[3]);
}
if($file_name[4] !== ""){
echo 'img5 '.$file_name[4].'<br>';
$stmt->bindParam(":img5", $file_name[4]);
}
if($file_name[5] !== ""){
echo 'img6 '.$file_name[5].'<br>';
$stmt->bindParam(":img6", $file_name[5]);
}
if($file_name[6] !== ""){
echo 'img7 '.$file_name[6].'<br>';
$stmt->bindParam(":img7", $file_name[6]);
}
if($file_name[7] !== ""){
echo 'img8 '.$file_name[7].'<br>';
$stmt->bindParam(":img8", $file_name[7]);
}
if($file_name[8] !== ""){
echo 'img9 '.$file_name[8].'<br>';
$stmt->bindParam(":img9", $file_name[8]);
}
if($file_name[9] !== ""){
echo 'img10 '.$file_name[9].'<br>';
$stmt->bindParam(":img10", $file_name[9]);
}
//$stmt->debugDumpParams();
$stmt->execute();
$con = null;
} catch(PDOException $e) {
echo $e->getMessage();
}
}
You forgot to bind distance parameters to your statement.
Before calling $stmt->execute(), you should either add these lines for binding to $stmt
$stmt->bindParam(":distance1",$_POST['distance1']);
$stmt->bindParam(":distance2",$_POST['distance2']);
$stmt->bindParam(":distance3",$_POST['distance3']);
$stmt->bindParam(":distance4",$_POST['distance4']);
$stmt->bindParam(":distance5",$_POST['distance5']);
or remove these lines from you $sql string variable
`distance1` = :distance1,
`distance2` = :distance2,
`distance3` = :distance3,
`distance4` = :distance4,
`distance5` = :distance5

How to get a parseJSON in Android through php

I have a part of code from php like this. Any two table tbl_gejala for change a sentence and tbl_hormon for move a Layout. Tbl_gejala with $id_g and tbl_hormon $id_h. and this php called by gejala.php.
I use 2 choice for this application, yes or no. $jawab == 1 for yes and $jawab == o for no.
$id_g = $_GET['id_g'];
$jawab = $_GET['a'];
$link = mysql_connect('localhost', 'root', '') or die ('Tidak bisa menampilkan');
mysql_select_db('hormon', $link) or die('Tidak bisa select');
if($id_g == 1 && $jawab == 1){
$query = "SELECT * from tbl_gejala where id_g = 3";
}elseif($id_g == 3 && $jawab == 1){
$query = "SELECT * from tbl_gejala where id_g = 5";
}elseif($id_g == 5 && $jawab == 1){
//intent activity and parseJSON with table hormon
$query = "SELECT * from tbl_hormon where id_h = 16";
}elseif($id_g == 5 && $jawab == 0){
$query = "SELECT * from tbl_gejala where id_g = 10";
}elseif($id_g == 10 && $jawab == 1){
$query = "SELECT * from tbl_hormon where id_h = 1";
}elseif($id_g == 10 && $jawab == 0){
$query = "SELECT * from tbl_hormon where id_h = 7";
I want to parseJSON with gejala.php in konsultasi.class
I have try this coding, but any problem by logic error. This coding like this:
void parseJSON(String response) {
try {
JSONObject json = new JSONObject(response);
listArray = new ArrayList<ListModel>();
JSONArray jArray = json.getJSONArray("Hormon");
log("lenght: " + jArray.length());
for (int i = 0; i < jArray.length(); i++) {
JSONObject jData = jArray.getJSONObject(i);
if(idPert.equals("5")&&yes.equals("1") ||
idPert.equals("7")&&yes.equals("1") ||
idPert.equals("11")&&yes.equals("1") ||
idPert.equals("11")&&no.equals("0") ||
idPert.equals("10")&&yes.equals("1") ||
idPert.equals("16")&&yes.equals("1") ||
idPert.equals("19")&&yes.equals("1") ||
idPert.equals("20")&&yes.equals("1") ||
idPert.equals("20")&&no.equals("0") ||
idPert.equals("8")&&yes.equals("1") ||
idPert.equals("17")&&yes.equals("1") ||
idPert.equals("17")&&no.equals("0") ||
idPert.equals("6")&&yes.equals("1") ||
idPert.equals("13")&&yes.equals("1") ||
idPert.equals("13")&&no.equals("0") ||
idPert.equals("12")&&yes.equals("1") ||
idPert.equals("14")&&yes.equals("1") ||
idPert.equals("15")&&yes.equals("1") ||
idPert.equals("18")&&yes.equals("1") ||
idPert.equals("21")&&yes.equals("1") ||
idPert.equals("22")&&yes.equals("1") ||
idPert.equals("10")&&no.equals("0")) {
id_h = jData.getString("id_h");
nm_penyakit = jData.getString("nm_penyakit");
definisi = jData.getString("definisi");
gejala = jData.getString("gejala");
penyebab = jData.getString("penyebab");
solusi = jData.getString("solusi");
gambar = jData.getString("gambar");
munculPenyakit = true;
}else{
idPert = jData.getString("id_g");
pertanyaan = jData.getString("gejala2")+"?";
munculPenyakit = false;
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
Please help me, thanks a lot before.

Iframe does not render properly

So I'm attempting to run a webpage that shows security camera feeds for a client. However it does not render properly at all and only shows the background. I have a feeling it has to do with a limitation of the iframe tag, since using other iframe testing gadgets online I get the same results. Other clients are using camera feeds with a different interface and my solution works fine for them. Are there any alternatives to iframe?
edit: The page actually renders perfectly fine when being visited directly, and not through an iframe.
edit2: By popular request here is the source for the security feed site. I did not post my iframe code, since no matter what I use for iframe it will not display.
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="expires" content="-1">
<title>:::</title>
<script language="JavaScript" src="/js/lgSource.js"></script>
<script language="JavaScript" src="/js/data_init.js"></script>
<script language="javascript" src="/js/AVUtility.js"></script>
<script language="JavaScript">
var d = document ;
d.write( "<frameset frameSpacing=0 rows='37,*' frameBorder='no' >" ) ;
d.write( " <frame name='ban' src='' scrolling='no'>" ) ;
d.write( " <frameset frameSpacing=0 frameBorder='no' cols='*,195'>" ) ;
d.write( " <frame name='main' src='home.htm' scrolling='auto'>" ) ;
d.write( " <frame name='left' src='' noResize scrolling='no'>" ) ;
d.write( " </frameset>" ) ;
d.write( "</frameset>" ) ;
d.write( "<noframes><body><p>no frame</p></body></noframes>" ) ;
var httpObj,httpObj2,httpObj3;
//alert("Code in NFS. H264 \n\n charset=utf-8");
//top.dt.user.SupportLG = "ENGLISH&CHINESE&"
loadSupportLanguage();
//loadUserPwd();
function loadSupportLanguage()
{
httpObj3 = createHttpRequestObj();
requestData = "http://"+getURL()+"/cgi-bin/nobody/Machine.cgi?action=get_capability";
httpObj3.onreadystatechange = updSL;
requestCgiParam(httpObj3, requestData);
}
function updSL()
{
if (httpObj3.readyState == 4 && httpObj3.status == 200)
{
var objStr = new Object();
objStr.strSrc = httpObj3.responseText;
if (GetCgiParam(objStr,"Language.Support=") == 1)
if (objStr.strGet != "")
top.dt.user.SupportLG = objStr.strGet;
loadUserPwd();
}
}
function loadUserPwd()
{
httpObj = createHttpRequestObj();
requestData = "http://"+getURL()+"/cgi-bin/guest/UserInfo.cgi?action=query";
httpObj.onreadystatechange = updUserPwd;
requestCgiParam(httpObj, requestData);
}
function updUserPwd()
{
if (httpObj.readyState == 4 && httpObj.status == 200)
{
var objStr = new Object();
objStr.strSrc = httpObj.responseText;
if (GetCgiParam(objStr, "Username=") == 1)
top.dt.user.username = objStr.strGet;
if (GetCgiParam(objStr, "Password=") == 1)
top.dt.user.password = objStr.strGet;
loadLogin();
}
}
function loadLogin()
{
httpObj2 = createHttpRequestObj();
requestData = "http://"+getURL()+"/cgi-bin/guest/Login.cgi?rnd="+Math.random();
httpObj2.onreadystatechange = updLogin;
httpObj2.open("get", requestData, true);
httpObj2.send(null);
}
function updLogin()
{
if (httpObj2.readyState == 4 && httpObj2.status == 200)
{
var objStr = new Object();
objStr.strSrc = httpObj2.responseText;
if (GetCgiParam(objStr,"Server-Language=") == 1)
{
if(objStr.strGet.toUpperCase() == "CHINESE")
top.dt.user.language = 2;
else if(objStr.strGet.toUpperCase() == "GREEK")
top.dt.user.language = 3;
else
top.dt.user.language = 1;
}
if (GetCgiParam(objStr, "Video-System=") == 1)
top.dt.user.VideoSystem = objStr.strGet;
if (GetCgiParam(objStr, "User-Level=") == 1)
top.dt.user.ulevel = objStr.strGet;
if (GetCgiParam(objStr, "Product-ShortName=") == 1)
{
if(objStr.strGet == "V_Indep")
top.dt.user.IndepFlag = true;
}
//top.dt.user.NatSupport = true;
//top.dt.user.PosSupport = true;
if (GetCgiParam(objStr, "Capability=") == 1)
{
tmpStr = objStr.strGet.split(",");
if(tmpStr.length==4){
if(parseInt(tmpStr[3],16)&0x01)
top.dt.user.isDvrPtz = true;
if(parseInt(tmpStr[2],16)&0x01)
top.dt.user.DvrHaSupport = true; // HA
if(parseInt(tmpStr[2],16)&0x02)
top.dt.account.NotifySys = true; //3G Notify
if(parseInt(tmpStr[2],16)&0x04)
top.dt.user.NatSupport = true; //NAT
if(parseInt(tmpStr[2],16)&0x08)
top.dt.user.RfidSupport = true; //RFID
if(parseInt(tmpStr[1],16)&0x01)
top.dt.user.PosSupport = true; //POS
}
}
if (GetCgiParam(objStr, "Product-ID-Minor=") == 1)
{
top.dt.user.ProductID = objStr.strGet;
var pid = objStr.strGet;
// Video Channel (default: 4 ch)
if(pid == "787" || pid == "718" || pid == "616" || pid == "757" || pid == "677" || pid == "678" || pid == "DG1648" || pid == "798"){
top.dt.user.dvrCh = 16;
}
else if (pid == "785" || pid == "608" || pid == "716" || pid == "755" || pid == "675" || pid == "676" || pid == "DG0824" || pid == "796"){
top.dt.user.dvrCh = 8;
}
else if (pid == "783" || pid == "604" || pid == "604F" || pid == "714" || pid == "724" || pid == "DG0412" || pid == "763" || pid == "764" || pid == "760A" || pid == "761A" || pid == "041"){
top.dt.user.dvrCh = 4;
}
else{
top.dt.user.dvrCh = 4; /* default 4 ch */
}
// Audio Channel
if(pid == "DG0824" || pid == "608" || pid == "DG1648" || pid == "616" || pid == "718" || pid == "757" || pid == "755" || pid == "675" || pid == "676" || pid == "677" || pid == "678" || pid == "724" || pid == "764" || pid == "673" || pid == "674" || pid == "683" || pid == "796" || pid == "798"){
top.dt.user.soundCh = 4;
}
else if (pid == "732E" || pid == "DG0412" || pid == "714"){
top.dt.user.soundCh = 2;
}
else if (pid == "733" || pid == "944" || pid == "945" || pid == "946" || pid == "311" || pid == "321" || pid == "202" || pid == "212" || pid == "604F" || pid == "203" || pid == "671" || pid == "672" || pid == "681"){
top.dt.user.soundCh = 1;
}
else{
top.dt.user.soundCh = 0;
}
//Top-Page
if(top.dt.user.ulevel != "SUPERVISOR" || pid == "203" || pid == "763")
top.dt.user.topSrc = "/top2.htm";
else
top.dt.user.topSrc = "/top.htm";
//show Left-Page
if(pid == "311" || pid == "321"){
top.dt.user.leftSrc = "/left_ipcam.htm";
top.dt.user.confSrc = "/left_ipcam_config.htm";
top.dt.user.ProductType = "IP CAMERA";
top.dt.user.isAutomoveSupport = true;
}
else if(pid == "203"){
top.dt.user.leftSrc = "/left_ipcam_h264.htm";
top.dt.user.ProductType = "IP CAMERA";
}
else{
if(pid == "763"){
top.dt.user.leftSrc = "/left_home763.htm";
}else if(pid == "798" || pid == "796"){
top.dt.user.leftSrc = "/left_home16ch.htm";
}
else{
top.dt.user.leftSrc = "/left_home.htm";
}
top.dt.user.confSrc = "/left_config.htm";
top.dt.user.ProductType = "DVR";
}
//show Title
if(pid == "764" || pid == "671" || pid == "672" || pid == "673" || pid == "674" || pid == "681" || pid == "683" || pid == "203" || pid == "796" || pid == "798" || pid == "041"){
top.dt.user.MediaType = "H264";
document.title = "H264 "+ top.dt.user.ProductType;
}
else
document.title = "MPEG4 "+ top.dt.user.ProductType;
if(top.dt.user.ulevel == "SUPERVISOR")
if(top.dt.user.ProductType == "DVR")
loadRecImageSize();
else
chkNatFirstUse();
else
loadMainPage();
}
}
}
function loadRecImageSize()
{
httpObj = createHttpRequestObj();
var requestData = "http://"+getURL()+"/cgi-bin/user/Config.cgi?action=get&category=DVR.Record.*";
httpObj.onreadystatechange = updRecImageSize;
requestCgiParam(httpObj, requestData);
}
function updRecImageSize()
{
if (httpObj.readyState == 4 && httpObj.status == 200)
{
var objStr = new Object();
objStr.strSrc = httpObj.responseText;
if (GetCgiParam(objStr,"ImageSize=") == 1){
top.dt.user.DVR_Record_ImageSize = objStr.strGet;
chkNatFirstUse();
}
}
}
function chkNatFirstUse()
{
httpObj = createHttpRequestObj();
var requestData = "http://"+getURL()+"/cgi-bin/user/Config.cgi?action=get&category=Network.NAT.*";
httpObj.onreadystatechange = updNatFirstUse;
requestCgiParam(httpObj, requestData);
}
function updNatFirstUse()
{
if (httpObj.readyState == 4 && httpObj.status == 200)
{
var objStr = new Object();
objStr.strSrc = httpObj.responseText;
var FirstUseNatFlag = false;
if (GetCgiParam(objStr,"FirstUse=") == 1)
if(objStr.strGet == "YES")
FirstUseNatFlag = true;
if (GetCgiParam(objStr,"Hostname=") == 1)
top.dt.user.NatName = objStr.strGet;
if(FirstUseNatFlag)
showNatFirstUseWeb();
else
loadMainPage();
}
}
function showNatFirstUseWeb()
{
top.ban.location.replace("/top2.htm");
top.left.location.replace("/left_empty.htm");
top.main.location.replace("/combo/nat_firstuse.htm");
}
function loadMainPage()
{
top.dt.user.mainSrc = "/home.htm";
top.ban.location.replace(top.dt.user.topSrc);
top.left.location.replace(top.dt.user.leftSrc);
}
</script>
</html>
The page actually renders perfectly
fine when being visited directly, and
not through an iframe.
The only thing I can think of that the page has a frame busting technique.
You can read a little about it here.
I can't help you much more without the code!