Jump to content

blueman378

Members
  • Posts

    888
  • Joined

  • Last visited

    Never

Everything posted by blueman378

  1. hi guys well ive got a calender code im modifying to add a next month/previous feature, so heres the code <?php $next = $_GET["next"]; $back = $_GET["back"]; $max = "12"; $min = "1"; // get this month and this years as an int if (isset($next)) { $next++; $thismonth = $next; } elseif (isset($back)) { $back--; $thismonth = $back; } else { $thismonth = ( int ) date( "m" ); } $thisyear = date( "Y" ); // find out the number of days in the month $numdaysinmonth = cal_days_in_month( CAL_GREGORIAN, $thismonth, $thisyear ); // create a calendar object $jd = cal_to_jd( CAL_GREGORIAN, date( "m" ),date( 1 ), date( "Y" ) ); // get the start day as an int (0 = Sunday, 1 = Monday, etc) $startday = jddayofweek( $jd , 0 ); // get the month as a name // $monthname = jdmonthname( $jd, 1 ) if ($thismonth == "1") { $monthname = "January"; } elseif ($thismonth == "2") { $monthname = "February"; } elseif ($thismonth == "3") { $monthname = "March"; } elseif ($thismonth == "4") { $monthname = "April"; } elseif ($thismonth == "5") { $monthname = "May"; } elseif ($thismonth == "6") { $monthname = "June"; } elseif ($thismonth == "7") { $monthname = "July"; } elseif ($thismonth == "8") { $monthname = "August"; } elseif ($thismonth == "9") { $monthname = "September"; } elseif ($thismonth == "10") { $monthname = "October"; } elseif ($thismonth == "11") { $monthname = "November"; } elseif ($thismonth == "12") { $monthname = "December"; } else { echo "Unknown month"; } ?> <table> <tr> <td colspan="7"><div align="center"><strong><?= $monthname ?></strong></div></td> </tr> <tr> <td><strong>S</strong></td> <td><strong>M</strong></td> <td><strong>T</strong></td> <td><strong>W</strong></td> <td><strong>T</strong></td> <td><strong>F</strong></td> <td><strong>S</strong></td> </tr> <tr> <?php // put render empty cells $emptycells = 0; for( $counter = 0; $counter < $startday; $counter ++ ) { echo "\t\t<td>-</td>\n"; $emptycells ++; } // renders the days $rowcounter = $emptycells; $numinrow = 7; for( $counter = 1; $counter <= $numdaysinmonth; $counter ++ ) { $rowcounter ++; echo "\t\t<td>$counter</td>\n"; if( $rowcounter % $numinrow == 0 ) { echo "\t</tr>\n"; if( $counter < $numdaysinmonth ) { echo "\t<tr>\n"; } $rowcounter = 0; } } // clean up $numcellsleft = $numinrow - $rowcounter; if( $numcellsleft != $numinrow ) { for( $counter = 0; $counter < $numcellsleft; $counter ++ ) { echo "\t\t<td>-</td>\n"; $emptycells ++; } } ?> </tr> <tr> <td colspan="3"><form action="<?php $_server['php_self']; ?>"> <input type="hidden" name="back" value="<?php echo "$thismonth"; ?>" /> <?php if ($thismonth > $min){ echo '<input type="submit" value="Back" />'; } ?> </form> </td><td><?php echo "$thismonth";?></td><td colspan="3"> <form action="<?php $_server['php_self']; ?>"> <input type="hidden" name="next" value="<?php echo "$thismonth"; ?>" <?php if ($thismonth < $max){ echo '<input type="submit" value="Next" />'; } ?> </form></td> </tr> </table> which is working ok on first run, however when you click next/ back the day the month starts on stays the same, eg this month is march so the calander looks like this (first image) but when i click back (february) i get (second image) any ideas? cheers
  2. thanks man, forgot all about EOPAGE, simply removed it all together and went back to closing my tags and it worked great
  3. because im not sure if he wants to check if it is equal to that or if it is jsut set so he can just take what he wants
  4. $var = $_POST["name"]; $compareable = "hello"; if (isset($var) && $var == $comparable) { header('Location: http://www.example.com/secretpage'.php); } something like that?
  5. hi guys well i have this code for a calender: <?php //Here is Step 1. $date =time () ; //Gets today’s date $day = date('d', $date) ; //gets the day $month = date('m', $date) ;//gets the month $year = date('Y', $date) ;//gets the year $firstDay = mktime(0,0,0,$month, 1, $year) ;//gets the first day of the month. $monthName = date('F', $firstDay) ; //gets the month name //Here is Step 2 $firstDayOfWeek = date('D', $firstDay) ; //gets the day of the week for the first of the month. // Here is Step 3 switch($firstDayOfWeek){ case "Sun": $spacer = 0; break; case "Mon": $spacer = 1; break; case "Tue": $spacer = 2; break; case "Wed": $spacer = 3; break; case "Thu": $spacer = 4; break; case "Fri": $spacer = 5; break; case "Sat": $spacer = 6; break; } //Here is Step 4 $daysInMonth = cal_days_in_month(0, $month, $year) ; //gets number of days in month //Here is Step 5 echo "<table border=2 width=350>"; //The next few lines set up the table and the day headers. echo "<tr><th colspan=7> $monthName $year </th></tr>"; echo "<tr><td width=50>S</td><td width=50>M</td><td width=50>T</td><td width=50>W</td><td width=50>T</td><td width=50>F</td><td width=50>S</td></tr>"; $dayCount = 1; //counts the number of days. We only want it to count up to 7. echo "<tr>"; while ( $spacer > 0 ) //Start with the blank days in the beginning of the month. { echo "<td></td>"; $spacer = $spacer-1; $dayCount++; } $dayNumber = 1; // first we must set a counter to so we can print out the days. while ( $dayNumber <= $daysInMonth ) //While loop will print out the days as long as there are days left in the month. { echo "<td> $dayNumber </td>"; $dayNumber++; $dayCount++; if ($dayCount > 7) //Makes sure we only print out seven days per week. { echo "</tr><tr>"; $dayCount = 1; } } while ( $dayCount >1 && $dayCount <=7 ) //We print blanks at the end of the month. { echo "<td> </td>"; $dayCount++; } echo "</tr></table>"; //End the table for the calendar. ?> now the problem is that the code is echoing itself after a certian point: output: "; //The next few lines set up the table and the day headers. echo " "; echo "SMTWTFS"; = 1; //counts the number of days. We only want it to count up to 7. echo ""; while ( > 0 ) //Start with the blank days in the beginning of the month. { echo ""; = -1; ++; } = 1; // first we must set a counter to so we can print out the days. while ( <= ) //While loop will print out the days as long as there are days left in the month. { echo " "; ++; ++; if ( > 7) //Makes sure we only print out seven days per week. { echo ""; = 1; } } while ( >1 && <=7 ) //We print blanks at the end of the month. { echo " "; ++; } echo ""; //End the table for the calendar. ?> now the thing is it is only doing this if i put it inside another page, if it is simply run by itself it works fine, code is attached as new restrictions will not allow me to post it for some reason cheers matt
  6. well you could always jsut upload them to a folder then just use one object code with variables for the file name, not sure how youre site works but basically have your links to the page like pagename.php?file=gamer(this will be replacwed with the file name) and then retrieve it with the get function, or post as it may be
  7. lol that wasnt showing up for ages
  8. acctually they removed everything but the forums, try going to the tutorial section, its gone!!! thats what im pissed about aye but thanks
  9. btw where did the topic solved mod go?
  10. well basically there is some code which lists some prjects, based upon some directorys, andway it reads from this array $projectsListIgnore = array ('.','..','images'); and anything in that array is not printed basically, it works fine with static things but i need it to also not print anything that Starts with Copy of (backup folders and dont want them showing up) so im looking for something like $projectsListIgnore = array ('.','..','images','Copy of *); but obviously it doesnt work
  11. hi guys, well im modifying a file and it has this in it: $projectsListIgnore = array ('.','..','images'); what im also wanting to do is have it so it excludes any that start with "Copy of" so for example i have hello Copy of hello hello2 Copy of images another folder at the moment i would get hello Copy of hello hello2 Copy of another folder when what i acctually want is hello hello2 Copy of another folder get the idea? cheers matt
  12. i tried that yet it still has the same effect
  13. hi guys well im trying to use this, <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Title here</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body id="altbody"> <div id="wrapper-header"> <div id="header"><img src="/Night Games/images/banner.gif" align="left" /></div> </div> <div id="wrapper-menu"> <div id="menu"> <ul> <li><a href="#">link1</a>a></li> <li><a href="#">link2</a>a></li> <li><a href="#">link3</a>a></li> </ul> </div> </div> <div id="content"> <div id="center"> <div id="centerhead"> <h4>Title here</h4> </div> <div id="centercont"> </div> </div> </div> <div id="footer"> | © Name here</div> </body> </html> and body { margin: 0 0 1em 0; padding: 0; color: black; background-color: #eee; line-height: 130%; text-align: center; } #wrapper-header { background: #222; } #header { background: #222 url('images/banner_back.gif') right repeat-x; width: 100%; height: 150px; line-height: 125px; margin: 0 auto; border-left: 1px solid #707070; border-right: 1px solid #707070; text-align: left; } #header h1 { margin: 0; padding: 0; color: #eee; font-size: 220%; padding-left: 10px; letter-spacing: -1px; font:Comic Sans MS; } #wrapper-menu { background: #88ac0b url('images/menu-background.png') top left repeat-x; float: left; width: 100%; } #menu { width: 75%; margin: 0 auto; font-size: 95%; white-space: nowrap; /* stops half a menu link dropping to next line. Instead, the whole link will drop. This only happens if you have a lot of menu links, and large text size */ padding-right: 2px; /* The menu far left, and far right borders are not quite lining up in non IE browsers for some reason. This makes it less noticable */ } * html #menu { padding-right: 0; } /* See above comment. This re-adjusts IE to the above padding */ #menu ul { margin: 0; padding: 0; list-style: none; float: left; border-left: 1px solid #95bc0e; border-right: 1px solid #95bf0f; width: 100%; } #menu li { display: inline; } #menu a:link, #menu a:visited { padding: 0.25em 1em; background: transparent; color:#FFFFFF; text-decoration: none; float: left; border-right: 1px solid #95bc0e; } #menu a:hover { background: #b6e41c url('images/menu-hover.png') repeat-x; color:#CCCCCC; } #content { width: 73%; /* 73% because it has 1% padding on each side, which brings it to 75% wide */ margin: 0 auto; padding: 3.5em 1% 20px 1%; border-left: 1px solid #bbb; border-right: 1px solid #bbb; background: white; font-size: 90%; text-align: left; } * html #content { padding-top: 1.8em; } /* Set padding top in IE to 20px */ #footer { margin: 0 auto; padding: 2px 1%; width: 73%; text-align: right; color: white; letter-spacing: 0.15em; background: #88ac0b url('images/menu-background.png') top left repeat-x; border: 1px solid #a0c80e; font-size: 80%; } #center { margin: 0 auto; width: 90%; background-color:#FF0000; border: 1px groove #a0c80e; font-size: 80%; border:double; } #centerhead { margin: 0 auto; padding:0; width: 100%; background: #FF0000 url('images/menu-background.png') top left repeat-x; border: 1px solid #a0c80e; } #centerhead h4 { color:#ffffff; padding:0; letter-spacing: -1px; } #centercont { margin: 0 auto; width: 100%; background-color:#DFDFDF; font-size: 80%; } #footer a:link { color:#333333; font-weight:bold; } #footer a:hover { color:#333333; font-weight:bold; font-style:italic; } h2 { color: #666; padding-bottom: 3px; border-bottom: 1px solid #a0c80e; font-size: 150%; letter-spacing: -1px; } a:link, a:visited { color: #260; text-decoration: none; } a:hover { color: #000; text-decoration: underline; } p { margin-left: 1em; } which works fine except for well (see screenshot) http://www.phpfreaks.com/forums/index.php?action=dlattach;topic=182876.0;attach=3835;image it creates a extra line underneath the title bar, the moment i remove <h4></h4> its perfect, any ideas? one other random thing but is it jsut me or has the php freaks logo gone byebye?
  14. hi guys i have this <div bgcolor="#999999" class="chat" height="100px" style="overflow:auto"> however no matter how much content is contained it will not overflow the div simply extends, any ideas?
  15. Hi guys, im trying to install wamp on our school server however the problem is that we also already have a webserver setup on the same computer which means that that server is catching any requests to the webserver, how would i make it so that for example localhost/ connects to the original server and localhost2/ would connect to the wamp server? cheerrs matt
  16. hi guys, well i develop mostly in firefox and jsut tried my website in ie and am getting something strange... this explains it
  17. whats the corect thing for this, if (!$stop = "true") { }
  18. i cant be bothered counting but is there 256 \n's ? if it is im gueesing it has something to do with the "annoying ie bug" line
  19. Hi guys i have this code... <?php global $database; $q = "SELECT cName FROM " . gsubcat . " ORDER BY `cName` ASC "; $result = $database->query($q) or die("Error: " . mysql_error()); /* Error occurred, return given name by default */ $num_rows = mysql_numrows($result); while( $row = mysql_fetch_assoc($result) ) { $cat1 = $row[cName]; $cat2 = $row[cName]; if ($cat1 == "Action / Adventure") { $cat2 = "Action"; } elseif ($cat1 == "Shoot em up") { $cat2 = "Shoot"; } elseif ($cat1 == "Beat em up") { $cat2 == "Beat"; } else { $cat2 = $cat1; } ?> <div class="cntttl"> <div class="cntbox"> <div class="cntbox_head"><div><table cellspacing="0" width="100%"> <tbody><tr> <td><h1><?php echo $row[cName]; ?> Games</h1></td> <td class="blockheaderlink"> <a linkindex="72" href="catcontents.php?cat=<?php echo $row[cName]; ?>">More <?php echo $row[cName]; ?> Games <img src="images/more.png" align="absmiddle"></a> </td> </tr> </tbody></table></div></div> <div class="cntbox_cnt"><?php include("scripts/$cat2.php"); ?></div> <div class="cntbox_foot"><div><div></div></div></div> </div> </div> <?php } ?> which works perfectly except for one thing, the Beat em up elseif statment is having no effect, the action adventure one and shoot em up are but the beat em up is not i should get Beat.php but instead im getting Beat em up.php, |ay ideas?
  20. hi guys i was wondering is it posasible to have a function with a variable name? like $cat1 = "abc"; function $cat1() cheers
  21. hmm thats a problem, because what i am trying to do is i have a column called time, which contains the time it was inserted (duh) anyway i want to delete the oldest result if there are more than 20 so thats why i wanted order by time
×
×
  • 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.