Jump to content

URL Change


oracle765
Go to solution Solved by hansford,

Recommended Posts

<?php
require_once('config/config.php');
include ("files/viator/api.php");
$page = new PhpCode();
$current_page = $page->curPageURL();
$_SESSION['last_page'] = $current_page ;

function seoUrl($string) {
    //Lower case everything
    $string = strtolower($string);
    //Make alphanumeric (removes all other characters)
    $string = preg_replace("/[^a-z0-9_\s-]/", "", $string);
    //Clean up multiple dashes or whitespaces
    $string = preg_replace("/[\s-]+/", " ", $string);
    //Convert whitespaces and underscore to dash
    $string = preg_replace("/[\s_]/", "-", $string);
    return $string;
}
if(isset($_GET['submit']) && !empty($_GET['submit'])) {
    $lookupId       = $_GET['lookupId'];
    $dest_code      = $_GET['dest_code'];
    $currency_code  = $_GET['currency_code'];
    $sortOrder      = $_GET['sortOrder'];
    $catId          = $_GET['catId'];
    $subcategoryId  = $_GET['subcategoryId'];
    $country_name   = $_GET['country_name'];
    $state_name     = $_GET['state_name'];
    $country_dest_id= $_GET['country_dest_id'];
    $check_in	    = $_GET['check_in'];
    $check_out	    = $_GET['check_out'];
    if($dest_code =='' && $country_dest_id != '') {
        $dest_code = $country_dest_id;
    }
} else if(isset($_GET['search_submit']) && !empty($_GET['search_submit'])){   
    $dest_code      = $_GET['dest_code'];
    $currency_code  = $_GET['currency_code'];
    $sortOrder      = $_GET['sortOrder'];
    $catId          = $_GET['catId'];
    $subcategoryId  = $_GET['subcategoryId'];
    $country_name   = $_GET['country_name'];
    $state_name     = $_GET['state_name'];
    $country_dest_id= $_GET['country_dest_id'];
    $check_in	    = $_GET['check_in'];
    $check_out	    = $_GET['check_out'];
    $lookupId       = $_GET['lookupId'];
    if($dest_code =='' && $country_dest_id != '') {
        $dest_code = $country_dest_id;
    }    
} else {
     $lookupId      = $_GET['lookupId'];
    $dest_code      = $_GET['dest_code'];
    $currency_code  = $_GET['currency_code'];
    $sortOrder      = $_GET['sortOrder'];
    $catId          = $_GET['catId'];
    $subcategoryId  = $_GET['subcategoryId'];
    $country_name   = $_GET['country_name'];
    $state_name     = $_GET['state_name'];
    $country_dest_id= $_GET['country_dest_id'];
    $check_in	    = $_GET['check_in'];
    $check_out	    = $_GET['check_out'];
    if($dest_code =='' && $country_dest_id != '') {
        $dest_code = $country_dest_id;
    }
}
    $getdataarr         = getAdventureSearch($dest_code,$currency_code,$sortOrder,$check_in,$check_out);
    $adventure_data_arr = $getdataarr['data'];
    $image              = '' ;

$part = new Body();
$title = "Things to do in ";
if($state_name !="")
{ $title .= $state_name.' ' ;}
if ($country_name=="United States of America")
 { $title .= 'USA ' ;
   $breadcrumb = 'USA';}
elseif ($country_name=="United Arab Emirates")
 { $title .= 'UAE ' ;
   $breadcrumb = 'UAE'; }
elseif ($country_name!="")
{ $title .= $country_name; }
$title .= " | Compare & Choose";

