Jump to content

Checking Browser


phpnoob

Recommended Posts

I have a browser checking code and i lf a smaller versionBut first, i want to tell something.I have a nice drop down menu in my website and the base idea is, when somewhere you are, the menu marker where you are.for examplei go to index.php?page=game&date=2012-01 , then in menu marker Game >>> 2010 >>>> 01, and this php code wanted to marking the years.And yes the $date give only years, no month number.

if ($_SERVER['PHP_SELF']=="/index.php" and $_GET['page']=="game" and $_GET['date']==$date.'-01' or $_GET['date']==$date.'-02' or $_GET['date']==$date.'-03' or $_GET['date']==$date.'-04' or $_GET['date']==$date.'-05' or $_GET['date']==$date.'-06' or $_GET['date']==$date.'-07' or $_GET['date']==$date.'-08' or $_GET['date']==$date.'-09' or $_GET['date']==$date.'-10' or $_GET['date']==$date.'-11' or $_GET['date']==$date.'-12')

Link to comment
Share on other sites

where have you been stucked?

Link to comment
Share on other sites

where have you been stucked?
did you see the code? its hude, i have to type all month 1-12and $_GET['date']==$date.'-01' or $_GET['date']==$date.'-02' <----i want to remove this, but how? if no '-01' then the code stop working, the browser is like thiswww.websiteaddress.com/index.php?page=game&date=2012-01 and if i put only$_GET['date']==$date <---"2012", then no find i need that -01 to -12 for find it :(
Link to comment
Share on other sites

echo substr($_GET['date'],0,strrpos($_GET['date'],'-'))

it will return the last day part of the date You can check it in if-else that it is beetween greater than 0 but lesser than equal to 12 http://php.net/substrhttp://php.net/strrpos

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...