gueriza
07-31-2002, 12:54 AM
Hello...can someone help me about "pic of the day" script ?
I want to put the script in the index page..that is also clickable to a larger image. Also it would be nice if there is an upload script so anyone can upload their pics also...any help will be very valuable...thanks in advance
Regards
IKinsler
07-31-2002, 05:45 PM
To upload, it is a simple method of using copy(). The first attribute is the file uploaded, and the second is where you want it to go. BUT, when you specify where you want it to go, you MUST place "_name" after the variable of the file:
copy($File_Submitted, "pics/$File_Submitted_name");
Now, for the Pic-Of-The-Day, I would suggest MySQL. If you set up a table called "pidofday," you could make two columns - one named "date," one named "image."
Make enteries like:
date: July 31, 2002
image: image1.gif
date: August 1, 2002
image: other.gif
Then, put this script on your page:
<?php
mysql_connect("localhost", "user","pass");
mysql_select_db("your_db");
$today = date("F j, Y");
if ($query = mysql_query("select * from picofday where date = '$today'")) {
$both = mysql_fetch_array($query);
echo "<img src='" . $both["image"] . "' />";
} else {
echo "Error in finding image.";
}
?>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.