$meta = '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="' .$state_name. ' Attractions & Things to do in ' .$country_name. '.  Find your adventure in ' .$country_name. ' Today." /><link rel="canonical" href="//www.compareandchoose.com.au/adventure_list"/>
<!-- MICROFORMATS FOR GPLUS -->
<link href="https://plus.google.com/+CompareandchooseAuTravel/posts" rel="publisher" />
<meta itemprop="name" content="' .$title. '">
<meta itemprop="description" content="' .$state_name. ' Attractions & Things to do in ' .$country_name. '.  Find your adventure in ' .$country_name. ' Today.">
<meta property="og:locale" content="en_US" />
<meta property="og:type" content="website" />
<meta property="og:title" content="' .$title. '" />
<meta property="og:description" content="' .$state_name. ' Attractions & Things to do in ' .$country_name. '.  Find your adventure in ' .$country_name. ' Today." />
<meta property="og:url" content="http://www.compareandchoose.com.au/" />
<meta property="og:site_name" content="Compare and Choose" />
<meta property="article:publisher" content="https://www.facebook.com/compareandchoose" />
<meta property="fb:app_id" content="1386609318277530" />
<meta property="og:image" content="http://www.compareandchoose.com.au/images/Compare-and-Choose-logo.png" />
<meta property="og:image:width" content="313" />
<meta property="og:image:height" content="75" />';
$head = $part->getHead($title,$meta);
$header = $part->getHeader('Adventure');
$footer = $part->getFooter();
echo $head;
echo $header;
?>
<script>
    function sort() {
        $('.overlay_wrap').fadeIn();        $('.loader_hotel_page').fadeIn();
    }
</script>
<div class="overlay_wrap" style="display: none;"></div>
                     <div class="loader_hotel_page" style="display: none;"><img src="<?php echo SITE_URL; ?>images/search-loader.gif" alt="searching-records"/></div>
