Ejemplo n.º 1
0
$posts = getLatestPosts();
foreach ($posts as $row) {
    echo '<li><a href="' . HTTP_SERVER . $row['post_link'] . '.html" title="' . $row['post_h1'] . '">' . $row['post_h1'] . '</a></li>';
}
?>
          </ul>
        </div>
      </div>
      <div class="box">
        <h2>Recent comments:</h2>
        <div class="full">
          <ul>
            <?php 
$comments = getLatestComments();
foreach ($comments as $row) {
    echo '<li><a href="' . HTTP_SERVER . $row['post_link'] . '.html#' . $row['comment_id'] . '" title="' . $row['post_h1'] . '">' . stripString($row['comment'], 38) . '</a></li>';
}
?>
          </ul>
        </div>
      </div>
      <div class="box">
        <h2>Flickr Photos: </h2>
        <div id="flickr_badge_uber_wrapper"> <a href="http://www.flickr.com/photos/swapnilsarwe/" id="flickr_www"> www.<strong>flickr</strong>.com/photos/swapnilsarwe/ </a>
          <div id="flickr_badge_wrapper">
            <script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?count=9&amp;display=random&amp;size=s&amp;layout=x&amp;source=user&amp;user=85538283%40N00"></script>
          </div>
        </div>
      </div>
      <div class="box">
        <?php 
Ejemplo n.º 2
0
    sendResponse(400, array('error' => "Missing required field 'Registration Number'"));
}
if (empty($_POST['name'])) {
    sendResponse(400, array('error' => "Missing required field 'Name'"));
}
if (empty($_POST['birthdate'])) {
    sendResponse(400, array('error' => "Missing required field 'Birthdate'"));
}
// Find the record
$repo = new BIGRepository();
$record = $repo->fetchByNameAndBirthDate($_POST['name'], Datetime::createFromFormat('d-m-Y', $_POST['birthdate']));
if (!$record) {
    sendResponse(400, array('error' => "No records with that registration number were found"));
}
// Does the name of the record approximately match the name we were given? If so, success!
if (stripString($_POST['name']) !== stripString($record->getFullName())) {
    sendResponse(400, array('error' => "Name/Birthdate does not match"));
}
// Does the retrieved record have a matching registration number?
if ($record->getRegistrationNumber() !== $_POST['registration']) {
    sendResponse(400, array('error' => 'Registration number does not match'));
}
sendResponse(200, $record->getData());
// Rough functions
function stripString($string)
{
    return preg_replace("/[^a-z]/", '', strtolower($string));
}
function sendResponse($statusCode, $body)
{
    header("HTTP/1.1 {$statusCode}");