Jump to content

Getting Parse Error: Syntax Error, Unexpected T_Require In /home/xxx/xxx/xxx/xxx/ajaxdata.php On Line 1 After Moving Server


Recommended Posts

The error is most likely because there is no white-space after the first opening <?php tag. edit: or after the comment/before the require() statement.

Edited by PFMaBiSmAd

^ that too

 

should indent your code so it is more readable.

 

<?php
/* * To change this template, choose Tools | Templates * and open the template in the editor. */
require ('./../../../wp-blog-header.php');
if (isset($_GET['action']))
{
switch ($_GET['action'])
{
case 'verify_code':
if (!isset($_SESSION))
{
session_start();
}
if (isset($_SESSION['dcode']))
{
if ($_GET['dcode'] == $_SESSION['dcode'][$_GET['postID']])
{
echo 'Success:' . $_SESSION['durl']['postID'];
}
else
{
echo 'Failed: Wrong code entered.';
}
}
else
{
echo 'System is not working as expected.';
}
break;
case 'handleCookie':
if (!isset($_SESSION))
{
session_start();
}
if (isset($_GET['task']))
{
switch ($_GET['task'])
{
case 'addCookie':
$_SESSION[$_GET['name']] = $_GET['value'];
if (isset($_SESSION[$_GET['name']]))
{
echo 'Success';
}
else
{
echo 'Failed';
}
break;
case 'readCookie':
echo $_SESSION[$_GET['name']];
break;
case 'deleteCookie':
unset($_SESSION[$_GET['name']]);
if (!isset($_SESSION[$_GET['name']]))
{
echo 'Success';
}
else
{
echo 'Failed';
}
break;
}
}
break;
case 'exportToCSV':
$data = urldecode($_GET['data']);
$fileName = "mobileComparison.csv";
if (isset($_GET['start']))
{
unlink($fileName);
}
$fp = fopen($fileName, "a");
fwrite($fp, str_replace('\"', "\"", $data) . "\r\n");
fclose($fp);
if (isset($_GET['end']))
{
echo '<a href="';
bloginfo('template_directory');
echo '/' . $fileName;
echo '">Download CSV File</a>';
}
break;
default:
echo 'System failed to process your request.';
break;
}
}
else
{ ?>    <?php
$k = 0;
$temp = $wp_query;
$wp_query = null;
if (isset($_GET['brand']) || isset($_GET['meta_key']))
{
if (!isset($_GET['meta_key']))
{
$wp_query = new WP_Query('post_type=mobile&showposts=28&paged=' . $paged . '&brands=' . $_GET['brand'] . '');
}
else
{
$metakeys = explode(",", $_GET['meta_key']);
$getmetavalues = explode(",", $_GET['meta_value']);
foreach($getmetavalues as $ck => $cv)
{
if ($cv == "" || $cv == " ")
{
unset($metavalues[$ck]);
}
}
unset($metakeys['ecpt_operatingsystem']);
$countMetakeys = count($metakeys) - 1;
for ($i = 0; $i <= $countMetakeys - 1; $i++)
{
$metavalues[] = $getmetavalues[$i];
unset($getmetavalues[$i]);
}
sort($getmetavalues);
foreach($getmetavalues as $key => $value)
{
if ($value == "" || $value == " ")
{
unset($getmetavalues[$key]);
}
}
if (!is_null($getmetavalues[0]) || !is_null($getmetavalues[1]))
{
$metavalues[] = $getmetavalues;
}
foreach($metakeys as $randomkeys)
{
if ($randomkeys == "ecpt_operatingsystem")
{
$metacompare[] = "IN";
}
else
{
if ($randomkeys == "ecpt_mop")
{
$metacompare[] = "BETWEEN";
}
else
{
$metacompare[] = "LIKE";
}
}
}
foreach($metakeys as $keyU => $valueU)
{
if ($valueU == null || $valueU == '' || $valueU == ' ')
{
unset($metakeys[$keyU]);
}
}
foreach($metakeys as $keyU => $valueU)
{
if ((string)$keyU == "ecpt_mop")
{
$metaquery[] = array(
'key' => $metakeys[$keyU],
'value' => explode("-", str_replace(" ", "", str_replace("INR ", "", $metavalues[$keyU]))) ,
'type' => 'numeric',
'compare' => $metacompare[$keyU]
);
}
else
{
if ($metakeys[$keyU] == "ecpt_operatingsystem")
{
$metakeys[$keyU] = "ecpt_osparent";
}
$metaquery[] = array(
'key' => $metakeys[$keyU],
'value' => $metavalues[$keyU],
'compare' => $metacompare[$keyU]
);
}
}
$showPosts = 28;
if (isset($_GET['showPosts']))
{
$showPosts = $_GET['showPosts'];
}
else
{
$showPosts = 28;
}
$arguments = array(
'post_type' => 'mobile',
'showposts' => $showPosts,
'paged' => $paged,
'brands' => $_GET['brand'],
'meta_query' => $metaquery
);
$wp_query = new WP_Query($arguments);
}
}
else
{
$wp_query = new WP_Query('post_type=mobile&showposts=28&paged=' . $paged);
}
if (!$wp_query->have_posts())
{
echo '<h1>No Results Found.</h1>';
}
$numPosts = 0;
while ($wp_query->have_posts()):
$wp_query->the_post();
$mobile_img = get_post_meta(get_post_meta($post->ID, "mobile_mobile-thumb-image_thumbnail_id", $single = true) , '_wp_attached_file', $single = true);
$mobile_img_alt = get_post_meta(get_post_meta($post->ID, "mobile_mobile-thumb-image_thumbnail_id", $single = true) , '_wp_attachment_image_alt', $single = true);
include "mobile-img.php";
?>	    <?php
if ($k % 4 == 0)
{
echo '<div class="clear"></div>';
}
$numPosts++; ?>	    <div class="model-compare-block" id="model-compare-block<?php
echo $numPosts; ?>">		    <div class="model-preview"><center><a href="<?php
the_permalink(); ?>">					    <img id="model-image<?php
echo $numPosts; ?>" src="<?php
bloginfo('home');
echo '/wp-content/uploads/' . $mobile_img; ?>" alt="<?php
echo $mobile_img_alt; ?>">				    </a></center></div>		    <div class="model-name"><a id="model-name<?php
echo $numPosts; ?>" href="<?php
the_permalink(); ?>"><?php
the_title(); ?></a></div>		    <div style="display:none;" id="postID-<?php
echo $numPosts; ?>"><?php
echo $post->ID; ?></div>		    <div class="compare-btn" id="compare-btn<?php
echo $numPosts; ?>"><center><a href="#"><img src="<?php
bloginfo('template_directory'); ?>/images/comare-btn.png" width="97" height="29" /></a></center></div>	    </div>	    <?php
$k++;
unset($mobile_img);
unset($mobile_img_alt);
endwhile;
if (function_exists('wp_pagenavi'))
{
wp_pagenavi();
}
$wp_query = null;
$wp_query = $temp; ?>    <div class="clear"></div>    <?php
} ?>

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.