<!-----Adventure Listing----->
<div class="container">
    <div class="listing">            
                    <div class="row">
                    	<div class="col-xs-12 col-md-3 col-lg-3">
                        	<div class="refine-search travel">
                                	<?php require_once('files/keyword_search.php'); ?>                                
                                <div class="block">
                                	<div class="block-content">
                                    	<div class="block-title">Top Selling Tours & Activities</div>
                                        <div class="block-inner">
                                        	<div class="top-rated-pic">
                                            	<!--<img src="images/small-pic1.png" alt="" />-->
                                            </div>
                                            <div class="top-topics-sec">
                                                <?php
                                                $getcatdataarr = getCategoryDestination($dest_code);
                                                $category_arr  = $getcatdataarr['data'];
                                                $i=1;
                                                if($category_arr !="")
                                                {
                                                foreach ($category_arr as $categoryList) {
                                                if($catId == $categoryList['id']) {
                                                    $image      = $categoryList['thumbnailURL'];
                                                    $groupName  = $categoryList['groupName'];  
                                                    ?>
                                                    <p onclick="sort()">
                                                        <strong><?php echo $i;?>.</strong><a href="adventure_list.php?currency_code=<?php echo $currency_code; ?>&dest_code=<?php echo $dest_code;?>&sortOrder=<?php echo $sortOrder;?>&catId=<?php echo $categoryList['id'];?>&country_name=<?php echo $country_name;?>&state_name=<?php echo $state_name;?>&country_dest_id=<?php echo $country_dest_id; ?>&lookupId=<?php echo $lookupId;?>&check_in=<?php echo $check_in;?>&check_out=<?php echo $check_out;?>"><?php echo stripslashes($categoryList['groupName']);?></a>
                                                        <?php 
                                                            $subcategories_arr = $categoryList['subcategories'];
                                                            
                                                            foreach($subcategories_arr as $subcatList) {
                                                                echo '<br>';
                                                        ?>
                                                                <a href="adventure_list.php?currency_code=<?php echo $currency_code; ?>&dest_code=<?php echo $dest_code;?>&sortOrder=<?php echo $sortOrder;?>&catId=<?php echo $categoryList['id'];?>&subcategoryId=<?php echo $subcatList['subcategoryId'];?>&country_name=<?php echo $country_name;?>&state_name=<?php echo $state_name;?>&country_dest_id=<?php echo $country_dest_id; ?>&lookupId=<?php echo $lookupId;?>&check_in=<?php echo $check_in;?>&check_out=<?php echo $check_out;?>"><?php echo stripslashes($subcatList['subcategoryName']); ?></a>
                                                        <?php
                                                            }
                                                          ?>  
                                                    </p>
                                                    <?php 
                                                    } else{
                                                ?>
                                            <p onclick="sort()"><strong><?php echo $i;?>.</strong><a href="adventure_list.php?currency_code=<?php echo $currency_code; ?>&dest_code=<?php echo $dest_code;?>&sortOrder=<?php echo $sortOrder;?>&catId=<?php echo $categoryList['id'];?>&country_name=<?php echo $country_name;?>&state_name=<?php echo $state_name;?>&country_dest_id=<?php echo $country_dest_id; ?>&lookupId=<?php echo $lookupId;?>&check_in=<?php echo $check_in;?>&check_out=<?php echo $check_out;?>"><?php echo stripslashes($categoryList['groupName']);?></a></p>
                                            <?php }$i++;}
                                            }
                                            ?>
                                            </div></div></div></div></div></div>
                        <div class="col-xs-12 col-md-9 col-lg-9">
                        	<div class="travel-main">
                            	<div class="row">                                	
                                        <?php
                                          if($image !='')   {
                                            //$image = 'images/travel-pic.png';
					    ?>
					<div class="col-xs-12 col-md-4 col-lg-4">
					    <!--<img src="<?php echo $image;?>" alt="" />-->
					</div>
					    <?php
                                          } 
                                        ?>
                                    <div class="col-xs-12">
                                    	<h1>Things to do in <?php echo stripslashes($country_name);?></h1>
                                        <?php
                                        if($state_name == '') {
                                            $search_name = $country_name;
                                        } else{
                                             $search_name = $state_name;
                                        }
                                        ?>
                                        <p>Compare and choose things to do in <?php echo stripslashes($search_name);?></p>
                                        <a href="#"><?php echo strtoupper(stripslashes($search_name));?> >></a>
                                        <?php
                                        if($groupName != '') {
                                            echo '<p>'.$groupName.'</p>';
                                        }
                                        ?>
                                        <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="GET">
                                <div class="filtering">
                                  <select onchange="this.form.submit();" name="sortOrder">
                                    <option value="TOP_SELLERS" <?php if($sortOrder == 'TOP_SELLERS'){echo 'selected';}?>>Most Popular</option>
                                    <option value="REVIEW_AVG_RATING_D" <?php if($sortOrder == 'REVIEW_AVG_RATING_D'){echo 'selected';}?>>Top Rated</option>
                                    <option value="PRICE_FROM_A" <?php if($sortOrder == 'PRICE_FROM_A'){echo 'selected';}?>>Price(Low - High)</option>
                                    <option value="PRICE_FROM_D" <?php if($sortOrder == 'PRICE_FROM_D'){echo 'selected';}?>>Price(High - Low)</option>
                                  </select>
                                  <input type="hidden" name="currency_code" value="<?php echo $currency_code;?>" id="currency_code">
                                  <input type="hidden" name="lookupId" value="<?php echo $lookupId;?>" id="lookupId">
                                  <input type="hidden" name="dest_code" value="<?php echo $dest_code;?>" id="dest_code">
                                  <input type="hidden" name="catId" value="<?php echo $catId;?>" id="catId">
                                  <input type="hidden" name="subcategoryId" value="<?php echo $subcategoryId;?>" id="subcategoryId">
                                  <input type="hidden" name="country_name" value="<?php echo $country_name; ?>" id="country_name" >
                                  <input type="hidden" name="state_name" value="<?php echo $state_name;?>" id="state_name">
                                  <input type="hidden" name="country_dest_id" value="<?php echo $country_dest_id;?>" id="country_dest_id">				    
                                </div>
                                </form>
                                    </div><div class="c1"></div></div></div>
                            <?php
                            if($adventure_data_arr != ""){
                               foreach($adventure_data_arr as $adventureList) {
                               $url = seoUrl($adventureList['title']);
                               if($catId == '') {
                           ?>
                            <div class="travel-list-sec">
                            	<div class="row">
                                    <div class="col-xs-12 col-md-3 col-lg-3 spacal-img">
                                        <?php
                                        if($adventureList['specialOfferAvailable'] == 1)
                                        {?>
                                        <div class="spacal-tag">
                                            <img src="images/specila-tag.png" alt="" />
                                        </div>
                                        <?php } ?>                                        
                                    	<img src="<?php echo $adventureList['thumbnailHiResURL'];?>" alt="" width="166" height="160" />
                                    </div>
                                    <div class="col-xs-12 col-md-9 col-lg-9">
                                    	<div class="travel-det"> 
                                    	<h2 style="text-transform: uppercase; font: 400 15px 'Open Sans', sans-serif; text-decoration: none;"><a style="color: rgb(103, 191, 54);" href="adventure_details.php?name=<?php echo $url;?>&code=<?php echo $adventureList['code'];?>&currencyCode=<?php echo $adventureList['currencyCode'];?>&lookupId=<?php echo $lookupId;?>&dest_code=<?php echo $dest_code; ?>"><?php echo stripslashes($adventureList['title']);?></a></h2>
                                        <p><?php echo stripslashes($adventureList['shortDescription']);?></p>
                                            <div class="rating-box">
                                              <div class="ratings">
                                                <?php
                                                    $rate = $adventureList['rating'];
                                                    $f= floor($rate);
                                                    $c = ceil($rate);
                                                    $cnt = 0;
                                                    if($rate!="" && $rate!=0)
                                                    { for($in = 1; $in<=$rate ;$in++)
                                                      { $cnt++; ?>
                                                        <img src="images/rating_full.png">
                                                <?php } if($f != $c)
                                                         { $cnt++;
                                                        ?> <img src="images/rating_half.png">
                                               <?php } }
                                                    if($cnt<5) {
                                                        while($cnt<5)
                                                        { $cnt++;
                                                            ?> <img src="images/rating_blank.png">
                                                    <?php  } }
                                                ?>
                                                <!--<span class="stars"><?php echo $adventureList['rating']; ?></span>-->
                                              </div>
                                            <div class="rating-txt">
                                            	based on <?php echo $adventureList['reviewCount']; ?> reviews
                                            </div>
                                            <div class="c1"></div>
                                        </div>                                            
                                        <div class="price-box"><a href="adventure_details.php?name=<?php echo $url;?>&code=<?php echo $adventureList['code'];?>&currencyCode=<?php echo $adventureList['currencyCode'];?>&lookupId=<?php echo $lookupId;?>&dest_code=<?php echo $dest_code; ?>">
                                        <span style="float: right; margin-right: 1%; padding: 6px 20px; color: white; background-color: rgb(108, 191, 61); text-align: center; font-size:16px; font-weight:400;
">See Details →</span></a>                                  
                                           <span class="new_price">Duration :<?php echo stripslashes($adventureList['duration']);?></span><br />
                                        	<span class="new_price">From <?php echo stripslashes($adventureList['currencyCode']);?> <?php echo stripslashes($adventureList['priceFormatted']);?></span>
                                                <?php
            if($adventureList['specialOfferAvailable'] == 1) {
             ?>
             <div class="original">
               <p>Original Price : <?php echo stripslashes($adventureList['rrpformatted']);?></p>
             </div>
             <div class="save-price">
                <p>Saving Amount : <?php echo stripslashes($adventureList['savingAmountFormated']);?></p>
             </div>
          <?php
            }
            ?>
                                        </div></div></div><div class="c1"></div></div></div>
                             <?php
                                } else {
                                    if($subcategoryId == '') {
                                     $catgory_arr = $adventureList['catIds'];
                                    if(in_array($catId, $catgory_arr)) {        
                             ?>
                              <div class="travel-list-sec">
                            	<div class="row">
                                	<div class="col-xs-12 col-md-3 col-lg-3">
                                    	<img src="<?php echo $adventureList['thumbnailHiResURL'];?>" alt="" width="166" height="160" />
                                    </div>
                                    <div class="col-xs-12 col-md-9 col-lg-9">
                                    	<div class="travel-det">
                                    	<h1><a href="adventure_details.php?name=<?php echo $url;?>&code=<?php echo $adventureList['code'];?>&currencyCode=<?php echo $adventureList['currencyCode'];?>"><?php echo stripslashes($adventureList['title']);?></a></h1>
                                        <p><?php echo stripslashes($adventureList['shortDescription']);?></p>
                                            <div class="rating-box">
                                                <span class="stars"><?php echo $adventureList['rating']; ?></span>
                                            <div class="rating-txt">
                                            	based on <?php echo $adventureList['reviewCount']; ?> reviews
                                            </div>
                                            <div class="c1"></div>
                                        </div>            
                                        <div class="price-box">
                                            <div class="price">Duration :<?php echo stripslashes($adventureList['duration']);?></div>
                                        	<div class="price">From <?php echo stripslashes($adventureList['currencyCode']);?> <?php echo stripslashes($adventureList['priceFormatted']);?></div>
                                                <?php
            if($adventureList['specialOfferAvailable'] == 1) {
             ?>
             <h3>Special Offer </h3>
             <p>Original Price : <?php echo stripslashes($adventureList['rrpformatted']);?></p>
             <p>Saving Amount : <?php echo stripslashes($adventureList['savingAmountFormated']);?></p>
          <?php
            }
            ?>
                                        </div></div></div><div class="c1"></div></div></div>
                             <?php
                                    }
                                  } else{
                                   $sub_catgory_arr = $adventureList['subCatIds'];
                                    if(in_array($subcategoryId, $sub_catgory_arr)) {                 
                            ?>
                            <div class="travel-list-sec">
                            	<div class="row">
                                	<div class="col-xs-12 col-md-3 col-lg-3">
                                    	<img src="<?php echo $adventureList['thumbnailHiResURL'];?>" alt="" width="166" height="160" />
                                    </div>
                                    <div class="col-xs-12 col-md-9 col-lg-9">
                                    	<div class="travel-det">
                                    	<h1><a href="adventure_details.php?name=<?php echo $url;?>&code=<?php echo $adventureList['code'];?>&currencyCode=<?php echo $adventureList['currencyCode'];?>"><?php echo stripslashes($adventureList['title']);?></a></h1>
                                        <p><?php echo stripslashes($adventureList['shortDescription']);?></p>                                      
                                            <div class="rating-box">
                                                <span class="stars"><?php echo $adventureList['rating']; ?></span>
                                            <div class="rating-txt">
                                            	based on <?php echo $adventureList['reviewCount']; ?> reviews
                                            </div>
                                            <div class="c1"></div>
                                        </div>                                            
                                        <div class="price-box">
                                            <div class="price">Duration :<?php echo stripslashes($adventureList['duration']);?></div>
                                        	<div class="price">From <?php echo stripslashes($adventureList['currencyCode']);?> <?php echo stripslashes($adventureList['priceFormatted']);?></div>
                                                <?php
            if($adventureList['specialOfferAvailable'] == 1) {
             ?>
             <h3>Special Offer </h3>
             <p>Original Price : <?php echo stripslashes($adventureList['rrpformatted']);?></p>
             <p>Saving Amount : <?php echo stripslashes($adventureList['savingAmountFormated']);?></p>
          <?php
            }
            ?>
                                        </div></div></div><div class="c1"></div></div></div>
                            <?php
							 } } } } }  
							 ?>                           
                        </div><div class="breadcrumb-new">
       <ul>                 
       <li><div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
       <a href="<?php echo SITE_URL;?>" itemprop="url"><span itemprop="title">Home</span></a><span>></span>
    </div></li>
       <li><strong>Adventures & Activities in <?php echo $state_name. ',' .$country_name; ?></strong></li>
       </ul>      
   </div><div class="c1"></div></div></div></div>
<?php echo $footer ;?>
</body>
</html>

Hi All

 

I am trying to change my website from http to https and I have ran into a problem with one of the scripts producing a none secure http problem

 

Basically when I check this it shows a none secure error

 

ERROR

insecure url = http://cache.graphicslib.viator.com/etcetcetc.jpg which needs to be https://cache.graphicslib.viator.com/etcetcetc.jpg

 

I thinks it is something to do with the array $adventureList array on line 285(not exactly sure, as I didn't write the code and I am not an expert)

 

 

So my question is how do I change this to https url

 

please find attached my page code

 

 

thanks in advance all

 

Alan

 

Link to comment
Share on other sites

  • Solution

I should note that the previous code could mess you up IF the url protocol is already 'https' because the preg_replace function will still match the 'http' part and replace that part with https, so you'll end up with httpss - which is not what you want.

 

A more robust solution would be this:

echo preg_replace('/^http[^s]/i','https', $adventureList['thumbnailHiResURL']);

This regular expression ('/^http[^s]/'i) means - match anything in the beginning of the string that's exactly 'http' followed by something that is not an 's' and ignore case.

 

If you are satisfied that your question has been answered to your satisfaction, please mark this post as answered.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.