<?php

session_start();
if (empty($_SESSION['session_name'])) {
    include 'utils.php';
    ajaxLoginRedirect();
} else {
    include 'getDefaults.php';
    include '../../connectionString.php';
    $dbconn = pg_connect($connectionString);
    $sid = getLastSearchID($dbconn);
    if ($sid != null) {
        $defaults = getDefaults($dbconn, $sid);
        pg_close($dbconn);
        echo json_encode($defaults);
    } else {
        pg_close($dbconn);
        $date = date("d-M-Y H:i:s");
        echo json_encode(array("error" => array("You have made no previous searches", $date)));
    }
}
Example #2
0
<?php

// component
// defaults
if (!isset($cJokes)) {
    $cJokes = getDefaults();
}
?>



<div class="cExample">
	<div class="tab"><?php 
echo $cJokes['tabTitle'];
?>
</div>
	<h1><?php 
echo $cJokes['title'];
?>
</h1>
	<p><?php 
echo $cJokes['content'];
?>
</p>
	<a class="cta" href="<?php 
echo $cJokes['ctaLink'];
?>
"><?php 
echo $cJokes['cta'];
?>
</a>