runnerjp
Members-
Posts
2,214 -
Joined
-
Last visited
Everything posted by runnerjp
-
I have a calander in which when you click on a date which has entry on it it opens up a popup window and shows the data. This works fine untill i include it onto my profiles page via include <?php include "diary/cal_show.php";?> and the box opens but continues to load and never shows the results as shown below the thing is when i open the calander of the url diary/cal_show.php it works. below i have included the relevant php pages. here is the calander itself <script src="http://www.runningprofiles.com/jquery.js" type="text/javascript"></script> <link href="http://www.runningprofiles.com/members/diary/facebox/facebox.css" media="screen" rel="stylesheet" type="text/css"> <script src="http://www.runningprofiles.com/members/diary/facebox/facebox.js" type="text/javascript"></script> <script> jQuery(document).ready(function($) { $('a[rel*=facebox]').facebox() }) </script> <?php // there is NO NEED to edit ANY of this code $ev_dat = array(); for ($i=0;$i<32;$i++) { $ev_dat[$i]=0; } $now = date("Y-m-d", time()); list($ty, $tm, $td) = explode('-',$now); // ty=thisyear, etc. used for highlighting 'today' include("cal_parms.php"); // assorted configuration variables include($dat_names); // retrieved from cal_parms.php as a 'language' file if (!isset($_GET['m'])) { $m = date("m",mktime()); } else { $m = $_GET['m']; } if (!isset($_GET['y'])) { $y = date("Y",mktime()); } else { $y = $_GET['y']; } /*== get what weekday the first is on ==*/ $tmpd = getdate(mktime(0,0,0,$m,1,$y)); $month = $tmpd["month"]; $firstwday= $tmpd["wday"]; if ($firstDayIsMonday == 1) { if ($firstwday == 0) { $firstwday = 6; } else { $firstwday--; } } $lastday = mk_getLastDayofMonth($m,$y); /*== get the last day of the month ==*/ function mk_getLastDayofMonth($mon,$year) { for ($tday=28; $tday <= 31; $tday++) { $tdate = getdate(mktime(0,0,0,$mon,$tday,$year)); if ($tdate["mon"] != $mon) { break; } } $tday--; return $tday; } // compute range of dates for this month to match dates in database in the format yyyy-mm-dd if (strlen($m)<2) { $q="0"; $q.=$m; } else { $q = $m; } $dats_beg = $y. "-". $q. "-01"; $dats_en = $y. "-". $q. "-". $lastday; // open db conn and select all records where date is between $dats_beg and $dats_en include("cal_db_conn.php"); mysql_connect($db_host, $db_login, $db_pass) or die ("Can't connect!"); mysql_select_db($db_name) or die ("Can't open database!"); $query = "SELECT * FROM $db_table WHERE (ev_dat>='$dats_beg') AND (ev_dat<='$dats_en') "; $result = mysql_db_query($db_name, $query); // any matches? if ($result) { // handle the matches and pass relevant info to arrays while ($myrow = mysql_fetch_array($result)) { $found = $myrow['ev_dat']; $pieces = explode("-", $found); $dd = intval($pieces[2]); $ev_dat[$dd] = $myrow['id']; } } ?> <table cellpadding="1" cellspacing="1" border="0" bgcolor="#<? echo $bg_edge; ?>"> <tr><td colspan="7" bgcolor="#<? echo $bg_top; ?>"> <table cellpadding="1" cellspacing="1" border="0" width="100%"> <tr bgcolor="#<? echo $bg_top; ?>"><th width="20" style="<?php echo $hcell; ?>"><a href="<? echo $username; ?>&m=<?=(($m-1)<1) ? 12 : $m-1 ?>&y=<?=(($m-1)<1) ? $y-1 : $y ?>"><img src='http://www.runningprofiles.com/calendar/images/prev.gif' height='18' width='18' alt='' border='0' /></a></th> <th style="<?php echo $hcell; ?>"> <?php echo "<a href='../diary/show-month.php?mon=". $m. "&yr=". $y. "'rel=\"facebox\">"; echo "<span style='text-decoration:none'>". $mo[intval($m)]. " ". $y. "</span></a>"; ?> </th> <th width="20" style="<? echo $hcell; ?>"><a href="<? echo $username; ?>&m=<?=(($m+1)>12) ? 1 : $m+1 ?>&y=<?=(($m+1)>12) ? $y+1 : $y ?>"><img src='http://www.runningprofiles.com/calendar/images/next.gif' height='18' width='18' border='0' alt='' /></a></th> </tr> </table> </td></tr> <tr bgcolor="#<? echo $bg_top; ?>"> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[1]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[2]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[3]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[4]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[5]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[6]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[7]; ?></th> </tr> <? $d = 1; $wday = $firstwday; $firstweek = true; /*== loop through all the days of the month ==*/ while ( $d <= $lastday) { /*== set up blank days for first week ==*/ if ($firstweek) { if ($wday!=0) { echo "<tr bgcolor='#". $bg_tabl. "'>\n"; for ($i=1; $i<=$firstwday; $i++) { echo "<td style='". $tcell. "' bgcolor='#". $bg_fill. "'> </td>\n"; } } /*== Sunday start week with <tr> ==*/ else { echo "<tr bgcolor='#". $bg_tabl. "'>\n"; } $firstweek = false; } /*== check for event ==*/ echo "<td style='". $tcell. "' "; // is this day 'today' AND there's no event today if (($ty==$y) && ($tm==$m) && ($td == $d) && (!$ev_dat[$d])) { echo "bgcolor='#". $bg_now. "'>". $d; } elseif ($ev_dat[$d]) { // get what's happening that day and use as 'mouseOver' for the link $query = "SELECT * FROM $db_table WHERE id=$ev_dat[$d] "; $result = mysql_query($query); $ev = mysql_fetch_array($result); $titl = $ev['ev_title']; echo "bgcolor='#". $bg_act. "'>"; $url = "../diary/show.php?event=". $ev_dat[$d]. "&sho=". $win_sho; echo "<a href=' $url' rel=\"facebox\" title=\"". $titl. "\">". $d. "</a>"; } else { echo "bgcolor='#". $bg_days. "'>". $d; } echo "</td>\n"; /*== Saturday end week with </tr> ==*/ if ($wday==6) { echo "</tr>\n"; } $wday++; $wday = $wday % 7; if (($wday==0) AND ($d!=$lastday)){ echo "<tr bgcolor='#". $bg_tabl. "'>\n"; } $d++; } // and close off the table if (($wday!=7) AND ($wday!=0)) { for ($i=$wday; $i<=6; $i++) { echo "<td style='". $tcell. "' bgcolor='#". $bg_fill. "'> </td>\n"; } echo "</tr>"; } echo "\n</table>"; include("win_open.php"); ?> row 104 = echo "<a href='../diary/show-month.php?mon=". $m. "&yr=". $y. "'rel=\"facebox\">"; is one of the areas im talking about. now like i said this all works fine on its own but as soon as i add it to this page it dosent work profiles.php <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <link rel="stylesheet" type="text/css" href="http://www.runningprofiles.com/css/login.css"> <link rel="stylesheet" type="text/css" href="include/profiletab/ajaxtabs/ajaxtabs.css"> <script type="text/javascript" src="include/profiletab/ajaxtabs/ajaxtabs.js"></script> <script type="text/javascript" src="http://www.runningprofiles.com/popup.js"></script> <script src="http://www.runningprofiles.com/jquery.js" type="text/javascript"></script> <link href="http://www.runningprofiles.com/members/diary/facebox/facebox.css" media="screen" rel="stylesheet" type="text/css"> <script src="http://www.runningprofiles.com/members/diary/facebox/facebox.js" type="text/javascript"></script> <script> jQuery(document).ready(function($) { $('a[rel*=facebox]').facebox() }) </script> <?php require_once '../settings.php'; checkLogin('1 2'); include "../info.php"; // sets username/id ect include "../getuser.php"; // records user view on page ini_set('error_reporting', E_ALL); $getuser = mysql_fetch_assoc(mysql_query("SELECT * from users where Username='$profilename'")); $getuserprofile = mysql_fetch_assoc(mysql_query("SELECT * from profile where ID='".$getuser['ID']."'")); $sql1 = "Select * FROM diary where author = '$profilename' ORDER BY `ev_dat` DESC LIMIT 0, 5"; $postsresult1 = mysql_query($sql1) or die("Could not get diary"); $num1 = mysql_num_rows($postsresult1); $sql = "Select DISTINCT title FROM forumtutorial_posts where author = '$profilename' ORDER BY `showtime` DESC LIMIT 0, 5"; $postsresult = mysql_query($sql) or die("Could not get threads"); $num = mysql_num_rows($postsresult); ?><table width="99%" cellspacing="0" cellpadding="0"> <tr> <td colspan="2"></td> <td width="21%"> </td> </tr> <tr> <td width="22%" height="381" align="center" valign="top"><div align="center"> <table width="100%" cellspacing="0" cellpadding="0" class="loggedin"> <tr> <td><div align="center"><br /> <img src='http://www.runningprofiles.com/members/images/thumbs/<?php echo $getuser['image'];?>' border="1" align="middle" /> </div> <p align="center">Name : <?php echo $getuserprofile['first_name'];echo ' ';echo $getuserprofile['last_name'];?><br /> Status: <?php $result =mysql_query("SELECT * FROM useronline WHERE(user='". $getuser['Username'] ."')"); while ($row = mysql_fetch_array($result)) { $last_active = time() - $row['timestamp']; } echo ($last_active < 300) ? 'Online <img src="/images/useron.gif" width="12" height="11" />' : 'Offline <img src="/images/useroff.gif" width="12" height="11" />'; ?> <br /> Age :<?php $dob = $getuserprofile['dob']; // GET TIMESTAMPS $ts_dob = strtotime($dob); $ts_now = time(); // DIFFERENCE IN YEARS $years = date('Y', $ts_now) - date('Y', $ts_dob); // IF BEFORE THE BIRTHDAY $mdnow = date('m-d', $ts_now); $mddob = date('m-d', $ts_dob); if ($mdnow < $mddob) $years--; // SHOW THE ANSWER echo $years; ?> <br /> Gender : <?php echo $getuserprofile['gender']?><br /> Club : <?php echo $getuserprofile['club']?></p></td> </tr> </table> <table width="90%" cellspacing="0" cellpadding="0"> <tr> <td> </td> </tr> </table> <table width="100%" cellspacing="0" cellpadding="0" class="loggedin"> <tr> <td height="174"><p align="center"><strong>Contact </strong></p> <div align="center"> <table cellspacing="0" cellpadding="0"> <tr> <td height="30" align="center" valign="middle"><div align="center"><a href="index.php?page=sendmessage&usr=<?php echo $profilename;?>">Send message</a></div></td> </tr> <tr> <td align="center" valign="middle"><div align="center"><img src="http://x.myspacecdn.com/modules/common/static/img/clear.gif" border="0" width="1" height="2" /></div></td> </tr> <tr> <td height="30" align="center" valign="middle"><?php $result = mysql_query("SELECT * FROM `friends` WHERE `username` = '$profilename' AND `friendname` = '$username'") or die(mysql_error()); if ($username !== $profilename && mysql_num_rows($result) == 0) { ?><div align="center"><a href="http://www.runningprofiles.com/members/include/friendrequest.php?username=<?php echo $profilename ?>" onclick="popUp(this.href,'console',200,500);return false;" target="_blank">Add to frinds list</a></div><?php }?></td> </tr> <tr> <td align="center" valign="middle"><div align="center"><img src="http://x.myspacecdn.com/modules/common/static/img/clear.gif" border="0" width="1" height="2" /></div></td> </tr> <tr> <td height="30" align="center" valign="middle"><div align="center"></div></td> </tr> <tr> <td><img src="http://x.myspacecdn.com/modules/common/static/img/clear.gif" border="0" width="1" height="2" /></td> </tr> <tr> <td height="5" align="center" valign="top" nowrap="nowrap"> </td> </tr> </table> </div></td> </tr> </table> <table width="90%" cellspacing="0" cellpadding="0"> <tr> <td> </td> </tr> </table> <table width="100%" cellspacing="0" cellpadding="0" class="loggedin"> <tr> <td><div align="center">Friends</div><br/> <?php include'include/myfriends.php';?></td> </tr> </table> <table width="90%" cellspacing="0" cellpadding="0"> <tr> <td> </td> </tr> </table> <table width="100%" cellspacing="0" cellpadding="0" class="loggedin"> <tr> <td align="center" valign="top"><div align="center">My Training Diary</div> <?php include "diary/cal_show.php";?></td> </tr> </table> </td> <td colspan="2" rowspan="2" align="center" valign="top"><table width="90%" height="108" cellpadding="3" cellspacing="5" > <tr> <td valign="top" bgcolor="#FFFFFF"><div align="center" class="style5"> <p class="style9"><u>Welcome to Admins profile</u></p> <p class="style9"> </p> </div> <ul id="countrytabs" class="shadetabs"> <li><a href="#" rel="#default" class="selected">About me</a></li> <li><a href="include/profiletab/showgoals.php?username=<?php echo $profilename;?>" rel="countrycontainer">Goals</a></li> <li><a href="include/profiletab/showidols.php?username=<?php echo $profilename;?>" rel="countrycontainer">Idols</a></li> <li><a href="include/profiletab/showthanks.php?username=<?php echo $profilename;?>" rel="countrycontainer">Thanks to</a> </li> </ul> <div id="countrydivcontainer" style="border:1px solid gray; width:800px; margin-bottom: 1em; padding: 10px"> <?php echo $getuserprofile['about_me']?></div> <script type="text/javascript"> var countries=new ddajaxtabs("countrytabs", "countrydivcontainer") countries.setpersist(true) countries.setselectedClassTarget("link") //"link" or "linkparent" countries.init() </script></td> </tr> </table> <table width="90%" cellspacing="0" cellpadding="0"> <tr> <td> </td> </tr> </table> <table width="90%" height="568" cellpadding="0" cellspacing="0"> <tr> <td height="566" align="center" valign="top"><table width="100%" cellspacing="0" cellpadding="0"> <tr> <td width="44%" height="481" align="left" valign="top"><div align="center"> <?php $result = mysql_query("SELECT * FROM pb where uid='".$getuser['ID']."' Order by distance ASC") or die(mysql_error()); $num2 = mysql_num_rows($result); echo "<table class=\"profilepbs\" width=195 align=\"center\" cellpadding=\"0\" cellspacing=\"0\"> <tr><td width=105 ><div align=\"center\">Distance</div></td><td width=125><div align=\"center\">Pb</div></td></tr> <tr> <td height=\"1\" colspan=\"2\" bgcolor=\"#000000\"></td> <td height=\"1\" colspan=\"2\" bgcolor=\"#000000\"></td> </tr> "; while ( $row = mysql_fetch_array($result) ) { $text = $row["distance"]; $text2 = substr($text, 2,30); echo "<tr><td bgcolor=\"#FFFFFF\"><center>" . $text2 . "</center></td><td bgcolor=\"#FFFFFF\"><center>" . $row["pb"] . "</center></td></tr>"; } if($num2 < 1) {echo "<tr><td bgcolor=\"#FFFFFF\" ><center> N/A </center></td><td bgcolor=\"#FFFFFF\"><center> N/A </center></td></tr>";} echo "</table> <p>"; ?> <br /> </div> <table class="profilepbs" width="80%" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="1" align="center" valign="top">My Forum Posts </td> </tr> <tr> <td height="1" colspan="2" bgcolor="#000000"></td> </tr> <tr> <td height="49" align="center" valign="top" bgcolor="#FFFFFF" ><?php if($num < 1) {echo 'User has yet to make a post.';}else{ while($row = mysql_fetch_assoc($postsresult)) { echo ' <a id="posts" href="http://www.runningprofiles.com/members/index.php?page=message&forum='.$row['forum'].'&id='.$row['postid'].'&pagenum=last">'.$row['title'].'</a> <br />' ;} }?></td> </tr> </table> <p> </p> <table class="profilepbs" width="80%" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="97" align="center" valign="top" h="h">My Recent Training Log's <table width="99%" cellspacing="0" cellpadding="0"> <tr> <td height="1" bgcolor="#000000"> </td> </tr> <tr> <td height="75" align="center" valign="top" bgcolor="#FFFFFF"><?php if($num1 < 1) {echo 'User has yet post their training diary.';}else{ while($row1 = mysql_fetch_assoc($postsresult1)) { $date = $row1['ev_dat']; list($year, $month, $day) = split('[-.-]', $date); ?> <? echo ' <a id="posts" href="http://www.runningprofiles.com/members/diary/cal_show.php?m='.$month.'&y='.$year.'">'.$row1['ev_title'].'</a> <br />' ; } } ?> </td> </tr> </table></td> </tr> </table> <p> </p></td> <td width="56%" valign="top" > <?php include "shoutbox/index.php"; ?></td> </tr> </table> </td> </tr> </table> <p> </p> <p> </p></td> </tr> <tr> <td align="center" valign="top"> </td> </tr> </table> why?
-
phph within href not showing php if change ? to &
runnerjp replied to runnerjp's topic in PHP Coding Help
http://www.runningprofiles.com/members/Admin/9/2009/ also dosent work... the thing is i also want the option to use just http://www.runningprfiles.com/members/admin -
phph within href not showing php if change ? to &
runnerjp replied to runnerjp's topic in PHP Coding Help
Ok i did that... it loads up http://www.runningprofiles.com/members/Admin fine but add http://www.runningprofiles.com/members/Admin/9 and it wont go to the page -
opps noticed marcus said this sorry
-
Change <input type='hidden' name='name' value='<?php echo $_SESSION['username']; ?>'> to <input type='hidden' name='name' value='<?php echo '".$_SESSION['username']."'"; ?>
-
phph within href not showing php if change ? to &
runnerjp replied to runnerjp's topic in PHP Coding Help
sent me to a this page desent exists kinda one -
phph within href not showing php if change ? to &
runnerjp replied to runnerjp's topic in PHP Coding Help
ok sorry... basicly i have a calander within my profile page... and for the calander to select previous or coming up months i need to have m=? within the url so m is month and the number 1-12 represents the month needed to be selected. thats why im using m=... obviusly when a user 1st goes on the page the current month is selected within the code and m= is not needed. mrMarcus when i use that code for some reaosn my $_get wont grab the m= :S no idea why -
phph within href not showing php if change ? to &
runnerjp replied to runnerjp's topic in PHP Coding Help
i must note if i do this <a href="<? echo $puser; ?>?m=<?=(($m-1)<1) ? 12 : $m-1 ?>&y=<?=(($m-1)<1) ? $y-1 : $y ?>"> i get http://www.runningprofiles.com/members/Admin?m=9&y=2009 -
phph within href not showing php if change ? to &
runnerjp replied to runnerjp's topic in PHP Coding Help
<a href="<? echo $puser; ?>&m=<?=(($m-1)<1) ? 12 : $m-1 ?>&y=<?=(($m-1)<1) ? $y-1 : $y ?>"> = http://www.runningprofiles.com/members/&m=9&y=2009 -
phph within href not showing php if change ? to &
runnerjp replied to runnerjp's topic in PHP Coding Help
dang ...sop what is the matter with it?? if i type in manually into the url address bar http://www.runningprofiles.com/members/Admin&m=6&y=2009 it works great but when i try run it via the script like this <a href="<?php echo $puser; ?>&m=<?php=(($m-1)<1) ? 12 : $m-1 ?>&y=<?php =(($m-1)<1) ? $y-1 : $y ?>"> it wont show the variable of $puser... if i saw the & with ? it will show it but the script wont pick up m= -
phph within href not showing php if change ? to &
runnerjp replied to runnerjp's topic in PHP Coding Help
im not great on htaccess ...infact i know pritty much nothing lol my file looks liek this RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/.]+)/?$ members/index.php?page=profile&username=$1 am i right by saying i need to chnage this then? -
Give this a wack <?php $topic = $_POST['title']; $detail = $_POST['content']; $topic = strip_tags($topic); $detail = strip_tags($detail); $ownusername=$_SESSION["real_name"]; $time=time(); if ($mute == 1) { echo "<font color=red><b>You have been muted!</b></font><br><br>"; } else { $query=mysql_query("SELECT * FROM forum_question ORDER by id DESC LIMIT 40"); $info = mysql_fetch_object($query); if ($info->title == $topic){// you allready had $topic set so why not just use that and make life easyer echo "There is already a topic with this title!"; }else{ $fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$ownusername'")); $datetime=date("d/m/y h:i:s"); //create date time if ($title == ""){ echo "You must add a title!"; } } // you missed this }// and this.... make sure you braces are closed ?> really hope this helps ( please look at changes noted on script)
-
phph within href not showing php if change ? to &
runnerjp replied to runnerjp's topic in PHP Coding Help
could it be due to my htaccess its not working RewriteRule ^([^/.]+)/?$ members/index.php?page=profile&username=$1 -
phph within href not showing php if change ? to &
runnerjp replied to runnerjp's topic in PHP Coding Help
When i do it like this http://www.runningprofiles.com/members/Admin?&m=2&y=2009 the script wont pick up the ? but when i do it like this http://www.runningprofiles.com/members/Admin&m=2&y=2009 the script picks up the month.... -
phph within href not showing php if change ? to &
runnerjp replied to runnerjp's topic in PHP Coding Help
but i need it like this http://www.runningprofiles.com/members/Admin&m=11&y=2009 -
<a href="<?php echo $puser; ?>?m=<?php=(($m-1)<1) ? 12 : $m-1 ?>&y=<?php =(($m-1)<1) ? $y-1 : $y ?>"> with the code above it displays /runnerjp?m=10&y=09 BUT if i chnage the ?m to &m then my $puser; doesnt show and all i get is /&m=.... why?
-
im trying to add an existaing calander onto a profile page by using <?php include "diary/cal_show.php";?> which looks like this... But when i hit either arrows to move on the month using this script - <tr bgcolor="#<? echo $bg_top; ?>"><th width="20" style="<?php echo $hcell; ?>"><a href="<?php echo $puser; ?>?m=<?php =(($m-1)<1) ? 12 : $m-1 ?>&y=<?php =(($m-1)<1) ? $y-1 : $y ?>"><img src='http://www.runningprofiles.com/calendar/images/prev.gif' height='18' width='18' alt='' border='0' /></a></th> It stays on the current month and i cant understand why.. here is the calander script <script src="http://www.runningprofiles.com/jquery.js" type="text/javascript"></script> <link href="http://www.runningprofiles.com/members/diary/facebox/facebox.css" media="screen" rel="stylesheet" type="text/css"/> <script src="http://www.runningprofiles.com/members/diary/facebox/facebox.js" type="text/javascript"></script> <script> jQuery(document).ready(function($) { $('a[rel*=facebox]').facebox() }) </script> <?php // there is NO NEED to edit ANY of this code $ev_dat = array(); for ($i=0;$i<32;$i++) { $ev_dat[$i]=0; } $now = date("Y-m-d", time()); list($ty, $tm, $td) = explode('-',$now); // ty=thisyear, etc. used for highlighting 'today' include("cal_parms.php"); // assorted configuration variables include($dat_names); // retrieved from cal_parms.php as a 'language' file if (!isset($_GET['m'])) { $m = date("m",mktime()); } else { $m = $_GET['m']; } if (!isset($_GET['y'])) { $y = date("Y",mktime()); } else { $y = $_GET['y']; } /*== get what weekday the first is on ==*/ $tmpd = getdate(mktime(0,0,0,$m,1,$y)); $month = $tmpd["month"]; $firstwday= $tmpd["wday"]; if ($firstDayIsMonday == 1) { if ($firstwday == 0) { $firstwday = 6; } else { $firstwday--; } } $lastday = mk_getLastDayofMonth($m,$y); /*== get the last day of the month ==*/ function mk_getLastDayofMonth($mon,$year) { for ($tday=28; $tday <= 31; $tday++) { $tdate = getdate(mktime(0,0,0,$mon,$tday,$year)); if ($tdate["mon"] != $mon) { break; } } $tday--; return $tday; } // compute range of dates for this month to match dates in database in the format yyyy-mm-dd if (strlen($m)<2) { $q="0"; $q.=$m; } else { $q = $m; } $dats_beg = $y. "-". $q. "-01"; $dats_en = $y. "-". $q. "-". $lastday; // open db conn and select all records where date is between $dats_beg and $dats_en include("cal_db_conn.php"); mysql_connect($db_host, $db_login, $db_pass) or die ("Can't connect!"); mysql_select_db($db_name) or die ("Can't open database!"); $query = "SELECT * FROM $db_table WHERE (ev_dat>='$dats_beg') AND (ev_dat<='$dats_en') "; $result = mysql_db_query($db_name, $query); // any matches? if ($result) { // handle the matches and pass relevant info to arrays while ($myrow = mysql_fetch_array($result)) { $found = $myrow['ev_dat']; $pieces = explode("-", $found); $dd = intval($pieces[2]); $ev_dat[$dd] = $myrow['id']; } } ?> <table cellpadding="1" cellspacing="1" border="0" bgcolor="#<? echo $bg_edge; ?>"> <tr><td colspan="7" bgcolor="#<? echo $bg_top; ?>"> <table cellpadding="1" cellspacing="1" border="0" width="100%"> <tr bgcolor="#<? echo $bg_top; ?>"><th width="20" style="<?php echo $hcell; ?>"><a href="<? echo $puser; ?>?m=<?=(($m-1)<1) ? 12 : $m-1 ?>&y=<?=(($m-1)<1) ? $y-1 : $y ?>"><img src='http://www.runningprofiles.com/calendar/images/prev.gif' height='18' width='18' alt='' border='0' /></a></th> <th style="<?php echo $hcell; ?>"> <?php echo "<a href='../diary/show-month.php?mon=". $m. "&yr=". $y. "'rel=\"facebox\">"; echo "<span style='text-decoration:none'>". $mo[intval($m)]. " ". $y. "</span></a>"; ?> </th> <th width="20" style="<? echo $hcell; ?>"><a href="<? echo $_SERVER['PHP_SELF']; ?>?m=<?=(($m+1)>12) ? 1 : $m+1 ?>&y=<?=(($m+1)>12) ? $y+1 : $y ?>"><img src='http://www.runningprofiles.com/calendar/images/next.gif' height='18' width='18' border='0' alt='' /></a></th> </tr> </table> </td></tr> <tr bgcolor="#<? echo $bg_top; ?>"> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[1]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[2]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[3]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[4]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[5]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[6]; ?></th> <th width="20" style="<?php echo $hcell; ?>"><? echo $da[7]; ?></th> </tr> <? $d = 1; $wday = $firstwday; $firstweek = true; /*== loop through all the days of the month ==*/ while ( $d <= $lastday) { /*== set up blank days for first week ==*/ if ($firstweek) { if ($wday!=0) { echo "<tr bgcolor='#". $bg_tabl. "'>\n"; for ($i=1; $i<=$firstwday; $i++) { echo "<td style='". $tcell. "' bgcolor='#". $bg_fill. "'> </td>\n"; } } /*== Sunday start week with <tr> ==*/ else { echo "<tr bgcolor='#". $bg_tabl. "'>\n"; } $firstweek = false; } /*== check for event ==*/ echo "<td style='". $tcell. "' "; // is this day 'today' AND there's no event today if (($ty==$y) && ($tm==$m) && ($td == $d) && (!$ev_dat[$d])) { echo "bgcolor='#". $bg_now. "'>". $d; } elseif ($ev_dat[$d]) { // get what's happening that day and use as 'mouseOver' for the link $query = "SELECT * FROM $db_table WHERE id=$ev_dat[$d] "; $result = mysql_query($query); $ev = mysql_fetch_array($result); $titl = $ev['ev_title']; echo "bgcolor='#". $bg_act. "'>"; $url = "../diary/show.php?event=". $ev_dat[$d]. "&sho=". $win_sho; echo "<a href=' $url' rel=\"facebox\" title=\"". $titl. "\">". $d. "</a>"; } else { echo "bgcolor='#". $bg_days. "'>". $d; } echo "</td>\n"; /*== Saturday end week with </tr> ==*/ if ($wday==6) { echo "</tr>\n"; } $wday++; $wday = $wday % 7; if (($wday==0) AND ($d!=$lastday)){ echo "<tr bgcolor='#". $bg_tabl. "'>\n"; } $d++; } // and close off the table if (($wday!=7) AND ($wday!=0)) { for ($i=$wday; $i<=6; $i++) { echo "<td style='". $tcell. "' bgcolor='#". $bg_fill. "'> </td>\n"; } echo "</tr>"; } echo "\n</table>"; include("win_open.php"); ?> Hopefully someone can make sence on why its not working... i dont want to put it in an iframe as i would like to have popout windows used to show what event are happening on them dates.
-
im trying to pull from the db posts a user has made so that i can display there last 5 posts.. <?php $sql = "Select * FROM forumtutorial_posts where author = '$profilename' ORDER BY `showtime` DESC LIMIT 0, 5"; $postsresult = mysql_query($sql) or die("Could not get threads"); $num = mysql_num_rows($postsresult);if($num < 1) {echo 'User has yet to make a post.';}else{ while($row = mysql_fetch_assoc($postsresult)) { echo ' <a id="posts" href="http://www.runningprofiles.com/members/index.php?page=message&forum='.$row['forum'].'&id='.$row['postid'].'&pagenum=last">'.$row['title'].'</a> <br />' ;} }?> but say i posted under this 5 times it would show this only show db output once only show db output once only show db output once only show db output once only show db output once how can i only show it once per topic?
-
how would i get the php to work thing this redirect?? header('Location: index.php?page=message&forum=$forum&id=$forumpostid&pagenum=last'); at the moment it just mimics the location
-
how would i get the php to work thing this redirect?? header('Location: index.php?page=message&forum=$forum&id=$forumpostid&pagenum=last'); at the moment it just mimics the location
-
how comes my redirect echos out index.php?page=message&forum=$forum&id=$forumpostid&pagenum=last and not the php output... well i cant think of the word lol but the output of $forum is what i mean lol minds gone blank header('Location: index.php?page=message&forum=$forum&id=$forumpostid&pagenum=last');
-
[SOLVED] Applying a time limit to edit posts
runnerjp replied to runnerjp's topic in PHP Coding Help
i tried this <?php $last_active = time() - $getreply3['showtime']; echo ($last_active < 300) ? ' <a href="index.php?page=reply&forum=$forum&id=$forumpostid&pid=$getreply3["'.postid.'"]">Edit</a>| Report ': "Edit";?> but it just shows edit even if the time has been 2 seconds :S -
[SOLVED] Applying a time limit to edit posts
runnerjp replied to runnerjp's topic in PHP Coding Help
humm ok so iv got my post added into the db as 'showtime' to edit a post i do this use a link with the post id in it like so <a href="index.php?page=reply&forum=<?php echo $forum; ?>&id=<? echo $forumpostid ?>&pid=<? echo $getreplies3['editid']; ?>">Edit</a> so how can i find out if 2 hours have passed to use in if statement?