Okay I am wondering how I get two countdown timers on the one page?
<script type = 'text/javascript'>
window.onload=function() {
setInterval("<?php
$array = count($settime);
for ($i = 0; $i < $array; $i++) {
$thitime = explode(":", $settime[$i]);
echo "timeleft(" . $thitime[1] . ", " . $thitime[0] . "); ";
}
?>", 1000);
}
function timeleft(string, id)
{
var xmlhttp=GetXmlHttpObject();
if(xmlhttp==null) { alert("Sorry, Your browser doesnt support HTTP Requests");
return;
}
var elem = "time" + id;
var load = "time_left.php?string=" + string;
xmlhttp.onreadystatechange=function() {
if(xmlhttp.readyState==4) {
document.getElementById(elem).innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", load, true);
xmlhttp.send(null);
}
function GetXmlHttpObject() {
var xmlhttp=null;
try {
xmlhttp=new XMLHttpRequest();
}
catch (e) {
try {
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlhttp;
}
</script>
The page I am trying to run the two timers off is only loading one of the timers, I have tried multiple things to try and fix the issue, and can't seem to figure out what it is that is wrong with it..
I even tried making two different timer scripts and that didn't work..
Here is the complete code of the page I want to run the two timers on..
<?php
/*------------includes--------------*/
include('./includes/connections.php');
include('./includes/brain_file.php');
include('./includes/style_top.php');
/*------------includes--------------*/
if ($pl['my_tuts_on'] == 'yes') {
echo "<tr bgcolor=#E6E6E6><td>
Here you can view all the inmates currently in jail. You may attempt to bust/bail them, Bailing them costs a fee, Busting them uses 10 energy and is not a garantee you will bust them, Just be carefull not to get caught and end up in jail yourself.
</td></td></tr></table></center><hr/ width=95%>";
}
echo "<center><main>Jail</main><hr width='95%'/>";
if ($pl['my_hosp'] > gmtime()) {
echo "Sorry this page is not viewable while in hospital!<hr width='85%'/>";
include('./includes/style_bottom.php');
exit();
}
$_GET['page'] = abs(intval($_GET['page']));
$min = ($_GET['page'] > '1') ? (($_GET['page'] - 1) * 25) : $min = 0;
$q_ry = array();
$q_ry = "SELECT `playerid` FROM `members`
WHERE `my_jail` > '" . mysql_real_escape_string(gmtime()) . "'";
$tot = array();
$tot = mysql_query($q_ry);
if ($joh['my_jail'] > gmtime()) {
$settime[] = $pl['playerid'] . ":" . $pl['my_jail'];
echo "<br><font size=2><b>", stripslashes($pl['jail_reason']), "</b>
<br>You will be in jail for another <span id = 'time" . $pl['playerid'] . "'><b>" . gettimeleft($pl['my_jail']) . "</b></span> yet!</font><br><br><hr width='85%'>";
}
?>
<script type = 'text/javascript'>
window.onload=function() {
setInterval("<?php
$array = count($settime);
for ($i = 0; $i < $array; $i++) {
$thitime = explode(":", $settime[$i]);
echo "timeleft(" . $thitime[1] . ", " . $thitime[0] . "); ";
}
?>", 1000);
}
function timeleft(string, id)
{
var xmlhttp=GetXmlHttpObject();
if(xmlhttp==null) { alert("Sorry, Your browser doesnt support HTTP Requests");
return;
}
var elem = "time" + id;
var load = "time_left.php?string=" + string;
xmlhttp.onreadystatechange=function() {
if(xmlhttp.readyState==4) {
document.getElementById(elem).innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", load, true);
xmlhttp.send(null);
}
function GetXmlHttpObject() {
var xmlhttp=null;
try {
xmlhttp=new XMLHttpRequest();
}
catch (e) {
try {
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlhttp;
}
</script>
<?php
if ($pl['my_jail'] > gmtime()) {
echo "<b>><a href='bust.php'>Try and escape for " . abs(intval($pl['my_maxnerve'] / 2)) . " nerve</a></b>
<hr width='85%'>";
}
echo "<b></b> ";
if (mysql_num_rows($tot) <= '25') {
echo "";
} else {
if ($_GET['page'] > '1') {
echo "<a href='jail.php?page=" . ($_GET['page'] - 1) . "'><<</a> ";
}
for ($i = 0; $i < (mysql_num_rows($tot) / 25); $i++) {
echo "<a href='jail.php?page=" . ($i + 1) . "'>";
if (($i + 1) == $_GET['page']) {
echo "<b>" . ($i + 1) . "</b>";
} else {
echo "<font color = '#999999'>" . ($i + 1) . "</font>";
}
echo "</a> ";
}
if ($_GET['page'] < $i) {
echo " <a href='jail.php?page=" . ($_GET['page'] + 1) . "'>>></a>";
exit();
}
}
echo "<table class='sidebarLink' border='0' width=95% class='rounded'><tr bgcolor=#151515>
<td height='20'><font color = '#FFFFFF'><b>ID#</b></font></td>
<td height='20'><font color = '#FFFFFF'><b>Player</b></font></td>
<td width=25%><font color = '#FFFFFF'><b>Time</b></font></td>
<td height='20'><font color = '#FFFFFF'><b>Level</b></font></td>
<td height='20'><font color = '#FFFFFF'><b>Reason</b></font></td>
<td height='20'><font color = '#FFFFFF'><b>Release</b></font></td></tr>";
$num = 0;
$q_ry = array();
$q_ry = "SELECT `playerid`,`playername`,`my_level`,`jail_offer`,`my_jail`,`jail_reason`
FROM `members`
WHERE `my_jail` > '" . mysql_real_escape_string(gmtime()) . "'
ORDER BY `my_jail` DESC
LIMIT $min,25";
$hopl = array();
$hopl = mysql_query($q_ry);
if (mysql_num_rows($hopl)) {
$hp = array();
while ($hp = mysql_fetch_array($hopl)) {
$num++;
if ($num % 2) {
$color = "#E6E6E6";
} else {
$color = "#E6E6E6";
}
$q_ry = array();
$q_ry = "SELECT `my_bustreward`
FROM `members_extra`
WHERE `playerid` = '" . $hp['playerid'] . "'";
$du = array();
$du = mysql_fetch_array(mysql_query($q_ry));
$settime[] = $hp['playerid'] . ":" . $hp['my_jail'];
echo "<tr bgcolor=#E6E6E6>
<td><a href = 'messages.php?action=send&XID=" . $hp['playerid'] . "'>" . $hp['playerid'] . "</a></td>
<td><a href = 'profile.php?XID=" . $hp['playerid'] . "'>" . htmlentities($hp['playername']) . "</a></td>
<td><span id = 'time" . $hp['playerid'] . "'><b>" . gettimeleft($hp['my_jail']) . "</b></span></td>
<td>" . $hp['my_level'] . "</td>
<td>" . stripslashes($hp['jail_reason']) . "</td>
<td>[<a href='release.php?action=bail&XID=" . $hp['playerid'] . "'>Bail</a>]
[<a href='release.php?action=bust&XID=" . $hp['playerid'] . "'>Bust</a>]</td></tr>";
}
} else {
echo "<tr>
<td colspan = '7' align = 'center'>
You walk into the jail to tease some inmates, but there are no inmates to tease!
</td></tr>";
}
echo "</table>
<hr width = '95%'>";
if ($pl['my_jail'] > gmtime() || $pl['am_i_staff'] > 4) {
if ($pl['am_i_staff'] > 4) {
echo '<table width="95%" align="center" border="0" bgcolor="#E6E6E6">
<b>Clear the current shoutbox.</b>
<form method="post" action="#"><tr>
<td><input type="hidden" name="clear"></td>
</tr><tr>
<td colspan="2" valign="middle" align="center"><input class="hospchat" type="submit" value="Clear ALL Shouts"></td>
<td></td>
</tr></form></table><br />';
}
if (isset($_POST['clear'])) {
if ($pl['am_i_staff'] < 5) {
print "Sorry, staff only. <a href=jail.php>> back</a>.";
exit();
} else {
mysql_query("TRUNCATE table `jailshoutsbox`");
print "All of the jail shouts have been <b>cleared</b> <a href=jail.php>> back</a>.";
}
}
if (isset($_POST['shout'])) {
if ($pl['lastShoutj'] == date("i") && $pl['am_i_staff'] < 5 && $pl['my_dondays'] < 1) {
echo "<div style='background: #DFDFDF;' width='85%'>Sorry, non donators can only post once per minute. <br /> <a href=jail.php> > back</a></div><br />";
exit();
}
if ($pl['my_jail'] <= 0 && $pl['am_i_staff'] < 5) {
echo "You are not in the jail. <a href=jail.php>> Back</a>";
exit();
}
echo "<div style='background: #E6E6E6;' width='85%'>You've shouted<br /><a href=jail.php>Refresh</a></div><br />";
$_POST['shout'] = htmlspecialchars(($_POST['shout']));
$not = array(
"'",
"/",
"<",
">",
";"
);
$_POST['shout'] = str_replace($not, "", $_POST['shout']);
mysql_query("INSERT INTO `jailshoutsbox` VALUES ('NULL', {$_SESSION['playerid']}, '{$_POST['shout']}', " . date("d") . ")");
}
echo ' <hr width=95% /> Post a message on the shoutbox.
<table width="95%" align="center" border="0" bgcolor="#E6E6E6">
<form method="post" action="#"><tr>
<td>Your Message: (max 155) </td>
<td><input class="hospchat" type="text" name="shout" maxlength="155"></td>
</tr><tr>
<td colspan="2" valign="middle" align="center"><input class="hospchat" type="submit" value="Shout"></td>
<td></td>
</tr></form></table><br /><table width="95%" style=text-align:left class="table2" border="0" cellspacing="2">
<tr bgcolor="#151515" style="font-style:bold; text-align:center;"><td style="font-style:bold;" width=55%><b><font color="#FFFFFF">Posted By:</b></td><td style="font-style:bold;" width="44%"><b><font color="#FFFFFF">Messsage:</b></td></tr>
';
$get = mysql_query("SELECT * FROM `jailshoutsbox` ORDER BY `ID` DESC LIMIT 10");
while ($r = mysql_fetch_array($get)) {
$num9 = $num9 + 1;
$odd9 = "#CCCCCC";
$even9 = "#e3e3e3";
if ($num9 % 2) {
$color9 = "$even9";
} else {
$color9 = "$odd9";
}
if ($r['User'] == 1) {
$r['Shout'] = "<font color='blue'>" . $r['Shout'] . "</font>";
}
$user = mysql_query("SELECT `playername` FROM `members` WHERE `playerid`={$r['User']}");
while ($user1 = mysql_fetch_array($user))
$player = ($r['User'] == 0) ? "SYSTEM" : "<a href='profile.php?XID={$r['User']}'>[{$r['User']}] {$user1['playername']}</a>";
echo "<tr height='50px' bgcolor=#E6E6E6><td>$player</td><td style='text-align:center;'>{$r['Shout']}</td></tr>";
}
echo "</table>";
}
include('./includes/style_bottom.php');
?>
And here is the gettimeleft function.
function gettimeleft($tl) {
if($tl <= time()) { $release = "0 Seconds"; }
else
{
$mins = floor(($tl - time()) / 60);
$hours = floor($mins / 60);
$mins -= $hours * 60;
$days = floor($hours / 24);
$hours -= $days * 24;
$months = floor($days / 31);
$days -= $months * 31;
$weeks = floor($days / 7);
$days -= $weeks * 7;
$timeleft = ($tl - time());
$secs = round($timeleft%60);
if ($months > 0)//MONTHS
{
$release .= " $months Month" . ($months > 1 ? "s" : "");
}
if ($weeks > 0)//WEEKS
{
if ($months > 0)
{
$release .= ",";
}
$release .= " $weeks Week" . ($weeks > 1 ? "s" : "");
}
if ($days > 0)//DAYS
{
if ($months > 0 ||$weeks > 0)
{
$release .= ",";
}
$release .= " $days Day" . ($days > 1 ? "s" : "");
}
if ($hours > 0)//HOURS
{
if ($months > 0 ||$weeks > 0 || $days > 0)
{
$release .= ",";
}
$release .= " $hours Hour" . ($hours > 1 ? "s" : "");
}
if ($mins > 0)//MINUTES
{
if ($months > 0 ||$weeks > 0 || $days > 0 || $hours > 0)
{
$release .= ",";
}
$release .= " $mins Minute" . ($mins > 1 ? "s" : "");
}
if($secs > 0)//SECONDS
{
if($release != "")
{
$release .= " and";
}
$release .= " $secs Second" . ($secs > 1 ? "s" : "");
}
}
return $release;
}
Is anyone please able to help me out with this?
Related
I developing a comment system for my social media, but comments are inserted into database even if it's empty.So i want nothing to happen if comment field is empty,i don't want to echo any message or submitting the comment.
This is my code
<?php
// Get id of post
if(isset($_GET['post_id'])) {
$post_id = $_GET['post_id'];
}
$user_query = mysqli_query($con, "SELECT added_by, user_to FROM posts
WHERE id='post_id'");
$row = mysqli_fetch_array($user_query);
$posted_to = $row['added_by'];
$user_to = $row['user_to'];
if(isset($_POST['postComment' . $post_id])) {
$post_body = $_POST['post_body'];
$post_body = mysqli_escape_string($con, $post_body);
$date_time_now = date("Y-m-d H:i:s");
$insert_post = mysqli_query($con, "INSERT INTO comments VALUES ('',
'$post_body', '$userLoggedIn', '$posted_to', '$date_time_now', 'no',
'$post_id')");
if($posted_to != $userLoggedIn) {
$notification = new Notification($con, $userLoggedIn);
$notification->insertNotification($post_id, $posted_to, "comment");
}
if($user_to != 'none' && $user_to != $userLoggedIn) {
$notification = new Notification($con, $userLoggedIn);
$notification->insertNotification($post_id, $user_to,
"profile_comment");
}
$get_commenters = mysqli_query($con, "SELECT * FROM comments WHERE
post_id='$post_id'");
$notified_users = array();
while($row = mysqli_fetch_array($get_commenters)) {
if($row['posted_by'] != $posted_to && $row['posted_by'] != $user_to
&& $row['posted_by'] != $userLoggedIn &&
!in_array($row['posted_by'], $notified_users)) {
$notification = new Notification($con, $userLoggedIn);
$notification->insertNotification($post_id, $row['posted_by'],
"comment_non_owner");
array_push($notified_users, $row['posted_by']);
}
}
echo "<p>Comment Posted! </p>";
}
?>
<form action="comment_frame.php?post_id=<?php echo $post_id; ?>"
id="comment_form" name="postComment<?php echo $post_id; ?>"
method="POST">
<textarea name="post_body" placeholder="Add a comment"></textarea>
<input type="submit" name="postComment<?php echo $post_id; ?>"
value="Comment">
</form>
<!-- Load Comments -->
<?php
$get_comments = mysqli_query($con, "SELECT * FROM comments WHERE
post_id='$post_id' ORDER BY id ASC");
$count = mysqli_num_rows($get_comments);
if ($count != 0) {
while($comment = mysqli_fetch_array($get_comments)) {
$comment_body = $comment['post_body'];
$posted_to = $comment['posted_to'];
$posted_by = $comment['posted_by'];
$date_added = $comment['date_added'];
$removed = $comment['removed'];
//Timeframe
$date_time_now = date("Y-m-d H:i:s");
$start_date = new DateTime($date_added); // Time of Post
$end_date = new DateTime($date_time_now); // Current time
$interval = $start_date->diff($end_date); // Difference between
dates
if($interval->y >= 1) {
if($interval == 1)
$time_message = $interval->y . " year ago"; // 1 year ago
else
$time_message = $interval->y . " years ago"; // 1+ year ago
}
else if ($interval-> m >= 1) {
if($interval->d == 0) {
$days = " ago";
}
else if($interval->d == 1) {
$days = $interval->d . " days ago";
}
else {
$days = $interval->d . " days ago";
}
if($interval->m == 1) {
$time_message = $interval->m . " month". $days;
}
else {
$time_message = $interval->m . " months". $days;
}
}
else if($interval->d >=1) {
if($interval->d == 1) {
$time_message = "Yesterday";
}
else {
$time_message = $interval->d . " days ago";
}
}
else if($interval->h >= 1) {
if($interval->h == 1) {
$time_message = $interval->h . " hour ago";
}
else {
$time_message = $interval->h . " hours ago";
}
}
else if($interval->i >= 1) {
if($interval->i == 1) {
$time_message = $interval->i . " minute ago";
}
else {
$time_message = $interval->i . " minutes ago";
}
}
else {
if($interval->s < 30) {
$time_message = "Just now";
}
else {
$time_message = $interval->s . " seconds ago";
}
}
$user_obj = new User($con, $posted_by);
?>
<div class="comment_section">
<a href="<?php echo $posted_by?>" target="_parent"><img src="<?php
echo $user_obj->getProfilePic(); ?>" title="<?php echo $posted_by;
?>" style="float:left;" height="30"></a>
<a href="<?php echo $posted_by?>" target="_parent"> <b><?php echo
$user_obj->getFirstAndLastName(); ?> </b> </a>
<?php echo $time_message . "<br>" .
$comment_body; ?>
<hr>
</div>
<?php
}
}
else {
echo "<center><br><br>No comments to show</center>";
}
?>
</body>
</html>
Add this attribute to the correct input field: <input required: required;> that should fix it for you :-)
see http://w3c.github.io/html/sec-forms.html#the-required-attribute for more information
Included a demo below. The first form will display an error message when it is submitted - attribute required - (which you probably don't want) and the second form doesn't give any feedback - attribute required but novalidate for the form.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form>
<textarea required onsubmit="return false;"></textarea><br>
<input type="submit" value="submit">
</form><br><br>
<form novalidate onsubmit="return false;">
<textarea required></textarea><br>
<input type="submit" value="submit">
</form>
I installed a php gallery and configured it and I finally could make it to run inside an iframe.But now when I click at an image, I want it to open that image pop-up view outside the iframe.imgGallery
<?php
if (isset($this->vars['file_list']))
{
$thumb_code['file'] = $this->getThumbCode("file");
foreach ($this->vars['file_list'] as $file)
{
$output = '';
$img_url = $this->genThumbURL($request, $file);
if ($this->settings['use_popup_image_viewer'] == true) {
$url = "?image=" . $request . $file['file'];
if ($this->settings['show_thumbs_under_viewer'] == true) {
$fancy_class = "fancybox-thumbs";
$fancy_attr = "data-fancybox-group=\"thumb\"";
} else {
$fancy_class = "fancybox";
$fancy_attr = "data-fancybox-group=\"gallery\"";
}
} else {
$url = '?view=' . $request . $file['file'];
$fancy_class = "";
$fancy_attr = "";
}
//<<URL>> = $url = ?view=folder/image.jpg
//<<FANCY_CLASS>> = $fancy_class = fancybox-thumbs (If left out fancybox will not work. Use inside class attribute on A tag)
//<<FANCY_ATTR>> = $fancy_attr = data-fancybox-group="gallery" (If left out fancybox will not work. Use on A tag)
//<<TITLE>> = $file['file'] = image.jpg
//<<THUMB_WIDTH>> = $this->settings['thumb_size_' . $this->vars['thumb_size']] = 125 (autodetect thumb size also)
//<<THUMB_HEIGHT>> = $this->settings['thumb_size_' . $this->vars['thumb_size']] = 125 (autodetect thumb size also)
//<<THUMB_LOCATION>> = $this->escapeString($img_url) = phppi/cache/folder/image_small.jpg (may also set to phppi/themes/gallery/themename/images/no_images.png if no image)
//<<THEME_LOCATION>> = $this->showThemeURL(1) = phppi/themes/gallery/themename
$replace_codes = array("<<URL>>",
"<<FANCY_CLASS>>",
"<<FANCY_ATTR>>",
"<<TITLE>>",
"<<THUMB_WIDTH>>",
"<<THUMB_HEIGHT>>",
"<<THUMB_LOCATION>>",
"<<THEME_LOCATION>>"
);
$replace_values = array($url,
$fancy_class,
$fancy_attr,
$file['file'],
$this->settings['thumb_size_' . $this->vars['thumb_size']],
$this->settings['thumb_size_' . $this->vars['thumb_size']],
$this->escapeString($img_url),
$this->showThemeURL(1)
);
echo str_replace($replace_codes, $replace_values, $thumb_code['file']);
}
}
echo "<div style=\"clear: both;\"></div>\n";
}
function showPrevFolderURL($format = 0)
{
//0 = Output url
//1 = Return url as string
if ($format == 0)
{
echo '?' . $this->vars['dir']['req']['parent'];
} else if ($format == 1) {
return '?' . $this->vars['dir']['req']['parent'];
}
}
function showPrevImageURL($format = 0)
{
//0 = Output url
//1 = Return url as string
if ($format == 0)
{
if ($this->settings['use_javascript_navigation'] == true)
{
echo 'javascript: phppi.go_prev_image();';
} else {
if (isset($this->vars['file_list'][$this->vars['previous_image_id']]['full_path']))
{
echo '?view=' . $this->vars['file_list'][$this->vars['previous_image_id']]['full_path'];
} else {
echo '';
}
}
} else if ($format == 1) {
if ($this->settings['use_javascript_navigation'] == true)
{
return 'javascript: phppi.go_prev_image();';
} else {
if (isset($this->vars['file_list'][$this->vars['previous_image_id']]['full_path']))
{
return '?view=' . $this->vars['file_list'][$this->vars['previous_image_id']]['full_path'];
} else {
return '';
}
}
}
}
function showNextImageURL($format = 0)
{
//0 = Output url
//1 = Return url as string
if ($format == 0)
{
if ($this->settings['use_javascript_navigation'] == true)
{
echo 'javascript: phppi.go_next_image();';
} else {
if (isset($this->vars['file_list'][$this->vars['next_image_id']]['full_path']))
{
echo '?view=' . $this->vars['file_list'][$this->vars['next_image_id']]['full_path'];
} else {
echo '';
}
}
} else if ($format == 1) {
if ($this->settings['use_javascript_navigation'] == true)
{
return 'javascript: phppi.go_next_image();';
} else {
if (isset($this->vars['file_list'][$this->vars['next_image_id']]['full_path']))
{
return '?view=' . $this->vars['file_list'][$this->vars['next_image_id']]['full_path'];
} else {
return '';
}
}
}
}
function showUpFolderURL($format = 0)
{
//0 = Output url
//1 = Return url as string
if ($format == 0)
{
echo '?' . $this->pathInfo($_GET['view'], 'dir_path');
} else if ($format == 1) {
return '?' . $this->pathInfo($_GET['view'], 'dir_path');
}
}
function showThemeURL($format = 0)
{
//0 = Output url
//1 = Return url as string
if ($format == 0)
{
echo 'phppi/themes/gallery/' . $this->settings['theme'] . '/' . $this->vars['theme_mode'] . '/';
} else if ($format == 1) {
return 'phppi/themes/gallery/' . $this->settings['theme'] . '/' . $this->vars['theme_mode'] . '/';
}
}
function showTitle($format = 0)
{
//0 = Output url
//1 = Return url as string
if ($format == 0)
{
echo $this->vars['page_title'];
} else if ($format == 1) {
return $this->vars['page_title'];
}
}
function showSiteName($format = 0)
{
//0 = Output name
//1 = Return name as string
if ($format == 0)
{
echo $this->settings['site_name'];
} else if ($format == 1) {
return $this->settings['site_name'];
}
}
function showLogo($format = 0)
{
//0 = Output img tag
//1 = Return img tag as string
if ($format == 0)
{
echo "<img id=\"page-logo\" src=\"" . $this->settings['page_title_logo'] . "\" alt=\"" . $this->settings['site_name'] . "\">";
} else if ($format == 1) {
return "<img id=\"page-logo\" src=\"" . $this->settings['page_title_logo'] . "\" alt=\"" . $this->settings['site_name'] . "\">";
}
}
function showNav($format = 0, $home = "", $prev = "", $sep = "", $mode = "")
{
//Mode:
//classic = Only show title and previous button
//new = Breadcrumb style, may take up most of the page if using a large folder tree
//auto = Depending on theme it may switch between the two depending on the screen size
//left empty = Set based on user settings
//$home = HTML to insert for home button
//$prev = HTML to insert for prev button
//$sep = HTML to insert for seperator
$output = "";
if ($mode == "") {
$mode = $this->settings['nav_menu_style'];
}
if ($mode == "auto" || $mode == "new") {
$new_output = "<ul><li class=\"nav-home\">" . $home . "</li>";
$url = "?";
if ($this->vars['dir']['req']['full'] !== "") {
$new_output .= "<li class=\"nav-sep\">" . $sep . "</li>";
$i = 1;
foreach ($this->vars['dir']['req']['split'] as $value) {
if ($i < (count($this->vars['dir']['req']['split']))) {
$url .= $value . "/";
$new_output .= "<li>" . $value . "</li>";
$new_output .= "<li class=\"nav-sep\">" . $sep . "</li>";
} else {
$new_output .= "<li class=\"nav-curr\"><div class=\"title\">" . $value . "</div></li>";
}
$i++;
}
}
$new_output .= "</ul>";
}
if ($mode == "auto" || $mode == "classic")
{
$url = "?";
if ($this->vars['dir']['req']['parent'] !== "") {
$i = 1;
foreach ($this->vars['dir']['req']['split'] as $value) {
if ($i < (count($this->vars['dir']['req']['split']))) {
$url .= $value . "/";
}
$i++;
}
$url = substr($url, 0, -1);
}
$classic_output = "<ul><li class=\"nav-prev\">" . $prev . "</li>";
if ($this->vars['dir']['req']['curr'] !== "") {
$classic_output .= "<li class=\"nav-sep\">" . $sep . "</li>";
$classic_output .= "<li class=\"nav-curr\"><div class=\"title\">" . $this->vars['dir']['req']['curr'] . "</div></li>";
}
$classic_output .= "</ul>";
}
if ($mode == "auto") {
$output .= "<div class=\"nav-menu-new\">" . $new_output . "</div>";
$output .= "<div class=\"nav-menu-classic\">" . $classic_output . "</div>";
} else if ($mode == "new") {
$output = $new_output;
} else if ($mode == "classic") {
$output = $classic_output;
}
//0 = Output nav
//1 = Return nav as string
if ($format == 0)
{
echo $output;
} else if ($format == 1) {
return $output;
}
}
function showPage()
{
require($this->showThemeURL(1) . 'pages/' . $this->vars['page_requested'] . '.php');
}
function resizedSize($width, $height, $return = 2)
{
//Returns width, height or an array of width and height for the thumbnail size of a full sized image
if ($width > $height)
{
$new_height = $this->settings['thumb_size_' . $this->vars['thumb_size']];
$new_width = $width * ($this->settings['thumb_size_' . $this->vars['thumb_size']] / $height);
} else if ($width < $height) {
$new_height = $height * ($this->settings['thumb_size_' . $this->vars['thumb_size']] / $width);
$new_width = $this->settings['thumb_size_' . $this->vars['thumb_size']];
} else if ($width == $height) {
$new_width = $this->settings['thumb_size_' . $this->vars['thumb_size']];
$new_height = $this->settings['thumb_size_' . $this->vars['thumb_size']];
}
if ($return == 0)
{
//Return width
return floor($new_width);
} else if ($return == 1) {
//Return height
return floor($new_height);
} else if ($return == 2) {
//Return array with width and height
return array(floor($new_width), floor($new_height));
}
}
function insertHeadInfo()
{
echo "
<!--
PHP Picture Index " . $this->vars['version'] . "
Created by: Brendan Ryan (http://www.pixelizm.com/)
Site: http://phppi.pixelizm.com/
Licence: GNU General Public License v3
http://www.gnu.org/licenses/
-->\n\n";
echo "<meta name=\"viewport\" content=\"width=device-width; initial-scale=1.0; user-scalable = no; maximum-scale=1.0;\">\n";
if (isset($_GET['view']) && !isset($this->vars['error'])) {
echo "<script type=\"text/javascript\" src=\"phppi/scripts/jquery/jquery.js\"></script>";
} elseif ($this->settings['use_popup_image_viewer'] == true) {
echo "<script type=\"text/javascript\" src=\"phppi/scripts/jquery/jquery.js\"></script>\n";
}
if (isset($_GET['view']) && !isset($this->vars['error']))
{
if ($this->settings['page_title_show_full_path'] == true) { $temp_title_full_path = '1'; } else { $temp_title_full_path = '0'; }
if ($this->settings['enable_hotkeys']) { $enable_hotkeys = 1; } else { $enable_hotkeys = 0; }
if ($this->settings['enable_up_hotkey']) { $enable_up_hotkey = 1; } else { $enable_up_hotkey = 0; }
echo "
<script type=\"text/javascript\" src=\"phppi/scripts/phppi_js.js\"></script>
<script type=\"text/javascript\">
$(document).ready(function() { phppi.initialize(); });
phppi.image_width = " . $this->vars['file_list'][$this->vars['current_image_id']]['data'][0] . ";
phppi.image_height = " . $this->vars['file_list'][$this->vars['current_image_id']]['data'][1] . ";
phppi.up_folder = '" . $this->escapeString($this->showUpFolderURL(1)) . "';
phppi.prev_image = '" . $this->escapeString($this->showPrevImageURL(1)) . "';
phppi.next_image = '" . $this->escapeString($this->showNextImageURL(1)) . "';
phppi.title_full_path = " . $temp_title_full_path . ";
phppi.enable_hotkeys = " . $enable_hotkeys . ";
phppi.enable_up_hotkey = " . $enable_up_hotkey . ";";
if ($this->settings['use_javascript_navigation'] == true)
{
$file_list = "";
$x = 0;
$dir = $this->pathInfo($_GET['view'], 'dir_path');
foreach($this->vars['file_list'] as $file) {
$file_list .= "['" . $this->escapeString($dir) . "/" . $this->escapeString($file['file']) . "', '" . $this->escapeString($file['file']) . "', " . $file['data'][0] . ", " . $file['data'][1] . "]";
if ($x < (count($this->vars['file_list']) - 1)) { $file_list .= ","; }
$x++;
}
echo "
phppi.site_name = '" . $this->settings['site_name'] . "';
phppi.page_title = '" . $this->vars['page_title'] . "';
phppi.current_file = " . $this->vars['current_image_id'] . ";
phppi.files = [" . $file_list . "];";
}
echo "</script>\n";
}
if ($this->settings['use_popup_image_viewer'] == true)
{
echo "<script type=\"text/javascript\" src=\"phppi/scripts/fancybox/jquery.fancybox.js\"></script>\n";
if ($this->settings['show_thumbs_under_viewer'] == true) { echo "<script type=\"text/javascript\" src=\"phppi/scripts/fancybox/jquery.fancybox-thumbs.js\"></script>\n"; }
if ($this->settings['enable_mousewheel'] == true) { echo "<script type=\"text/javascript\" src=\"phppi/scripts/fancybox/jquery.mousewheel-3.0.6.pack.js\"></script>\n"; }
if ($this->settings['show_thumbs_under_viewer'] == true) {
//Thumb Helper Version
echo "<script type=\"text/javascript\">
$(document).ready(function() {
$('.fancybox-thumbs').fancybox({
openEffect: '" . $this->settings['open_image_animation'] . "',
closeEffect: '" . $this->settings['close_image_animation'] . "',
prevEffect: '" . $this->settings['nextprev_image_animation'] . "',
nextEffect: '" . $this->settings['nextprev_image_animation'] . "',
closeBtn: false,
arrows: false,
nextClick: true,
helpers: {
thumbs: {
width: " . $this->settings['popup_thumb_size'] . ",
height: " . $this->settings['popup_thumb_size'] . "
}
}
});
});
</script>\n";
} else {
//Normal Version
echo "<script type=\"text/javascript\">
$(document).ready(function() {
$('.fancybox').fancybox({
openEffect: '" . $this->settings['open_image_animation'] . "',
closeEffect: '" . $this->settings['close_image_animation'] . "',
prevEffect: '" . $this->settings['nextprev_image_animation'] . "',
nextEffect: '" . $this->settings['nextprev_image_animation'] . "'
});
});
</script>\n";
}
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"phppi/scripts/fancybox/jquery.fancybox.css\">\n";
if ($this->settings['show_thumbs_under_viewer'] == true) { echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"phppi/scripts/fancybox/jquery.fancybox-thumbs.css\">\n"; }
}
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"phppi/css/global.css\">\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"phppi/themes/thumbnail/" . $this->settings['thumbnail_theme'] . "/style.css\">\n";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . $this->showThemeURL(1) . "style.css\">\n";
}
function initialize()
{
//Debug Mode
if ($this->settings['debug_mode'] == true)
{
error_reporting(E_ALL);
ini_set('display_errors', '1');
}
ini_set('memory_limit', $this->settings['php_memory'] . 'M');
//Set Thumb Size if changed
if (isset($_POST['thumb_size'])) {
if ($_POST['thumb_size'] == 0) {
$this->setThumbSize('small');
} else if ($_POST['thumb_size'] == 1) {
$this->setThumbSize('medium');
} else if ($_POST['thumb_size'] == 2) {
$this->setThumbSize('large');
}
} else {
$this->setThumbSize(NULL);
}
//GZIP Compression
ini_set('zlib.output_compression', $this->settings['use_gzip_compression']);
ini_set('zlib.output_compression_level', $this->settings['gzip_compression_level']);
//Theme Mode
$this->setThemeMode();
if ($this->settings['allow_mobile_theme'] == true)
{
if (!is_file('phppi/themes/gallery/' . $this->settings['theme'] . '/' . $this->vars['theme_mode'] . '/template.php'))
{
$this->vars['theme_mode'] = 'standard';
}
} else {
$this->vars['theme_mode'] = 'standard';
}
//Load Variables
$this->loadVars();
//Load Blacklists/Whitelists
$this->loadLists();
//Display Content
if (isset($_GET['thumb']))
{
//Show thumbnail only
$this->genThumbnail($_GET['thumb']);
exit;
} else if (isset($_GET['image'])) {
//Show image
if ($this->checkExploit('/' . $_GET['image']) == true) {
$file_ext = strtolower($this->pathInfo($_GET['image'], 'file_ext'));
if ($file_ext == 'jpg' or $file_ext == 'jpeg')
{
$format = 'jpeg';
} else if ($file_ext == 'png') {
$format = 'png';
} else if ($file_ext == 'gif') {
$format = 'gif';
}
header("Content-length: " . filesize($this->vars['dir']['gallery'] . '/' . $_GET['image']));
header("Content-type: image/" . $format);
readfile($this->vars['dir']['gallery'] . '/' . $_GET['image']);
} else {
echo "File doesn't exist.";
}
exit;
} else if (isset($_GET['view'])) {
//Show full image view
$req_path = $this->pathInfo($_GET['view'], 'dir_path');
if ($req_path !== "") { $req_path = "/" . $req_path; }
if ($this->checkExploit($req_path) == true) {
if (!$this->getDir($req_path . '/'))
{
$this->vars['error'] = 'Folder doesn\'t exist';
$this->vars['page_title'] = 'Error';
$this->vars['page_requested'] = 'error';
$this->logs("access", "add", "Folder not found (/" . $_GET['view'] . ")");
} else if (!is_file($this->vars['dir']['gallery'] . '/' . $_GET['view'])) {
$this->vars['error'] = 'File doesn\'t exist';
$this->vars['page_title'] = 'Error';
$this->vars['page_requested'] = 'error';
$this->logs("access", "add", "File not found (/" . $_GET['view'] . ")");
} else {
for($i = 0; $i < count($this->vars['file_list']); $i++)
{
if ($this->vars['file_list'][$i]['file'] == $this->pathInfo($_GET['view'], 'full_file_name'))
{
$this->vars['current_image_id'] = $i;
$this->vars['previous_image_id'] = NULL;
$this->vars['next_image_id'] = NULL;
if ($i > 0)
{
$this->vars['previous_image_id'] = $i - 1;
}
if ($i < (count($this->vars['file_list']) - 1))
{
$this->vars['next_image_id'] = $i + 1;
}
break;
}
}
if ($this->settings['page_title_show_full_path'] == true) {
$this->vars['page_title'] = $this->settings['site_name'] . " - " . str_replace("/", " \ ", $_GET['view']);
} else {
$this->vars['page_title'] = $this->settings['site_name'] . " - " . $this->pathInfo($_GET['view'], 'full_file_name');
}
$this->vars['page_requested'] = 'image';
$this->logs("access", "add", "Viewed image (/" . $_GET['view'] . ")");
}
} else {
$this->vars['error'] = 'File doesn\'t exist';
$this->vars['page_title'] = 'Error';
$this->vars['page_requested'] = 'error';
$this->logs("access", "add", "Possible exploit attempt, blocked access (/" . $_GET['view'] . ")");
}
require('phppi/themes/gallery/' . $this->settings['theme'] . '/' . $this->vars['theme_mode'] . '/template.php');
if ($this->settings['debug_show_vars'] == true) { $this->outputVarsArray(); }
if ($this->settings['debug_show_settings'] == true) { $this->outputSettingsArray(); }
} else {
//Show folder view
if ($this->vars['dir']['req']['full'] == '')
{
$dir_req = "";
} else {
$dir_req = $this->vars['dir']['req']['full'] . '/';
}
if ($this->vars['dir']['req']['full'] == '' || $this->checkExploit('/' . $this->vars['dir']['req']['full']) == true) {
if (!$this->getDir($dir_req))
{
$this->vars['error'] = 'Folder doesn\'t exist';
$this->vars['page_title'] = 'Error';
$this->vars['page_requested'] = 'error';
$this->logs("access", "add", "Folder not found (/" . $dir_req . ")");
} else {
if ($this->settings['page_title_show_full_path'] == true) {
if ($this->vars['dir']['req']['full'] == "") { $sep = ""; } else { $sep = " - "; }
$this->vars['page_title'] = $this->settings['site_name'] . $sep . str_replace("/", " \ ", $this->vars['dir']['req']['full']);
} else {
if ($this->vars['dir']['req']['full'] == "") { $sep = ""; } else { $sep = " - "; }
$this->vars['page_title'] = $this->settings['site_name'] . $sep . $this->vars['dir']['req']['curr'];
}
$this->vars['page_requested'] = 'folder';
$this->logs("access", "add", "Viewed folder (/" . $dir_req . ")");
}
} else {
$this->vars['error'] = 'Folder doesn\'t exist';
$this->vars['page_title'] = 'Error';
$this->vars['page_requested'] = 'error';
$this->logs("access", "add", "Folder not found or exploit attempt, blocked access (/" . $dir_req . ")");
}
require('phppi/themes/gallery/' . $this->settings['theme'] . '/' . $this->vars['theme_mode'] . '/template.php');
if ($this->settings['debug_show_vars'] == true) { $this->outputVarsArray(); }
if ($this->settings['debug_show_settings'] == true) { $this->outputSettingsArray(); }
}
}
}
?>
How to add or turn this jQuery or Javascript code into php to modify this fancybox to open images outside of the iframe?
<script>
/* <![CDATA[ */
$(document).ready(function() {
$('.imagen').click(function(e){
e.preventDefault();
parent.$.fancybox([
{href:'img/sample-9.jpg', title: '01'},
{href:'img/sample-9.jpg', title: '02'},
{href:'img/sample-9.jpg', title: '03'}
],{
// href: this.href,
helpers: {
overlay: {
opacity: 0.3
} // overlay
//, buttons: {}
} // helpers
}); // fancybox
}); // click
//or in this way using another way or option
$('.image').click(function(e){
e.preventDefault();
parent.$.fancybox({
href: this.href,
width: 560,
height: 315,
type: 'iframe',
helpers: {
overlay: {
opacity: 0.3
} // overlay
} // helpers
}); // fancybox
}); // click
beforeClose: function() {
$(".fancybox-inner").unwrap();
},
helpers: {
overlay: {
opacity: 0.3
} // overlay
}
}); //fancybox
return false;
}); //click
}); // ready
/* ]]> */
</script>
This problem is similar to this example:Example Demo
I am in the iframed page 01 situation and I want to do something similar to
iframed page 02.
Your page inside <iframe> is limited to the shape of iframe. Period.
First what comes to my mind is this. In order to display something bigger than iframe you would have to have some script outside your iframe, and then have some communication between iframe contents and page with iframe (most likely with postMessage).
Other idea would be going with your gallery full screen with FullscreenAPI, and then you would have all screen to yourself. In case of gallery that could lead to some nice effect. Just remember, to be able to do that, <iframe> that displays your gallery has to has attribute allowfullscreen (no value needed).
In both cases you will need to be able to either add additional JavaScript outside iframe, or control how iframe is added to page. This is security measure so the contents of iframe will not abduct the parent page.
I have a problem. I wrote some PHP code that echoes "var pixelArray = [];". after that it echoes a few variables like this: "var canvas$id = 'can' + $id;". and also echoes "pixelArray.push(canvas$id);" for each variable.
Now for some reason when i run the script, the array doesn't contain anything.
Can anyone explain to me why?
If you need more information, please tell me.
EDIT:
Here's my full (but still simplyfied) code:
<?php
$blockCounter = 1;
$scriptCounter = 1;
$arrayCounter = 1;
$size = 32 * 32;
$yLine = 1;
while ($blockCounter <= $size)
{
if ($blockCounter == 32 * $yLine){
echo "<canvas id=\"can$blockCounter\" width=\"17\" height=\"17\" style='border:1px solid #777777;'>GET A NEW BROWSER</canvas>";
echo "<br>";
$blockCounter = $blockCounter + 1;
$yLine = $yLine + 1;
}
else{
echo "<canvas id=\"can$blockCounter\" width=\"17\" height=\"17\" style='border:1px solid #777777;'>GET A NEW BROWSER</canvas>";
$blockCounter = $blockCounter + 1;
}
}
echo "<script>";
echo "var pixelArray = [];";
while ($arrayCounter <= $size)
{
echo "var name$arrayCounter = 'can' + $arrayCounter;";
echo "pixelArray.push(name$arrayCounter);";
$arrayCounter = $arrayCounter + 1;
}
while ($scriptCounter <= $size)
{
echo "var c = document.getElementById(\"can$scriptCounter\");";
echo "picoco$scriptCounter = c.style.backgroundColor = \"#000000\";";
$scriptCounter = $scriptCounter + 1;
}
echo "document.getElementById(\"arrayLoc\").innerHTML = pixelArray[0];";
echo "</script>";
?>
<p id="arrayLoc"></p>
document.getElementById("arrayLoc") is returning null, not the pixelArray[0]. The problem is that the paragraph tag has not been loaded into the DOM at the time of the javascript load. You can put it above the script shown below.
echo '<p id="arrayLoc"></p>';
echo "<script>"
echo "var pixelArray = [];";
while ($arrayCounter <= $size)
{
echo "var name$arrayCounter = 'can' + $arrayCounter;";
echo "pixelArray.push(name$arrayCounter);";
$arrayCounter = $arrayCounter + 1;
}
while ($scriptCounter <= $size)
{
echo "var c = document.getElementById(\"can$scriptCounter\");";
echo "picoco$scriptCounter = c.style.backgroundColor = \"#000000\";";
$scriptCounter = $scriptCounter + 1;
}
echo "document.getElementById(\"arrayLoc\").innerHTML = pixelArray[0];";
echo "</script>";
?>
Or run the javascript after the DOM has loaded.
echo "<script>";
echo "window.onload = function () {";
echo "var pixelArray = [];";
while ($arrayCounter <= $size)
{
echo "var name$arrayCounter = 'can' + $arrayCounter;";
echo "pixelArray.push(name$arrayCounter);";
$arrayCounter = $arrayCounter + 1;
}
while ($scriptCounter <= $size)
{
echo "var c = document.getElementById(\"can$scriptCounter\");";
echo "picoco$scriptCounter = c.style.backgroundColor = \"#000000\";";
$scriptCounter = $scriptCounter + 1;
}
echo "document.getElementById(\"arrayLoc\").innerHTML = pixelArray[0];";
echo "}";
echo "</script>";
?>
<p id="arrayLoc"></p>
I have an input[type="file"] had multiple option. I made it preview function so that user can delete the image by clicking the button before submit. The images are deleted well on browser by remove() function however the problem is the values of input including the deleted images are posted when i submit. I don't know how to delete real value of input.
I've tried to figure it out to delete in the server side.
This is the part of html code.
<div class="col-xs-4 vcenter from-group">
<span class="glyphicon glyphicon-asterisk" style="color:red;"></span><label for="inputScreenshots">스크린샷</label>
<p style="display:inline; padding-left:270px; color:red; font-size: 12px">* 이미지 사이즈 : 800 X 450</p>
<input type="file" id="inputScreenshots" name="inputScreenshots[]" class="form-control" accept="image/*" multiple>
<div id="filenameList" style="width : 400px">
<div id="insertScreenshots" style="margin : 30px; position :relative;">
<input type="hidden" name="screenshots_filename[]" value="<?=$screenshot_urls?>">
</div>
</div>
This is the php code where im trying to defend uploading images.
$ss_upload="false";
if (isset($_POST["del_screenshots"])){
// del_screenshots are images that deleted from client.
$ds_count = $_POST["del_screenshots"];
foreach($ds_count as $del) {
echo "<br/> del_screenshots : ".$del;
}
}
$ss_count = sizeof($_FILES['inputScreenshots']['tmp_name']);
// ss_count is the size of all images including deleted images from input field.
echo "<br/>ss_cout : ". $ss_count;
for ($i = 0; $i < $ss_count; $i++) {
$tmpFilePath = $_FILES['inputScreenshots']['tmp_name'][$i];
$tmp_filename = $_FILES['inputScreenshots']['name'][$i];
// tmp_filename is the posted real file name.
echo "<br/> tmp_filename".$i. " : " .$tmp_filename;
//=========================================================================
for ($j = 0; $j < sizeof($ds_count); $j++) {
// Compare all images name and deleted images name
if (strcmp($ds_count[$j] , $tmp_filename) == 0) {
echo "<br/>".$ds_count[$j] . " == " . $tmp_filename . "==> " ."true";
// The $tmp_filename has to be deleted. not to be uploaded to server.
// $tmp_filename = null;
}else {
echo "<br/>".$ds_count[$j] . " == " . $tmp_filename . "==> " ."false";
// This files are okay to be uploaded to server.
}
}
//=========================================================================
$ext = pathinfo($tmp_filename, PATHINFO_EXTENSION);
// $ext = pathinfo($_FILES['inputScreenshots']['name'][$i], PATHINFO_EXTENSION);
echo "<br/>". $i . " ext (pathinfo) : ". $ext;
if ($ext == "") {
continue;
$ss_upload="false";
}
$newFilePath = uniqid().".".$ext;
if ($screenshots != "") {
$screenshots .= "+";
}
$screenshots .= $newFilePath;
// $screenshots has be uploaded to DB except the deleted images. (ex : uniqFileName.png + uniqFileName.png + .. )
echo "<br/> 1) screenshots : ". $screenshots;
move_uploaded_file($tmpFilePath, $SS_PATH."/".$newFilePath);
$ss_upload="true";
}
I want to defend uploading the deleted images but it is no matter to use unlink() in somewhere. The point is how cant i make the string except the deleted images.
=========================================================================
I suppose there is another way to do in jQuery but i have no idea.
I'll put the code below.
$("#inputScreenshots").change(function(){
$("#filenameList div.notyet").remove();
for(var i = 0, len = this.files.length; i < len; i++){
var file = this.files[i];
var fr = new FileReader();
fr.onload = screenshots_processFile(file);
fr.readAsDataURL(file);
}
});
var screenshots_processFile = function screenshots_processFile(file) {
return (function(file) {
return function(e) {
var div = document.createElement("div");
$(div).addClass("notyet").css({
margin: "30px",
position: "relative"
});
var html = [,'<img src="" width="100%" id="tmp_screenshots">'
,'<button type="button" class="close img-close" aria-label="Close"><span aria-hidden="true">×</span></button>'
].join("");
$(div).append(html);
$(div).find("button").click(function() {
alert("remove");
//=========================================================== * TODO : remove the files in server!
var targetDom = document.getElementById( "filenameList" );
var targetInput = document.createElement("input");
targetInput.setAttribute("name", "del_screenshots[]" );
targetInput.setAttribute("type","hidden");
targetDom.appendChild(targetInput);
alert(file.name);
targetInput.setAttribute("value", file.name);
//===========================================================
$(this).parent().remove();
});
$(div).find("img").attr("src", e.target.result);
$("#filenameList").append(div);
}
})(file)
};
How can i do this? Does anyone have an idea?
-----------------------------------------------------------------------------------------------------------
I solved it like this. I know my code is so dirty :-/
$ss_upload="false";
if (isset($_POST["del_screenshots"])){
$ds_count = $_POST["del_screenshots"];
foreach($ds_count as $del) {
echo "<br/> del_screenshots : ".$del;
}
//echo "<br/> << TEST >>"."<br/>ds_count[0] : " . $ds_count[0] . "<br/>ds_count[1] : " . $ds_count[1] ;
}
$ss_count = sizeof($_FILES['inputScreenshots']['tmp_name']);
echo "<br/>ss_cout : ". $ss_count;
for ($i = 0; $i < $ss_count; $i++) {
$tmpFilePath = $_FILES['inputScreenshots']['tmp_name'][$i];
$tmp_filename = $_FILES['inputScreenshots']['name'][$i];
echo "<br/> tmp_filename".$i. " : " .$tmp_filename;
$ss_del_mode="false";
//=========================================================================
if (isset($_POST["del_screenshots"])) {
for ($j = 0; $j < sizeof($ds_count); $j++) {
if (strcmp($ds_count[$j] , $tmp_filename) == 0) {
echo "<br/>".$ds_count[$j] . " == " . $tmp_filename . "==> " ."true";
$ss_del_mode = "true";
}
}
}
//=========================================================================
$ext = pathinfo($tmp_filename, PATHINFO_EXTENSION);
// $ext = pathinfo($_FILES['inputScreenshots']['name'][$i], PATHINFO_EXTENSION);
echo "<br/>". $i . " ext (pathinfo) : ". $ext;
if ($ext == "") {
continue;
$ss_upload="false";
}
if ($ss_del_mode == "true") {
echo "<br/> ss_del_mode [[[[ " . $ss_del_mode. " ]]]]";
$newFilePath = "";
} else {
$newFilePath = uniqid().".".$ext;
echo "<br/> ss_del_mode [[[[ " . $ss_del_mode. " ]]]]";
}
if ($screenshots != "") {
if ($ss_del_mode != "true"){
echo "<br/> ss_del_mode [[[[ " . $ss_del_mode. " ]]]]". " --> screenshots";
$screenshots .= "+";
}
}
$screenshots .= $newFilePath;
echo "<br/> 1) screenshots (newFilePath) : ". $screenshots;
if ($newFilePath != "") {
move_uploaded_file($tmpFilePath, $SS_PATH."/".$newFilePath);
}
$ss_upload="true";
}
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I am using the free code of tablefilter.free.fr and have adding this to my code but it does not get executed.
I have added the html and javascript into https://jsfiddle.net/koalyptus/eCqG3/ and it works fine but when i use my page -> http://mr-tipster.com/pages/newcard.php?venue=Southwell it does not render for some reason although the same html is output.
below is the full code i use on the page to create the tables and add the javascript.
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="../table/tablefilter.js"></script>
<?php
//show today's meeting name
if ($numrows > 0) {
echo '' . $entry . '';
} else {
echo '' . $entry . '';
}
$met1 = array_values($meeting);
if (array_shift($met1) == $entry && $venue =="" || $venue == $entry)
{
echo ''.$entry.'';
if ($venue =="")
{
$venue = array_shift($met1);
}
}
else
{
}
// pull the times for that meeting
$grabtracktimes = mysqli_query($db, 'SELECT Racetime,Going,distance, COUNT(*) c FROM tom_cards Where Track = "' . $venue . '" GROUP BY Racetime HAVING c > 1;');
$meetingtime = array();
echo "<br />";
while ($grabtodaystracktimes = mysqli_fetch_array($grabtracktimes)) {
$meetingtime[] = $grabtodaystracktimes['Racetime'];
}
$meetingtime1 = array_unique($meetingtime);
foreach ($meetingtime1 as $entrytime) {
if ($time == "") {
$time = array_shift(array_values($meetingtime1));
}
if (array_shift($meetingtime1) == $entrytime and $time == "" or $time == $entrytime) {
echo '' . $entrytime . '';
if ($time == "") {
$time = array_shift($meetingtime1);
}
} else {
echo '' . $entrytime . '';
}
}
echo "<br /><b>" . $venue . "(" . $time . ")</b>";
$sqltodaystrack = "";
$sqltodaystrack2 = mysqli_query($db, $sqltodaystrack );
$todaystrackleftorright = "";
$todaystrackspeed = "";
$todaystracksurface = "";
while ( $sqltodaystrack3 = mysqli_fetch_array($sqltodaystrack2)) {
$todaystrackleftorright = $sqltodaystrack3['Left_or_Right'];
$todaystrackspeed = $sqltodaystrack3['speed'];
$todaystracksurface = $sqltodaystrack3['surface'];
}
$sql = 'SELECT Race_Name,distance,going,surface FROM tom_cards Where Track ="' . $venue . '" and Racetime = "' . $time . '" group by Racetime ';
$horses2 = mysqli_query($db, $sql);
$first = true;
while ($todayhorse = mysqli_fetch_array($horses2)) {
if ($first == true) {
// do something
$first = false;
$todaysgoing = $todayhorse['going'];
$todaysdistance = miletofurlong($todayhorse['distance']);
echo "<br /><br /><b>" . $todayhorse['Race_Name'] . "</b>";
//add notes about the race course here
$sqlfortrack = 'SELECT notes,Handicaps, Non_Handicaps FROM RaceCourse Where Course ="' . $venue . '"';
$fortrack = mysqli_query($db, $sqlfortrack );
while ($fortrack2 = mysqli_fetch_array($fortrack)) {
echo "<br /><span style='font-size:11px'><b>Course Notes:</b> ".$fortrack2['notes']."</span><BR />";
//check if handicap or not and check for any course details
if (strpos($todayhorse['Race_Name'], 'Handicap') !== FALSE)
{
echo "<span style='font-size:11px'>".$fortrack2['Handicaps']."<span/>";
}
else
{
echo "<span style='font-size:11px'>".$fortrack2['Non_Handicaps']."</span>";
}
}
echo " <br /><br />Distance: <b>" . miletofurlong($todayhorse['distance']) . "f </b>(" . $todayhorse['distance'] . ") Going: <b>" . $todayhorse['going'] . "</b>";
$surface = trim($db->real_escape_string($todayhorse['surface']));
}
}
echo "</div>";
echo "<table id='table1' style='border:0px;margin-top:50px;text-align: center ;'>";
echo "<tr style='font-weight: bold;'><td>Horse</td><td>Form</td><td>History</td><td>OR/Class</td><td>MT Rating</td><td>Naps</td></tr>";
$sql = 'SELECT horse,rp,ts,Naps,`OR`,Class,Jockeys_Claim,Trainer,Track FROM tom_cards Where Track ="' . $venue . '" and Racetime = "' . $time . '"';
$horses2 = mysqli_query($db, $sql);
$loop = 0;
while ($todayhorse = mysqli_fetch_array($horses2)) {
$placed = "";
$data = "";
$horse = trim($todayhorse['horse']);
$jockeys = $todayhorse['Jockeys_Claim'];
$trainer = $todayhorse['Trainer'];
$class = $todayhorse['Class'];
$or = $todayhorse['OR'];
$rp = $todayhorse['rp'];
$ts = $todayhorse['ts'];
$naps = $todayhorse['Naps'];
if ($surface == "Turf") {
$win = 0;
$runs = 0;
$place = 0;
$horsesplaced = ;
$check = "no";
while ($pasthorse = mysqli_fetch_array($horsesplaced)) {
$dbDate = $pasthorse['Date'];
$placeddata = intval($pasthorse['Place']);
//add 1 to runs everyloop to show how many runs they have had
$runs = $runs + 1;
//if the horse has won a race then mark it red and add 1 point to the win tally
if ($placeddata == 1) {
$placed .= "<b><span style='color:#8DB600'>" . $pasthorse['Place'] . "</span></b>";
$win = $win + 1;
} else {
//if the horse was placed higher then 9th just add 0
if (intval($pasthorse['Place']) > 9) {
$pasthorse['Place'] = 0;
}
//echo all the places
if ($pasthorse['Place'] == "PU") {
$pasthorse['Place'] = str_replace($pasthorse['Place'], 'PU', '<b>P</b>');
}
if ($pasthorse['Place'] == "F") {
$pasthorse['Place'] = str_replace($pasthorse['Place'], 'F', '<b>F</b>');
}
if ($pasthorse['Place'] == "2" or $pasthorse['Place'] == "3") {
$pasthorse['Place'] = str_replace($pasthorse['Place'], $pasthorse['Place'], "<span style='color:#8DB600'>" . $pasthorse['Place'] . "</span>");
}
$placed .= $pasthorse['Place'];
// if runners are greater then 4 and less the 8 only 2 to place
if ($pasthorse['Runners'] < 4 and $pasthorse['Runners'] > 8) {
if ($pasthorse['Place'] == 2) {
$place = $place + 1;
}
}
if ($pasthorse['Runners'] < 7 and $pasthorse['Runners'] > 16) {
if ($pasthorse['Place'] == 2 or $pasthorse['Place'] == 3) {
$place = $place + 1;
}
}
if ($pasthorse['Runners'] < 15) {
if ($pasthorse['Place'] == 2 or $pasthorse['Place'] == 3 or $pasthorse['Place'] == 4) {
$place = $place + 1;
}
}
}
}
} elseif ($surface == "AW") {
$win = 0;
$runs = 0;
$place = 0;
$horsesplaced = ;
while ($pasthorse = mysqli_fetch_array($horsesplaced)) {
$placeddata = intval($pasthorse['Place']);
//add 1 to runs everyloop to show how many runs they have had
$runs = $runs + 1;
//if the horse has won a race then mark it red and add 1 point to the win tally
if ($placeddata == 1) {
$placed .= "<b><span style='color:red'>" . $pasthorse['Place'] . "</span></b>";
$win = $win + 1;
} else {
//if the horse was placed higher then 9th just add 0
if (intval($pasthorse['Place']) > 9) {
$pasthorse['Place'] = 0;
}
//echo all the places
$placed .= $pasthorse['Place'];
// if runners are greater then 4 and less the 8 only 2 to place
if ($pasthorse['Runners'] < 4 and $pasthorse['Runners'] > 8) {
if ($pasthorse['Place'] == 2) {
$place = $place + 1;
}
}
if ($pasthorse['Runners'] < 7 and $pasthorse['Runners'] > 16) {
if ($pasthorse['Place'] == 2 or $pasthorse['Place'] == 3) {
$place = $place + 1;
}
}
if ($pasthorse['Runners'] < 15) {
if ($pasthorse['Place'] == 2 or $pasthorse['Place'] == 3 or $pasthorse['Place'] == 4) {
$place = $place + 1;
}
}
}
}
}
$winner = "";
$placed1 = "";
if ($runs != 0) {
$winner = "(" . round(($win / $runs) * 100) . "%) ";
$placed1 = "(" . round((($place + $win) / $runs) * 100) . "%) ";
}
$thetrack = horseontrack($horse, $venue, $db);
list($corseruns, $corsewins, $corseplace) = explode("/", $thetrack);
$sqlhorses = "SELECT distance,Place,Runners FROM `horsesrp` WHERE `Horse` = '" . $horse . "' order by distance + 0,
substring_index(distance, 'm', -1) + 0";
$horseplaced = mysqli_query($db, $sqlhorses);
$data = "";
$dataleftorright = "";
$dataspeed = "";
$datasurface = "";
$storage = array();
$storetrackdirection = array();
$storetrackdirectionsurface= array();
$storetrackspeed= array();
while ($pasthorse = mysqli_fetch_array($horseplaced)) {
// check to see if its distance is that of today
$placetotals = 0;
$wintotals = 0;
$test = "";
$placeddata = intval($pasthorse['Place']);
if ($placeddata == 1) {
} else {
if ($pasthorse['Runners'] > 4 and $pasthorse['Runners'] < 8) {
$test = "--between 5 and 7--" . $pasthorse['Place'];
if ($pasthorse['Place'] == 2) {
$placetotals = 1;
}
}
if ($pasthorse['Runners'] > 7 and $pasthorse['Runners'] < 16) {
$test = "--Between 8 and 15--" . $pasthorse['Place'];
if ($pasthorse['Place'] == 2 or $pasthorse['Place'] == 3) {
$placetotals = 1;
}
}
if ($pasthorse['Runners'] > 15) {
$test = "over 15" . $pasthorse['Place'];
if ($pasthorse['Place'] == 2 or $pasthorse['Place'] == 3 or $pasthorse['Place'] == 4) {
$placetotals = 1;
}
}
}
// if the distance is the same
// Take this outside of the if statements
$mtfl = miletofurlong($pasthorse['distance']);
if ($mtfl == $todaysdistance) {
$Horsedist = "<b><span style='color:#ff4500 '>" . $mtfl . "f</span></b>";
} elseif (($mtfl >= $todaysdistance - 1) && ($mtfl <= $todaysdistance + 1)) {
// You don't need to check for equality here - if you get here it is because
// the values are not equal
$Horsedist = "<b><span style='color:#8DB600'>" . $mtfl . "f</span></b>";
} else {
$Horsedist = $mtfl . "f";
}
if (!isset($storage[$Horsedist])) {
$storage[$Horsedist] = array(
"win" => 0,
"placed" => 0,
"raced" => 0
);
}
// Then increment if required
// $data .= "<span style='font-size:10.5px'>".$Horsedist. " -Won:".$wintotals. " Placed:".$placetotals." </span><br />";
}
$sqlhorsesgoing = "SELECT going,Place,Runners FROM `horsesrp` WHERE `Horse` = '" . $horse . "' order by going";
$horseplacedgoing = mysqli_query($db, $sqlhorsesgoing);
$datagoing = "";
$storagegoing = array();
while ($pasthorsegoing = mysqli_fetch_array($horseplacedgoing)) {
// check to see if its going is that of today
$placeddatagoing = intval($pasthorsegoing['Place']);
if ($placeddatagoing == 1) {
} else {
if ($pasthorsegoing['Runners'] > 4 and $pasthorsegoing['Runners'] < 8) {
if ($pasthorsegoing['Place'] == 2) {
$placetotalsgoing = 1;
}
}
if ($pasthorsegoing['Runners'] > 7 and $pasthorsegoing['Runners'] < 16) {
if ($pasthorsegoing['Place'] == 2 or $pasthorsegoing['Place'] == 3) {
$placetotalsgoing = 1;
}
}
if ($pasthorsegoing['Runners'] > 15) {
if ($pasthorsegoing['Place'] == 2 or $pasthorsegoing['Place'] == 3 or $pasthorsegoing['Place'] == 4) {
$placetotalsgoing = 1;
}
}
}
// if the going is the same
// Take this outside of the if statements
$mtfl1 = $pasthorsegoing['going'];
if ($mtfl1 == $todaysgoing) {
$Horsegoing = "<b><span style='color:#ff4500 '>" . $mtfl1 . "</span></b>";
} else {
$Horsegoing = $mtfl1;
}
if (!isset($storagegoing[$Horsegoing])) {
$storagegoing[$Horsegoing] = array(
"win" => 0,
"placed" => 0,
"raced" => 0
);
}
// Then increment if required
}
$data = "<table class='tg' align='center' style='font-size:10.5px;'><tr><th style='padding-right:5px;'></th><th style='padding-right:5px;'> Runs </th><th style='padding-right:5px;'> Wins </th><th style='padding-right:5px;'> Placed </th></tr>";
foreach ($storage as $pony => $tab) {
// $data .= "<span style='font-size:10.5px'>".$Horsedist. " -Won:".$wintotals. " Placed:".$placetotals." </span><br />";
if ($tab["win"] !== 0) {
$distancewinners = "<b><span style='color:#ff4500 '>" . $tab["win"] . "</span></b>";
} else {
$distancewinners = $tab["win"];
}
if ($tab["placed"] !== 0) {
$distanceplace = "<b><span style='color:#ff4500 '>" . $tab["placed"] . "</span></b>";
} else {
$distanceplace = $tab["placed"];
}
}
$data .= "</table>";
foreach ($storagegoing as $ponygoing => $tabgoing) {
if ($tabgoing["win"] !== 0) {
$distancewinners = "<b><span style='color:#ff4500 '>" . $tabgoing["win"] . "</span></b>";
} else {
$distancewinners = $tabgoing["win"];
}
if ($tabgoing["placed"] !== 0) {
$distanceplace = "<b><span style='color:#ff4500 '>" . $tabgoing["placed"] . "</span></b>";
} else {
$distanceplace = $tabgoing["placed"];
}
//work out which courses the horse has ran at
$horseplacedtracks = "SELECT track,Place,Runners FROM `horsesrp` WHERE `Horse` = '" . $horse . "'";
$horseplacedtracks2 = mysqli_query($db, $horseplacedtracks );
$track ="";
$leftorright = "";
$surface = "";
$speed = "";
while ($pasthorsetracks = mysqli_fetch_array($horseplacedtracks2 ))
{
//remove (aw) and get the track name
$track = trim(str_replace("(AW)", "", $pasthorsetracks['track']));
//is the track left or right??
// check to see if its going is that of today
$placetotalstrack = 0;
$wintotalstrack = 0;
$placeddatatrack = intval($pasthorsetracks['Place']);
if ($placeddatatrack == 1) {
$placetotalstrack = 1;
$wintotalstrack = 1;
} else {
if ($pasthorsetracks['Runners'] > 4 and $pasthorsetracks['Runners'] < 8) {
if ($pasthorsetracks['Place'] == 2) {
$placetotalstrack = 1;
}
}
if ($pasthorsetracks['Runners'] > 7 and $pasthorsetracks['Runners'] < 16) {
if ($pasthorsetracks['Place'] == 2 or $pasthorsetracks['Place'] == 3) {
$placetotalstrack = 1;
}
}
if ($pasthorsetracks['Runners'] > 15) {
if ($pasthorsetracks['Place'] == 2 or $pasthorsetracks['Place'] == 3 or $pasthorsetracks['Place'] == 4) {
$placetotalstrack = 1;
}
}
}
// check the track against the database and asign left or right
$grabtrackdetails = "SELECT Left_or_Right FROM `RaceCourse` WHERE `Course` = '" . $track . "'";
$grabtrackdetails2 = mysqli_query($db, $grabtrackdetails );
while ($pastgrabtrackdetails = mysqli_fetch_array($grabtrackdetails2 ))
{
$leftorright = $pastgrabtrackdetails['Left_or_Right'];
/////////////////////////////////////////////////////////////////////////////////////
if (!isset($storetrackdirection[$leftorright])) {
$storetrackdirection[$leftorright] = array(
"win" => 0,
"placed" => 0,
"raced" => 0
);
}
// Then increment if required
$storetrackdirection[$leftorright]["win"] += $wintotalstrack;
$storetrackdirection[$leftorright]["placed"] += $placetotalstrack;
$storetrackdirection[$leftorright]["raced"] += 1;
}
// check the track against the database and asign left or right
$grabtrackdetailssurface = "SELECT surface FROM `RaceCourse` WHERE `Course` = '" . $track . "'";
$grabtrackdetailssurface2 = mysqli_query($db, $grabtrackdetailssurface );
while ($pastgrabtrackdetailssurface = mysqli_fetch_array($grabtrackdetailssurface2 ))
{
$surface = $pastgrabtrackdetailssurface['surface'];
if ($surface == "")
{
$surface = "Mix";
}
/////////////////////////////////////////////////////////////////////////////////////
if (!isset($storetrackdirectionsurface[$surface])) {
$storetrackdirectionsurface[$surface] = array(
"win" => 0,
"placed" => 0,
"raced" => 0
);
}
// Then increment if required
$storetrackdirectionsurface[$surface]["win"] += $wintotalstrack;
$storetrackdirectionsurface[$surface]["placed"] += $placetotalstrack;
$storetrackdirectionsurface[$surface]["raced"] += 1;
}
$horsehistory = "SELECT Date,track,Class,Distance,going,Place,Jockeys_claim,`OR`,Runners FROM `horsesrp` WHERE `Horse` = '" . $horse . "' order by Date DESC";
$horsehistory2 = mysqli_query($db, $horsehistory );
$horseshistoryget = "<br />";
?>
<script type="text/javascript">
var tf<?php echo $loop; ?> = setFilterGrid("loop<?php echo $loop; ?>");
</script>
<?
$horseshistoryget .= "<table id='loop".$loop."' class='mytable' align='center' style='font-size:10.5px;'><tr><th style='padding-right:5px;'></th><th style='padding-right:5px;'> Course </th><th style='padding-right:5px;'> Class</th><th style='padding-right:5px;'> Distance </th><th style='padding-right:5px;'> Going</th><th style='padding-right:5px;'> Outcome </th><th style='padding-right:5px;'> Jockey </th><th style='padding-right:5px;'> OR </th></tr>";
while ($gethorsehistory = mysqli_fetch_array($horsehistory2 ))
{
//$horseshistoryget .= "<tr style='height:18px; border-top:1pt solid black; border-bottom:0pt solid black;'><td style='border-top:1pt solid black; border-bottom:0pt solid black;'>" .$gethorsehistory["Date"] . "</td><td style='border-top:1pt solid black; border-bottom:0pt solid black;'>" . $gethorsehistory["Track"] . "</td><td style='border-top:1pt solid black; border-bottom:0pt solid black;'>" . $gethorsehistory["Class"] . "</td><td style='border-top:1pt solid black; border-bottom:0pt solid black;'>" . $gethorsehistory["Distance"] . "</td><td style='border-top:1pt solid black; border-bottom:0pt solid black;'>" . $gethorsehistory["Place"] . "</td><td style='border-top:1pt solid black; border-bottom:0pt solid black;'>" . $gethorsehistory["Jockeys_claim"] . "</td><td style='border-top:1pt solid black; border-bottom:0pt solid black;'>" . $gethorsehistory["`OR`"] . "</td></tr>";
$timestamp = strtotime($gethorsehistory["Date"]);
$newDate = date('d.m.y', $timestamp);
// check if the value is the same as today and bold it
$horseshistoryget .= "<tr><td>". $newDate. "</td>";
//check what todays course speed and surface is like
$todayscourseprofile = "SELECT speed,surface from RaceCourse where course = '".$venue."' ";
$todayscourseprofile2 = mysqli_query($db, $todayscourseprofile );
$todayscoursespeed = "" ;
$todayscoursesurface = "";
while ($gettodayscourseprofile = mysqli_fetch_array($todayscourseprofile2 ))
{
$todayscoursespeed = $gettodayscourseprofile["speed"] ;
$todayscoursesurface = $gettodayscourseprofile ["surface"];
}
//check if venue has the same profile as this one
$trackprofie = trim(str_replace("(AW)", "", $gethorsehistory["track"]));
$allcourseprofile = "SELECT speed, surface from RaceCourse where course = '".$trackprofie."' ";
$allcourseprofile2 = mysqli_query($db, $allcourseprofile );
while ($getallcourseprofile = mysqli_fetch_array($allcourseprofile2 ))
{
$allcoursespeed = "" ;
$allcoursesurface = "";
$allcoursespeed = $getallcourseprofile["speed"] ;
$allcoursesurface = $getallcourseprofile ["surface"];
}
//if they match colour them
if($todayscoursespeed == $allcoursespeed and $allcoursesurface == $todayscoursesurface )
{
if ($todayscoursespeed <> "" and $todayscoursesurface <> "")
{
$showtrack = "<span style='color:#336600 '>".$gethorsehistory["track"]."</span>";
}
else
{
$showtrack = $gethorsehistory["track"];
}
}
elseif ($todayscoursespeed == $allcoursespeed)
{
if ($todayscoursespeed <> "")
{
$showtrack = "<span style='color:#996600 '>".$gethorsehistory["track"]."</span>";
}
else
{
$showtrack = $gethorsehistory["track"];
}
}
elseif($todayscoursesurface == $allcoursesurface)
{
if ($todayscoursesurface <> "")
{
$showtrack = "<span style='color:#CC3300 '>".$gethorsehistory["track"]."</span>";
}
else
{
$showtrack = $gethorsehistory["track"];
}
}
else
{
$showtrack = $gethorsehistory["track"];
}
if ($gethorsehistory["track"] == $venue)
{
$horseshistoryget .= "<td><b>" . $showtrack. "</b></td>";
}
else{
$horseshistoryget .= "<td>" . $showtrack."</td>";
}
if ($gethorsehistory["Class"] == "Class".$class)
{
$horseshistoryget .= "<td><b>" . $gethorsehistory["Class"] . "</b></td>";
}
else
{
$horseshistoryget .= "<td>" . $gethorsehistory["Class"] . "</td>";
}
if (miletofurlong($gethorsehistory["Distance"]) == $todaysdistance)
{
$horseshistoryget .= "<td><b>" . miletofurlong($gethorsehistory["Distance"]). "f" . "</b></td>";
}
else
{
$horseshistoryget .= "<td>" . miletofurlong($gethorsehistory["Distance"]). "f" . "</td>";
}
if ($gethorsehistory["going"] == $todaysgoing)
{
$horseshistoryget .= "<td><b>" . $gethorsehistory["going"] . "</b></td>";
}
else{
$horseshistoryget .= "<td>" .$gethorsehistory["going"] . "</td>";
}
if ($gethorsehistory["Place"] == 1){
$pastplace = "<b><span style='color:#ff4500 '>".$gethorsehistory["Place"]."</span></b>";
}
else{
$pastplace = $gethorsehistory["Place"];
}
$horseshistoryget .= "<td>" . $pastplace ."/". $gethorsehistory["Runners"]. "</td>";
if ($gethorsehistory["Jockeys_claim"] == $jockeys)
{
$horseshistoryget .= "<td><b>" .$gethorsehistory["Jockeys_claim"]. "</b></td>";
}
else{
$horseshistoryget .= "<td>" . $gethorsehistory["Jockeys_claim"] . "</td>";
}
$horseshistoryget .= "<td>" .$t1. $gethorsehistory["OR"] .$t2. "</td></tr>";
}
$horseshistoryget .= "</table><br />";
//does the jockey only have one ride today???
echo "<tr valign='top'><td >";
echo "<b><span style='font-size:12px'> " . $horse . "</span></b> <sup><span style='font-size:10px;color:gray'><abbr title='Days Since Last Race'>" . horselastrace($horse, $db) . "</abbr> </span><b><span style='font-size:10px;color:red'><abbr title='Beaten Favourite'>" . horsebeatenfav($horse, $db) . "</abbr></span></sup></b>
<br /><span style='font-size:10.5px'><abbr title='Jockey'>J: " . $jockeys . "</abbr><abbr title='Jockey Win rate last 4 months'> (" . round(howhotisjockey($jockeys, $db)) . "%)</abbr> " . " <abbr title='Jockey Win rate on horse'>(" . round(howhotisjockeyonhorse($jockeys, $db, $horse)) . "%)</abbr><abbr title='Jockey rides today'> " . jockeyridestoday($jockeys, $db) . "</abbr>
<br /><abbr title='Trainer'> T: " . $trainer . "</abbr> <abbr title='Trainer Win rate last 4 months'>(" . round(howhotistrainer($trainer, $db)) . "%)</abbr> <abbr title='Trainers horses out today'> " . trainersridestoday($trainer, $db) . "</abbr> </span></td>";
echo "<td ><span style='font-size:11px'><abbr title='P = Pulled Up , F = Fell'> " . $placed . "</abbr></span> <span style='font-size:10.5px'> <abbr title='Win Percent'> " . $winner . "</abbr> <abbr title='Place Percent'>" . $placed1 . "</abbr></span> </td>";
// echo "<td ><span style='font-size:11px'>".$dataleftorright.$dataspeed.$datasurface."</span></td>";
// echo "<td >" . $data . "<br /></td>";
// echo "<td >" . $datagoing . "<br /></td>";
echo "<td >".$horseshistoryget."</td>";
echo "<td ><span style='font-size:11px'><abbr title='class and highest winning OR'> " . classtop2($horse, $db, $or, $class) . "</abbr></span> </td>";
echo "<td ><span style='font-size:11px'><abbr title='Mr-Tipster speed rating'> " . round((($rp + $ts) / 2)) . "</abbr> </span></td>";
echo "<td ><span style='font-size:11px'>" . $naps . "</span></td>";
echo "</tr>";
$loop = $loop + 1;
}
?>
</table>
</div>
</body>
</html>