Jump to content

runnerjp

Members
  • Posts

    2,214
  • Joined

  • Last visited

Everything posted by runnerjp

  1. What would the best way/how would i , add a time limit for a user to edit a post?? so say i made a post and needed to chnage it, then id only have 2 hours to change it , and then display to the user how longs left??
  2. try doing it like this <textarea cols="40" rows="12" wrap="hard" name="contentirish"></textarea> i hd this problem where there was a space within the textarea code and it just added it to the text
  3. ok at the moments this is how i get a quote form the forum... First i click the quote button which stores the post id <form action="index.php?page=reply&forum=<?php echo $forum; ?>&id=<? echo $forumpostid ?>" method="post"> <input name="quote" type="hidden" value="<? echo $gettopic3['postid']; ?>" /> <input name="submit" type="submit" value="quote" /> </form> then on the reply page i do this <textarea id="inputforum" class="inputforum" name='yourpost' rows='5' cols='40'><?php echo $thePost; if (isset($_POST['quote'])) { $quote = mysql_fetch_assoc(mysql_query("SELECT * from forumtutorial_posts where postid='".$_POST['quote']."'")); ?>[quote=<?php echo $quote['author'] ?> ] <?php echo $quote['post']; ?> [/quote] <?php }?> </textarea> so would you guys say this is the best way to do it or could it be improved??
  4. yer so what ever the table is order by it within the aql statement as shown above
  5. ok so here is quick snippit of my code where the code in question is <?php <span class="style1"><?php $message = nl2br($gettopic3['post']); $b = new BBCode(); $b->selection = nl2br($message); $b->parseCode(); echo nl2br($b->parsed);?></span></td> </tr> <tr> <td align="right" valign="bottom"> <form action="index.php?page=reply&forum=<?php echo $forum; ?>&id=<? echo $forumpostid ?>" method="post"> <input name="quote" type="hidden" value="<? echo $gettopic3['postid']; ?>" /> <input name="submit" type="submit" value="quote" /> </form></td> </tr> </table></td> </tr> <?php } $getreplies = "Select * from forumtutorial_posts where parentid='$forumpostid' ORDER BY showtime $max"; //getting replies $getreplies2 = mysql_query($getreplies) or die(mysql_error() . "Could not get replies"); while ($getreplies3 = mysql_fetch_array($getreplies2)) { ?> <tr class='mainrow'><td height="119" valign='top'><div align="center"> <strong><a href='/members/<? echo $getreplies3['author']; ?>'><? echo $getreplies3['author'] ?></a></strong> <?php $result = mysql_query("SELECT * FROM useronline WHERE(user='" . $getreplies3['author'] . "')"); while ($row = mysql_fetch_array($result)) { $last_active = time() - $row['timestamp']; } echo ($last_active < 300) ? '<img src="http://www.runningprofiles.com/images/useron.gif" width="12" height="11" />' : '<img src="http://www.runningprofiles.com/images/useroff.gif" width="12" height="11" />'; ?></div> <p align="center"> <? $query = "SELECT * FROM users WHERE Username = '" . $getreplies3['author'] . "' LIMIT 1"; if ($result = mysql_query($query)) { if (mysql_num_rows($result)) { $array = mysql_fetch_assoc($result); $image = $array['image']; $postnum = $array['post_count']; echo "<img src=\"http://www.runningprofiles.com/members/images/mini/$image\" border=\"1\" />"; ?><br /> <span class="style7"> Posts: <?php echo $postnum; ?> </span> <p> <? } } ?> </p></td> <td valign='top'> <table width="100%" cellpadding="0" cellspacing="0"> <tr> <td width="3%" rowspan="2"><div align="center"><img src="http://www.runningprofiles.com/images/posted.jpg" alt="foot" width="17" height="33" /></div></td> <td width="97%"><a href='index.php?page=message&forum=<? echo $forum; ?>&id=<? echo $gettopic3[postid] ?>'><strong>RE: <? echo $gettopic3[title] ?></strong></a></td> </tr> <tr> <td><span class="style7">Replied <? $dbtime = $getreplies3['showtime']; $time = date("F j Y, g:i a", $dbtime); $time = date("F j, Y, g:i a", $dbtime); gettheTime($dbtime, $time); ?> </span></td> </tr> <tr> <td rowspan="4"> </td> <td><hr color="#043050" /></td> </tr> <tr> <td align="left" valign="top"></td> </tr> <tr> <td height="27" align="right" valign="bottom"> <div align="left"> <span class="style1"><?php $message = nl2br($getreplies3['post']); $b = new BBCode(); $b->selection = nl2br($message); $b->parseCode(); echo nl2br($b->parsed);?></span> </div></td> </tr> <tr> <td height="28" align="right" valign="bottom">?> As you can see i have 2 codes with <?php $message = nl2br($getreplies3['post']); $b = new BBCode(); $b->selection = nl2br($message); $b->parseCode(); echo nl2br($b->parsed);?> the topone outputs the bbcode fine.. in this case bold im trying out. but for some reason the second time i run this code for the replies to the topic the bbcode is not outputted even though the code is mirrored ... why is this??
  6. all depends on how you add up the scores or what ever you determin the place in the league... something like Select * from leaguetable ORDER BY 'position'
  7. opps here http://www.w3schools.com/php/php_forms.asp
  8. lol crayon Violent is correct :) function trim_value(&$value) { $value = trim($value); } that would do job and its what i use!
  9. textboxes linking to the db is what you need to change profiles http://www.w3schools.com/php/php_forms.asp.. where the usuall text is just add the textbox there echoing the current text into the textbox. also other users pages will be by there id... so something like $getuserprofile = mysql_fetch_assoc(mysql_query("SELECT * from profile where ID='".$getuser['ID']."'"));// grabbing id from ur such as www.profile.com?id=1 then it would be just echo $getuserprofile['gender']; ect ect
  10. humm you should have a php.ini file lol unless they dont have php intalled on the server... try running this <?php phpinfo(); ?> can you locate the php.ini file under /usr/local/lib/php.ini usually... but the above code should find it... this would be the start to solving the solution... if you php.ini file is not there, then this is your problem. Also whenever you change the php.ini file, you must also reset the web server. Then all of the PHP variables that you set will be seen by the server
  11. ok i tried this with <?php $message = nl2br($getreplies3['post']); $b = new BBCode(); $b->selection = $message; $b->parseCode(); echo $b->parsed;?> but didnt work sadly
  12. Hey guys, For some reason if i copy says this text with the spaces into my forum text box the out come is displayed without the spaces within the copy and paste as shown below... now its inserting it into my db with the spaces... so i belive its the output onto the page so here is the the code for this.. <?php $message = $gettopic3['post'];// this is the messages form the post $b = new BBCode();//dealing with the bbcode $b->selection = $message; $b->parseCode(); echo $b->parsed;?> bbclass so you can see the functions <?php class BBCode { protected $bbcodes; // Store array of BBCodes protected $vbbcodes; // Store array of Variable BBCodes var $debug = ''; // Store any errors var $selection = ''; // Store the selection to be parsed first var $parsed = ''; // Store the parsed selection. var $path2emoticon = 'http://www.runningprofiles.com/emoticons/'; // Set the path to the emoticon images. var $imgext = '.gif'; // Set this to the ext of the images public $emoticons = array( '' => 'Roll Eyes', '' => 'Smiley', '' => 'Wink', '' => 'Cheesy', '' => 'Grin', '' => 'Angry', '' => 'Sad', '' => 'Shocked', '' => 'Cool', '???' => 'Huh', '' => 'Tongue', ':-[' => 'Embarrassed', ':-X' => 'Lips Sealed', ':-\\' => 'Undecided', '' => 'Kiss', ':*(' => 'Cry' ); // All emoticons. Spaces and caps will be removed for image names. function parseCode($security=0) { // Security defaults to 0. Set to 1 for non-variable bbcodes only. if(!$this->selection) { // Check if the user has set the selection. $this->debug .= "You must set a value for the selection before parsing! "; // Set the Debug variable if not. }else{ if($this->parsed) { // Check if text has already been parsed. $this->debug .= "You must run the code parser before the emoticon parser! "; // Set the Debug variable if so. }else{ $selection = str_replace("\n", '', $this->selection); // Set selection variable for inside function only. $selection2 = htmlentities(str_replace("\n", '', $this->selection)); // Remove html entities for security. $this->selectCodes($security); // Select codes depending on security. #### Start [code] Section ### preg_match_all("/\[code\].+\[\/code\]/Ui", $selection2, $matches); // Check for [code] tags. Set the matches array. $i = 0; // Set the variable to the default of 0. while(isset($matches[0][$i])) { // Check for match from preg_match. $selection = str_ireplace(html_entity_decode($matches[0][$i]), "[code$i]", $selection); // Decode and replace for strip tags. $i++; // Add one to the variable to loop. } $selection = strip_tags($selection); // Strip tags from the selection. while($i>0) { // Reloop through matches. $i--; // Remove one from the variable to loop. $m = html_entity_decode($matches[0][$i]); // Decode the match for accurate removal. $m = str_ireplace("[code]", "", $m); // Remove [code] tag. $m = str_ireplace(" ", "", $m); // Remove [/code] tag. $m = highlight_string($m,true); // Highlight string and encode. $selection = str_ireplace(" [code$i]", " " . $m . " ", $selection); // Add highlighted code back with tags for later parsing. } #### End Section #### ### Start BBCode Section ### foreach ($this->bbcodes as $key => $value) { // Loop through bbcodes. $selection = str_ireplace($key, $value, $selection); // Replace the $key value(bbcode) with the $value value(html code). } #### End BBCode Section ### ### Start Var. BBCode Sec. ## if($security==0) { // Only loop through if security allows it. foreach ($this->vbbcodes as $key => $value) { // Loop through variable bbcodes. unset($matches); // Unset matches set in earlier code. $i = 0; // Set the variable to the default of 0. preg_match_all($key, $selection, $matches); // Find all instances of the variable bbcode set them to matches. // Preg Matching also stores the "variables" inside the matches var. with the matches. while(isset($matches[0][$i])) { // Check if there are any instances. $v = str_replace("*", $matches[1][$i], $value); // Replace the asterisk with the variable value. if(isset($matches[2][$i])) { // Check for more than one variable. $v = str_replace("~", $matches[2][$i], $v); // Replace the ~ with the second variable value. } $selection = str_replace($matches[0][$i], $v, $selection); // Replace the match with the accumulated variable. $i++; // Add one to the variable to loop. } } } ### End Var. BBCode Sec. ## $this->parsed = $selection; // Insert the accumulated parsed selection into the parsed variable as to keep selection original. unset($selection); // Remove all value from private variable selection. } } } protected function selectCodes($security=0) { // Security defaults to 0. Set to 1 for non-variable bbcodes only. switch ($security) { // Switch between 0 and 1. default: // In the case of security being anything but one. Defaulting to zero. case 0: // In the case of security being zero. $this->bbcodes = array( "[i]" => "<i>", "[/i]" => "</i>", "[b]" => "<b>", "[/b]" => "</b>", "[u]" => "<u>", "[/u]" => "</u>", "[s]" => "<del>", "[/s]" => "</del>", "[move]" => "<marquee>", "[/move]" => "</marquee>", " [center]" => "<center>", "[/center] " => "</center>", "[hr]" => "<hr />", "[table][tr][td]" => "<table>", "" => "</table>", "[table][tr][td]" => "<tr>", "[/td][/tr][/table]" => "</tr>", "[table][tr][td]" => "<td>", "[/td][/tr][/table]" => "</td>", "[sub]" => "<sub>", "[/sub]" => "</sub>", "[sup]" => "<sup>", "[/sup]" => "</sup>", "[tt]" => "<tt>", "[/tt]" => "</tt>", "[list]" => "<ul>", "[/list]" => "</ul>", "[list][*]" => "<li>", "[/list]" => "</li>", "[/size]" => "</font>", "[/face]" => "</font>", "[/color]" => "</font>", "[p]" => "<p>", "[/p]" => "</p>", "[/td][/tr][/table][code]" => "<p style=\"background: #BBBBBB; border: 1px solid #555555; padding: 6px;\"><span style=\"font: bold 10px Courier New;\"> CODE :</span><br/>",); // BBCode array including their replacement. $this->vbbcodes = array( "/\[size=(.+)\]/Ui" => "<font size=\"*\">", "/\[face=(.+)\]/U" => "<font face=\"*\">", "/\[color=(.+)\]/Ui" => "<font color=\"*\">", "/\[img\](.+)\[\/img\]/Ui" => "<img src=\"*\" />", "/\[email\](.+)\[\/email\]/Ui" => "<a href=\"mailto:*\">*</a>", "/\[url\](.+)\[\/url\]/Ui" => "<a href=http://\*\>*</a>", "/\[email=(.+)\](.+)\[\/email\]/Ui" => "<a href=\"mailto:*\">~</a>", "/\[url=(.+)\](.+)\[\/url\]/Ui" => "<a href=\"*\">~</a>", "/\[quote](.+)\[\/quote\]/is" => "<div class=\"quote_header\">Quote:</div><div class=\"quote_body\">*</div>", "/\[quote=(.*)\](.*)\[\/quote\]/is" => "<div style=\"background: #e4ebeb; border: 1px solid #555555; padding: 6px;\"> <div style=\"font-size:10px; color:#043050;\">Quote by * :</div> <div>~</div></div> " ); // Variable BBCode array including their replacement and variable position(s). break; case 1: // In the case of security being one. $this->bbcodes = array( "[i]" => "<i>", "[/i]" => "</i>", "[b]" => "<b>", "[/b]" => "</b>", "[u]" => "<u>", "[/u]" => "</u>", "[s]" => "<del>", "[/s]" => "</del>", "[move]" => "<marquee>", "[/move]" => "</marquee>", " [center]" => "<center>", "[/center] " => "</center>", "[hr]" => "<hr />", "[table][tr][td]" => "<table>", "" => "</table>", "[table][tr][td]" => "<tr>", "[/td][/tr][/table]" => "</tr>", "[table][tr][td]" => "<td>", "[/td][/tr][/table]" => "</td>", "[sub]" => "<sub>", "[/sub]" => "</sub>", "[sup]" => "<sup>", "[/sup]" => "</sup>", "[tt]" => "<tt>", "[/tt]" => "</tt>", "[list]" => "<ul>", "[/list]" => "</ul>", "[list][*]" => "<li>", "[/list]" => "</li>", "[/td][/tr][/table][code]" => "<p style=\"background: #BBBBBB; border: 1px solid #555555; padding: 6px;\"><span style=\"font: bold 10px Courier New;\"> CODE :</span><br/>", " " => "</p>" ," " => "<p style=\"background: #BBBBBB; border: 1px solid #555555; padding: 6px;\"><span style=\"font: bold 10px Courier New;\"> CODE :</span><br/>", " " => "</p>"); // BBCode array including their replacement. break; } } function parseEmoticons($noBBCode=0) { // noBBCode variable defaults to 0. If set to one the parser will not parse be able to parse BBCode. if(!$this->selection) { // Check if the user has set the selection. $this->debug .= "You must set a value for the selection before parsing! "; // Set the Debug variable if not. }else{ $error = 0; // Default to no errors. if($this->parsed) { // If something has already been parsed. $selection = str_replace("\n", '', $this->parsed); // Set the parsed value in order to not reset the already parsed selection. }elseif($noBBCode==1) { // If nothing has been parsed and the noBBCode variable has been set to one. $selection = str_replace("\n", '', $this->selection); // Set the selection value to variable selection. $error = 2; // Set the error variable to 2 so that it will not look for tags. }else{ // If all else fails. $this->debug .= "You must parse BBCode first or set the noBBCode variable to 1(setting this variable will not allow bbcode to be parsed)! "; // Set the Debug variable if it gets here. $error = 1; // Set the error variable so the parser doesn't run. } if($error==0 or $error==2) { if($error==0) { // Only search if there has been parsing. unset($matches); preg_match_all('/\<p style="background: #BBBBBB; border: 1px solid #555555; padding: 6px;"\>.+\<\/p\>/Uim', $selection, $matches); // Finds all code selections. $i = 0; // Set the variable to the default of 0. while(isset($matches[0][$i])) { // Check for match from preg_match. $selection = str_ireplace($matches[0][$i], "[code$i]", $selection); // Replace for non-emoticon section. $i++; // Add one to the variable to loop. } } foreach($this->emoticons as $key => $value) { // For each emoticon set the key and value. $v = str_replace(" ", "", $value); // Remove all spaces from value but not replacing the value variable. $v = "<img src=\"" . $this->path2emoticon . strtolower($v) . $this->imgext . "\" alt=\"$value\" />"; // Set the image replacement up. $selection = str_ireplace($key, $v, $selection); // Replace the key with the set up image replacement. } if($error==0) { // Only search if there has been parsing. while($i>0) { // Reloop through matches. $i--; // Remove one from the variable to loop. $selection = str_ireplace("[code$i]", $matches[0][$i], $selection); // Add the codes back for final display. } } $this->parsed = $selection; // Insert the accumulated parsed selection into the parsed variable as to keep selection original. unset($selection); // Remove all value from private variable selection. } } } }?? i would be very greatfull for anyhelp in this matter as its confuxing me greatly lol Jarratt
  13. im trying to chnage the month shown within the calander by changing the url.... so for example if i wanted to show july i would have my url as http://www.runningprofiles.com/members/Admin?m=7&y=2009 (7 beeing july) but the thing is it wont chnage the date :S it keeps with the current date no matter what i add to the url. below is my show_calander.php <?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("diary/cal_parms.php"); // assorted configuration variables include("diary/".$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("diary/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 $_SERVER['PHP_SELF']; ?>?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> <?php $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>"; ?> one thing i must add is my profile page on which this is showing is actually included onto my index file if that helps at all here is the inde.php include code <?php $page = $_GET['page']; if (ereg('[A-Za-z0-9]',$page) ) { if (file_exists('include/'.$page.'.php')) { include('include/'.$page.'.php'); } else { include('include/main.php'); } } else { include('include/main.php'); }?> and here is the htacess code if this also helps RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^([^/.]+)/?$ members/index.php?page=profile&username=$1
  14. easy...use forms for him to fill in on a admin page which changes the db input... plenty of open source cms you can implament into the website http://www.google.co.uk/search?hl=en&q=cms+php+open+source&btnG=Google+Search&meta=&aq=4&oq=cms+php
  15. i must add i have tried chnageing the url to http://www.runningprofiles.com/members/admin?m=8&y=2009 but it only shows the current month.. this is the url that works with the calander http://www.runningprofiles.com/members/diary/cal_show.php?m=7&y=2009 but obviusly i have included the calander onto the profile page
  16. the problem itself is the url link itself.... ok here is my 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 $_SERVER['PHP_SELF']; ?>?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"); ?> as you can see by here: if (!isset($_GET['m'])) { $m = date("m",mktime()); } else { $m = $_GET['m']; } if (!isset($_GET['y'])) { $y = date("Y",mktime()); } else { $y = $_GET['y']; } it takes the month from what every in the url so m=6 = july m=7=june ect now i have included the calander on my profilepage... which 2get to is this.. www.mysite.com/members/runnerjp for example... but obviusly in the profile page i have added the calander with an include.... so how could i change the moneth and year so it also acts upon the include
  17. ok this is alittle complex but here we go: my pages run via this script <? $page = $_GET['page']; if (ereg('[A-Za-z0-9]',$page) ) { if (file_exists('include/'.$page.'.php')) { include('include/'.$page.'.php'); } else { include('include/main.php'); } } else { include('include/main.php'); }?> im sure you all know how it works lol so on my profile page i have included a calander via <?php include "diary/cal_show.php";?> .. and basicly whats happening is say i need to chnage the month... i click the link via <?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>"; ?> it refreshes the whole page and to http://www.runningprofiles.com/members/index.php?m=7&y=2009 which obviously isnt the page... and this is due to me including the file lol is there anyway i can solvethis? i have though about using iframes but when i click on one of the dates it brings up a window showing what events are on that date and this just doesnt fit into an iframe lol
  18. in cal_parms.php all i have is <?php ini_set('error_reporting', E_ALL); $db_host = "localhost"; // leave this as localhost $db_login = ""; // db_login/username $db_pass = ""; // db-password $db_name = ""; // database name $db_table = ""; ?> lol thats all so thats not the area why the code is stopping.... what should i be looking out for?
  19. yup done that and no errors cal_parms is just my db name ect!
  20. ok on my profile page i added an include of a calander.... but for some reason any php under the include doest not show on the page :S below is my 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 $_SERVER['PHP_SELF']; ?>?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> <?php $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"); ?> If anymore information is need i will be happy to give all needed to solve this wierd problem
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.