If Else Statements To Compare Current Day And Current Month
I am attempting to make a way so that my users have to be 13 years old in order to register, is there any easy way to do this, or am i coding 3 if else statements to compare current day and current month, and current year to the posted y/m/d?
View Complete Forum Thread with Replies
Related Forum Messages:
Selecting Current Month In Month Select Dropdown
I have set up a simple dropdown to list all the months a year from now and for the past year, so form July 2006 - Jun 2008. However, I am looking to have the current month as the selected option when the user first sees the page. Any ideas on how to do this? Code:
View Replies !
Month Selection Dependant On Current Month
Basically I'm using a combo box to allow a user to select a month to see accounts stats for that month, so at the moment I am using the script below which will display all months up 1 less month than the current month (as obviously months after this do not have account details yet) However I want to allow the user to have a full 12 months to select from so if the current month was Feb 06 they could see Feb05, march05,April05.... up to Jan06... PHP Code:
View Replies !
Select Using Current Month
I run a website with a news posting part to the site (news from a few members not current affairs). It has occurred to me that the collection of Next & Prev links at the bottom of the viewing page has started to get rather large. This is probably because it generates links for every 4 posts that are in the database (4 articles are shown per page). What i would ideally like to do is be able to show all posts from the current month in the main page and have an archive page that shows the rest. Now heres the prob that i have run into. I store the date for each of the posts in a datetime field. When this is selected from the mysql query i format it to make it look like an English time (Rather than the time that the server shows). Now im not too sure what sort of query to use.
View Replies !
Compare Dates With The Current Date
I have two mysql DATA (YYYYMMDD) fields, and i want to compare them with the current date on my webserver. I want the current date to be belong DATE in the interval made by my two mysql fields. Code:
View Replies !
Convert Current Datetime Format To The Month And Date?
Right now, the following script pulls out the next three events from my SQL table and then displays them as: Datetime - Event Name (of course, with the appropriate information). Everything works GREAT on it, but she doesn't like the date format. She wants it to display the month and date only (i.e. July 22). How do I convert my current datetime format (normal mySQL datetime format) to the month and date? Code:
View Replies !
Strtotime("-1 Month") Returns Day 1 Of Current Month
I ran this code today (October 31st, 2006) expecting it would return `9/2006` <?php echo date("m/Y", strtotime("-1 month")); // returns 10/2006 ?> Instead it returned `10/2006` and upon further investigation strotime("-1 month") is actually just rolling back to day one of the current month. <?php echo date("m/d/Y", strtotime("-1 month")); // returns 10/1/2006 ?> I wasn't expecting this behavior, and it somewhat broke the logic of a "expired credit card" validation I had on one site. It's pretty disturbing that I completely missed this in testing. :/
View Replies !
Get The Current Url
I need to get the current URL that is in the client browers anyway with PHP to do this? I'm checking the http:// part I want to see if they are useing http:// or https://. Or is there another better way to do this (from apache?, htaccess files?)
View Replies !
Getting Current URL
Is there a way to get the current URL when a page loads and then take it apart to decide which images display. So this URL: http://www.domain.com/Company_Infor/index.php could be taken apart so that it picks up the "Company_Information" or the first folder, since that's what it is. that way you coud run an if statement on it to decide which images to display?
View Replies !
Getting The Current URL
I am trying to have all traffic to my website go through the same index page and then have the page they are looking for be the one that gets loaded. I want to do this by taking the "location" part of the URL they just connected to (http://www.mysite.com/location). But how can I get the "location" part of the URL?
View Replies !
ID Before Current ID
get the very first record before a given record. I know I could get them all in an ordered array, find the record given, then choose the array just before it, but that seems sort of inefficient. i.e. I have a table with an 'id' column that is auto_increment. I have a list ordered by 'id' ascending. What I am wanting to do is to create a "move up" and "move down" link. I was initially thinking just to increment or decrement the ID by one and swap the rows. This obviously wont work once an ID is skipped or deleted from the contiguous range.
View Replies !
Get Current GMT
I have experience with the time() and date() functions, but they return the time on my server. What's the best way to get the unix-epoch timestamp for GMT time. i'm doing something like this: PHP Code: $now = time(); $utc_time = $now - intval(date('Z', $now)); echo 'NOW:' . date('m d, Y a H:i:s', $now) . '<br>' echo 'UTC TIME:' . date('m d, Y a H:i:s', $utc_time);.
View Replies !
Current Function Name
Is there a way to find out the name of function currently being executed? I know there is a constant for the current line being passed ... but for current function?
View Replies !
What Is The Current Filename?
I think I'm missing something obvious, but I didn't spot this searching the PHP.net site. I just want a php function or variable to tell me the name of the file in which I (the code being interpreted) currently am. The PHP interpreter knows because if there's an error, it displays the exact filename. In particular, if it's an included file, I want to know its (the included file's) pathname.
View Replies !
How Can I Get URL Of Current Page
I went through and searched the PHP manual, and didnt find what i was looking for. I am a PHP newby obviously. On to my question, I was just curious, is there a php variable that calls on the URL currently in the address bar? I am writing a php script to redirect a user, depending on what domain the page was accessed from. Any assistence would be GREATLY appreciated!
View Replies !
Capture Current URL
I am writing a simple PHP contact form. The form is in an include that will be in the header of every page in the website. When the form is submitted I want the user to be returned to whichever page they came from. Therefore in the <form action="" method="post"> i want the action="" to point to the URL that the user is currently on...
View Replies !
Current Url In Variable?
I have a script I am using as an include in many sites. It pulls info from a database and displays ads. Now every site that this is displayed on has an ad in the database and I dont want anyones ads showing on their own site. I wrote this. $current = $_SERVER["HTTP_HOST"]; $current = $_SERVER['PHP_SELF']; $lin = mysql_query("SELECT * FROM link order by id asc", $link) or die ("query 1: " . mysql_error()); echo '<li><h2>LinkWork</h2>' . '<ul>' while ($li = mysql_fetch_array($lin)) { if ($current == $li['base']) { echo '' } else { echo '<li><a href="'.$li['web_url'].'" alt="'.$li['alt_tag'].'">'.$li['display'].'</a></li>' } } The column base, is the base of a url eg. #*$!.com So that is what I need to find, a php variable that gives me the current pages web address, but only up to the end of the com or org.
View Replies !
Current($velden)
I've got a problem with this script. I want that for example array "c" becomes a <textarea>, not a "<input type=text>". A friend told me to use switch and then it should work, only, I've tried a lot, but it still doesn't work. Can somebody help me out here ? <? $velden= array("a","b","c","d","e","f"); echo "<form method=post>"; while (current($velden)) { echo current($velden).": <input type=text name=".current($velden)."><br>"; ; next ($velden); } echo "<input type=submit>"; echo "</form>"; ?>
View Replies !
Rand( ) And Current ( )
I want to randomly display images on a page. In addition, I need to know the name of the current random image.My questions are: What is the best way to display random images? I've seen support for both storing file names or paths in a db and using a query like PHP Code:
View Replies !
How To Determine Current URL In PHP?
Is there a way that I can determine the current url/location (like the 'location' variable in javascript)? For example, if I'm at http://mysite.com/index.php, is there perhaps a fixed variable containing 'http://mysite.com/index.php' already available, or is there a function available to retrieve it? I want to use this to log certain hits on my site, so it would be nice to have a way to do it all in one page rather than integrating information sent with the help of javascript from another page.
View Replies !
Current Directory
Anyone know that how to find the current directory's name in php? I need the php automatic to find its current directory's name.
View Replies !
Current Folder
Does anyone know easy way to find out the current folder where the script is? I tried to this but it doesn´t work in my Linux web-server, but it works in NT-desktop. $dir1 = getenv(PATH_INFO); $last = strrpos($dir1, "/"); $dir2 = substr ($dir1,0, $last); $name = strrpos($dir2, "/"); $folder = substr($dir2,$name+1,20);
View Replies !
Current Class Name For Use With ::
assuming the following class structure: class A { public function printConst() { print {something}::TEST_CONST; } } class B extends A { const TEST_CONST = 10; } class C extends A { const TEST_CONST = 20; } So, I want to be able to do as follows: $b = new B(); $b->printConst(); $c = new C(); $c->printConst(); What I want to know is what should go instead of {something}. I don't want the class it's declared in, but the class it's being called from. I'm sure there's a way to do it, I remember reading it when studying for the ZCE
View Replies !
Current Date In Php
I have a fresh installation of PHP 5.0.4, ISAPI module , on a win2003 with IIS 6.0 and mssql 2000. When I query MSSQL using "mssql_query( )" function using the following: "INSERT INTO DATES (date) VALUES ({ fn CURDATE() })" The value <null> is writen on the date field of table DATES. Does anyone have a logical explanation for this?
View Replies !
Current ID On A Header
My problem is that I went to using a header.php and I am including it on my index.php main page. So therfore i will not have to make changes to everpage but just the one header.php page. Here is my code I used to have that also has a .css file that underlines the selected link. Code:
View Replies !
Get Current Document Name?
I would like to retrieve the current document name and store it in a variable. Example: I am at page http://www.home.com/currentinfo.php. I would like to take the string 'currentinfo.php' and assign it to a variable. Is there any PHP function or global variable that can do that?
View Replies !
A Way To Get Current Background?
I have several websites running on a global script. Some pages, the backgrounds black, other, white. Sometimes people have the taste of posting black font on a black background, or white font on a white background. What I wanted is to know if theres a way to 'check' the current background color? Because I can then add in the script to 'change' any incorrect colors before posting. I'm not sure if theres a way for PHP to tap into CSS and check, but it would be alot easier to change the global script since its *Checking* for the background color rather then me do it per site and change it manually.
View Replies !
Getting Current Directory
how can I change this code so that the values ire not hard coded? Specifically, I want to replace the '/domains/321/4567/html' string to take it straight from the current dir. <?php putenv('QUERY_STRING=baseBusiness=clientsdata'); putenv('DOCUMENT_ROOT=/domains/321/4567/html'); putenv('REQUEST_URI=/cgi-bin/mainpage'); list($header, $lines) = preg_split("/ /", `/domains/321/4567/html/cgi-bin/mainpage`, 2); echo $lines; ?>
View Replies !
Current Session Id
#-----i started a session on an index page---------# session_start(); my problem is that every link in my site has a current session id added to it. e.g. i get http://domain/?main_menu=colleague_find®ister=colleague_manage_auth&"PHPSESSID=5a98d947c8991db727d7cd235ca2da3c" instead of: ?main_menu=colleague_find®ister=colleague_manage_auth. without destroying a session.
View Replies !
Current Date
I need to pull from two tables where the regdate is less than the current date and where the sum of table 2 column tpcount is less than 2. select cust.name, cust.regdate, sum(followup.tpoint) as counts from cust,followup where cust.id = followup.id and regdate < curdate() and tpcount < ƈ' group by name;
View Replies !
Getting Current Date
I am trying to get the current date/time in PHP in this format: 20070320091012 and then I am trying to add $minutes and $seconds to it something like: $timeNow = getdate();? -- I know this is wrong, how to do it? $timeLater = $timeNow + $minutes + seconds; where $minutes can equal 2, 3 or 4 for instance and $seconds can equal 15, 30 or 45 for instance. how would I do this in PHP? thanks
View Replies !
Get Current Directory
how I can get the directory info a script is running in. For example, when I create a directory in my document root like: /home/username/public_html/mydir/ and place phpinfo.php in it, I can read from ENV or SERVER globals the script name $_SERVER["SCRIPT_FILENAME"] = "/home/username/public_html/mydir/phpinfo.php"; , but not the current directory name. How can I get this info?
View Replies !
Get Current Time
How to get a current time from PHP time() function : When i did $my_current_time=time(); echo $my_current_time; it returns 1189757415 as the result. How to get in hour:min format. i didnt find any help from PHP manual.
View Replies !
Getting And Using Current Page URL
could some1 please help me withg etting and using the current page url. I have a function that gets the url, I want to use it with header(location : XXX) but it wont work. The code is as follows: Code:
View Replies !
Find The Current URL?
I need a simple bit of code for the following. I'm testing a site offline at http://localhost/sites/examplesite/index.php This problem is that I have to use full URL's in every link, I can't just do <a href="page.php">Page</a>. So there's a problem when I come to upload to the server since all the links will point to localhost. I tried: <a href="<?php $_SERVER['PHP_SELF']; ?>/index.php" >Home</a> That code only finds the domain name and not the subfolders it's in. I don't know much PHP, but I need something simple like that if it's possible so that the links will work when I upload it.
View Replies !
Passing Current Url
i have a tell a friend script (pop up window), but i want to send the current location (url)to the script as a veriable. i tried php self and other functions but it didnt send the current veriables to the script (only /script name).
View Replies !
Capturing The Current Url
I know there's a way to do this, but it slips my mind. Is there a way to get the current url? Something other than $PHP_SELF? Because php self only returns the current file, I need the whole thing, from http: onward.
View Replies !
Current Row Number
When we click a thumbnail we can see the foto with bigger dimensions. And the idea is creating navigation buttons there (previous - next). For that in the new page i need a new query, all i have is the active image ID. So who do i make the new query? something like: "SELECT * FROM TABLE LIMIT $id, 1" doesn't work, because the id is not the row number. Is there a way to find the exact row number of a record in a certain query????
View Replies !
|