function printEntitlement($entitlement, $index) { if (null != $entitlement) { // print Entitlement here: logMsg("Account: " . $entitlement->account->merchantAccountId . "\n" . "Entitlement[" . $index . "]:" . "\n" . "merchantEntitlementId: " . $entitlement->merchantEntitlementId . "\n" . "Entitlement Description: " . $entitlement->description . "\n" . "merchantAutoBillId: " . $entitlement->merchantAutoBillId . "\n" . "merchantProductId: " . $entitlement->merchantProductId . "\n" . "source: " . $entitlement->source . "\n" . "\tActive: " . $entitlement->active . "\n" . "\t" . dateString("Start", $entitlement->startTimestamp) . "\n" . "\t" . dateString("End", $entitlement->endTimestamp)); } }
$fully++; } } } } //check if there is at least one fully public election left if (count($fully_public) > 0) { $public_elections_displayed = "<table id='table_1' class='table table-striped table-bordered' cellspacing='0'>\n <thead class='success'>\n <tr>\n <th>Name</th>\n <th>Start Date</th>\n <th>Start Time</th>\n <th>End Date</th>\n <th>End Time</th>\n <th>Pin</th>\n <th></th>\n </tr>\n </thead><tbody>"; $public_index = array('election_name', 'election_start_date', 'election_time_from', 'election_end_date', 'election_time_to', 'election_pin'); $public_index_number = count($public_index); for ($move = 0; $move < count($fully_public); $move++) { $public_elections_displayed .= "<tr>"; for ($index = 0; $index < $public_index_number; $index++) { if (count(explode("_", $public_index[$index])) === 3) { if (explode("_", $public_index[$index])[2] === 'date') { $public_elections_displayed .= "<td>" . dateString($fully_public[$move][$public_index[$index]]) . "</td>"; } elseif (explode("_", $public_index[$index])[1] === 'time') { $public_elections_displayed .= "<td>" . timeString($fully_public[$move][$public_index[$index]]) . "</td>"; } } else { $public_elections_displayed .= "<td >" . $fully_public[$move][$public_index[$index]] . "</td>"; } } $key = wrap($fully_public[$move]['election_id']); $public_elections_displayed .= "<td><span class='button btn-default btn-sm pop2' data-bpopup='{\"content\":\"iframe\",\"contentContainer\":\".content\",\"loadUrl\":\"publicElections.php?key=" . $key . "\"}'>View</span></td>"; // $public_elections_displayed.="<td><a href='#' onclick='Public($key)'>See </a></td>"; $public_elections_displayed .= "</tr>"; } $public_elections_displayed .= "</tbody></table>"; $public_adek = true; }
if (strtolower(substr($sql, 0, 6)) == "select") { echo "Showing Results for: "; echo $sql; echo "<br />"; $link = mysqli_connect('ep', 'user', 'pass', 'db'); if (!$link) { die('Could not connect: ' . mysql_error()); } if ($result = mysqli_query($link, $sql)) { $resultArray = array(); $tempArray = array(); while ($row = $result->fetch_object()) { $tempArray = $row; array_push($resultArray, $tempArray); } $relFilePath = '/queries/results' . dateString() . '.json'; $filePath = '/var/www/html/' . $relFilePath; $fp = fopen($filePath, 'w'); fwrite($fp, json_encode($resultArray)); fclose($fp); } mysqli_close($link); } else { if ($sql == "") { echo 'Please enter a valid query.'; } else { echo $sql . ' is not a valid command supported by this client.'; } } function dateString() {
?> </div> </div> <div class="expanded-author"> <img src="https://secure.gravatar.com/avatar/<?php echo md5(strtolower(trim($user_info["email"]))); ?> ?d=mm&s=48" alt="advertisment author profile picture"> <div> <h4><?php echo $user_info["name"]; ?> </h4> <p><?php echo sprintf(Translate::string("ad_expanded.nr_of_deals_since_date_registred"), $advert["count"], dateString($user_info["date_registered"], "%B, %Y")); ?> </p> </div> </div> <a class="btn contact-seller" data-user-id="<?php echo $user_info["id"]; ?> "><?php echo Translate::string("ad_expanded.contact_seller"); ?> </a> <a data-advert-id="<?php echo $product_id; ?> " class="add-to-compare-btn btn"><?php
<div > <label >When do you want election result to be display?</label><br> <input type="radio" name="result_display" value="after" required'; if ($display == 'after') { $status_string .= ' checked'; } $status_string .= '>After Election <input type="radio" name="result_display" value="during" required'; if ($display == 'during') { $status_string .= ' checked'; } $status_string .= '>During Election </div> </div><br>'; $dummy1 = dateString($this_election["election_start_date"]); $dummy2 = dateString($this_election["election_end_date"]); $dummy3 = timeString($this_election["election_time_from"]); $dummy4 = timeString($this_election["election_time_to"]); //php code for the update details if (isset($_POST["update"])) { //retain new inputs for date and time $dummy1 = $_POST["start_date"]; $dummy2 = $_POST["end_date"]; $dummy3 = $_POST["start_time"]; $dummy4 = $_POST["end_time"]; //check name was changed if ($this_election['election_name'] === $_POST["name_of_election"]) { $name_of_election = $this_election['election_name']; } else { $name_of_election = ""; if (empty($_POST["name_of_election"])) {
$view_news_query->execute(); $view_news_query->setFetchMode(PDO::FETCH_ASSOC); $row = $view_news_query->fetchAll(); for ($i = 0; $i < count($row); $i++) { $adminPhoto = $images_dir . $row1['picture_name']; $date_time1 = explode(" ", $row[$i]['date_created']); $date1 = getDateInterval($date_time1[0]); $time1 = timeString($date_time1[1]); $view_posted_news .= "<div class='me' style='margin-bottom:10px; ' >" . "<br>\n <label style='overflow:hidden;text-overflow:ellipsis;'>" . $row[$i]['news'] . "</label>\n <br>" . $date1 . " " . $time1 . "<br></div>"; } //querying for election name $election_name = $election_details_test = ""; $row = getElectionDetails($election_id)[0]; $election_name .= $row['election_name']; $_SESSION['election_name'] = $election_name; $election_details_test .= "<label>Start Date:</label> " . dateString($row['election_start_date']) . "<br>\n <label>Start Time:</label> " . timeString($row['election_time_from']) . "<br><label>End Date:</label>  " . dateString($row['election_end_date']) . "<br><label>End Time:</label> " . timeString($row['election_time_to']) . "<br>\n <label>Number of Voters: </label> " . count(getAllMembers("joined", ['election_id'], ['election_id', '=', $election_id])) . "<br><label>Number of Contestants: </label> " . count(getAllMembers("contestants", ['contestant_id'], ['election_id', '=', $election_id])); //getting the user_id for a particular election $election_admin_details = $election_admin_detail = ""; $images_dir = "../images/users/"; $user_id_result = $row["user_id"]; //querying to get the admin email $row = getAllMembers("users", ["*"], ["user_id", "=", $user_id_result])[0]; $election_admin_details .= "<div class='col-md-6'><label>Name:</label> " . $row['lname'] . " " . $row['fname'] . "\n <br><label>Username:</label> " . $row['username'] . "<br><label>Email:</label> " . $row['email'] . "<br>\n <label>Telephone:</label> " . $row['phone'] . "</div>"; $election_admin_detail .= "<div class='col-md-4'><img src=" . $images_dir . $row['picture_name'] . " width='120px'\n height='auto' style='border-radius:100%;max-height:200px;' class='preview' id='displayedPhoto'></div>"; //checking for the link vote $hasvoted = hasvoted(user_id($myemail), $election_id); //determining when to make the view profile link visible or not' $checkContestant1 = checkContestant(user_id($myemail), $election_id); if (!empty($checkContestant1)) { $profile1 = "<a href='viewprofile.php' class='active'>View Profile</a>"; } else {
$part3 = explode(':', $election_time_to); $end_hour = $part3[0]; $end_minute = $part3[1]; //getting the election duration $election_end1 = $election_end_date . " " . $election_time_to; $election_end = strtotime($election_end1); $electionStartDateTemp = $election_start_date . " " . $election_time_from; $electionStartDate = convert_date($electionStartDateTemp); //} $string_election = ""; //get number of registered and voted voters $number_registered = count(getAllMembers('joined', ['joined_id'], ['election_id', '=', $election_id])); $number_voted = count(getAllMembers('joined', ['joined_id'], ['election_id', '=', $election_id], 0, 'AND', ['has_voted', '=', 1])); //$string_election.="<div class='col-md-6'><label>Election Start Date:</label> ".dateString($election_start_date)."</div> <div class='col-md-6'><label>Start time: </label> ".timeString($election_time_from)."</div><div class='col-md-6'> <label>Election End Date: </label>". //dateString($election_end_date)."</div> <div class='col-md-6'><label>End time: </label> ".timeString($election_time_to).'</div>'; $string_election .= "<div class='col-md-6'><label>Number of registered voter(s):</label> " . $number_registered . "</div> <div class='col-md-6'><label>Election End Date: </label> " . dateString($election_end_date) . "</div><div class='col-md-6'> <label>Those that have voted: </label>" . $number_voted . "</div> <div class='col-md-6'><label>End time: </label> " . timeString($election_time_to) . '</div>'; $string = ""; //get all posts for this election $allPosts = getAllPosts($election_id); //for each post,get all contestants $postCon = $display = $string_array = $string_result_array = []; //let superIndex retain 1D array of all post $superIndex = []; $image_dir = "../images/contestants/"; for ($i = 0; $i < count($allPosts); $i++) { //let the post by the key to all contestant array in postCon array $postCon[$allPosts[$i]['post']] = getAllContestants($allPosts[$i]['post_id']); //push each post to the superIndex array_push($superIndex, $allPosts[$i]['post']); } //lets go deeper, write Japhet on the wall of eVoting
<span class="error"><?php if (empty($messaging)) { echo $time_of_election_fromErr; } ?> </span> </div><br> </div> </div><br> <div class="row"> <div class="form-group col-xs-12 col-md-6"> <label>End Date of Election</label><br> <div> <d><?php echo dateString($this_election['election_end_date']); ?> </d> <input type="text" class="datePicker form-control" id="datePicker2" name="end_date" value="<?php echo $dummy2; ?> " style="display: none;"> </div> <span class="error"><?php if (empty($messaging)) { echo $end_date_of_electionErr; } ?> </span><br> </div> <div class="form-group col-xs-12 col-md-6">
function getDateInterval($date) { $today = date("Y-m-d"); $todayCreate = date_create($today); $post_date = date_create($date); $date_diff = date_diff($post_date, $todayCreate); $getDate = $date_diff->format("%r%a"); if ($getDate == 0) { return "today at"; } elseif ($getDate == 1) { return $getDate . "day ago at"; } elseif ($getDate > 4) { return dateString($date) . " at"; } else { return $getDate . "days ago at"; } }