![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
john010117
-
Posts
492 -
Joined
-
Last visited
Never
Posts posted by john010117
-
-
Can you please post the updated code? From what I can tell about the code you've posted, you don't have $limit defined.
-
Are you echoing the variable?
-
You'll need to have a table that has each individual sessions in it, and the script will need to update the database every time a user goes to another page with the page name and the time.
-
Put:
if(isset($_POST['send']))
in place of if($_GET['send'])
-
Try using htmlentities() also.
-
"Edit" -> "Go to". I think.
Or, use another notepad.
Google Programmer's Notepad 2
or
Notepad++
-
<?php header("Content-type: text/css"); ?> /* Rest of your CSS stuff goes here*/ body { background-color: <?php echo $bgcolor; ?> }
Save it as something.php and you can call it from another file. That way, you can put variables into external stylesheets.
<html> <head> <link href="something.php" rel="stylesheet" type="text/css" /> </head> </html>
-
Oh right so you can add PHP/Variable into stylesheets?
Thats excellent! Thanks I can add a lot of customisation using that method!
Thanks
Only stylesheets that are embedded in .php files. NOT external stylesheets.
-
Or you could just embed stylesheets into PHP documents
Ex:
<html> <head> <title>Style</title> <style type="text/css"> body { background-color: <?php echo $bgcolor; ?> } </style> </head> <body> Hi </body> </html>
-
Of course. Make sure you have different stylesheets for PHP to pick. After all, you can't put variables into stylesheets.
-
No problem. If you get stuck on any part of your code, post the relevant part of the code, and we'll be glad to help.
-
I believed you answered your own question. Let a user submit the color of the page into a database (a simple script should work that part out). Then, whenever that page loads, do a query on the database, and do a simple if/else statement to select the right stylesheet.
-
Use these two functions on all of your variables ($_POST and $_GET):
addslashes() and htmlentities()
If you expect a variable to be a number, use the function is_numeric()
If the script throws an error when a variable is empty, use the function empty()
-
Yes. Thanks.
-
Oh, I should've added that it's for localhost. Sorry about that.
-
Does anyone know of a good, reliable mail client that works with WAMP? I only need a client that can send e-mails (don't need to receive them - need it for websites that I design to send out activation e-mails). Thanks.
-
If it is solved then that's a neat trick.
It's Jan 6th, 2008 and I'm 58.
But I could have become 58 today or I might become 59 tomorrow.
So all you know is that I was born sometime between Jan 7th 1949 and Jan 6th 1950
Yes, I'm aware of that fact. Just knowing how old someone is doesn't give you the exact birthdate.
-
In your original code, I don't see an else statement anywhere. I see an elseif statement, though.
-
<?php $webarray = array("http://www.site1.com", "http://www.site2.com", "http://www.site3.com", "http://www.site4.com" ); $rand = rand(0,sizeof($webarray)); header( 'Location: '.$webarray[$rand]) ; ?>
-
Ok, thank you both of you. I believe I got it.
-
The mysql manual contains an AGE calculation example -
http://dev.mysql.com/doc/refman/5.0/en/date-calculations.html
Thanks for the link.
Depending on php version and operating system, a UNIX timestamp cannot be used for ages because it cannot represent dates before 1970.
Hm, then what would be a better way to store date of births?
Well with the WHERE clause, what column are you using?
The logic is: select users from the users table where the user's age is greater than (or equal to) time() minus $age1 and less than (or equal to) time() minus $age2. Right?
That wouldn't be it because I have date of births stored in the database, not ages.
-
Hm... I'm not very familiar with doing math inside queries... will it be something like this? (Assuming that "dob" is the field name and
$age1
and
$age2
are the submitted ages)
<?php $query = 'SELECT * FROM users WHERE ' . time() . ' - dob > ' . $age1 . ' AND ' . time() . ' - dob < ' . $age2; ?>
-
So that means I'll have to first SELECT every record from the database and check each record using your method?
-
First of all, I've scoured Google, but they only gave me how to calculate age by given birth. I need the opposite.
So, here's the thing. I have a pretty simple site that has the basic user database, and a search engine. When a user registers, their date of birth (that they have provided) is converted into a UNIX timestamp and is stored in the database. Now, the search engine is designed so that a user can give a range of ages to search for (ex: can find all users between the ages of 18 to 30). Since I have users' date of birth stored in the database, not their ages, how will I design the script to work?
Will converting the given ages to UNIX timestamps first, then using MySQL's "<" and ">" operators to search the database work? Or is there a different way?
filepile.ca
in Beta Test Your Stuff!
Posted
Uh oh. Try looking at the file list now in the account that you gave us. Better fix somethings. (I just typed in "><script>" (without quotes)