Lost Password?


Go Back   CodeCall Programming Forum > Web Development Forum > PHP Forum

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-10-2008, 12:34 AM
Whitey's Avatar   
Whitey Whitey is offline
Programming Professional
 
Join Date: Feb 2008
Location: Loveland, Colorado
Posts: 225
Rep Power: 6
Whitey has a spectacular aura aboutWhitey has a spectacular aura aboutWhitey has a spectacular aura about
Send a message via AIM to Whitey Send a message via MSN to Whitey Send a message via Skype™ to Whitey
Default How to start this?

Okay well i have a new upload site i been working on for a few days. Has my login/register system and my upload system. When you register it makes you, your own folder chmod to 755 and the folder has the name you registered with on it. So when you upload it uploads to your folder.

So here is an example.
Index of /whitey

That shows your uploads in your folder.
Well i am going to make a PHP script in the folder that shows all the users images.. (limits 20 per page) but the thing is how to make it show all the images in the folder.. Decending by date..

If you could help me start this that would be great..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 06-10-2008, 07:45 AM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,433
Last Blog:
Google Web Toolkit
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default Re: How to start this?

I do not believe the file has an attribute of when it was created - it does have an attribute of when the file was last accessed and last written to (PHP: fileatime - Manual and PHP: filemtime - Manual ). The first thing that jumps out at me is to use a database. Store the file name, date it was created, and any other pertinent information regarding the image in the database. With SQL you can use ORDER BY on the date created column and you are pretty much done - you can even add a LIMIT 20 to only show 20 images. The other possibility is to store a timestamp as part of the images name: untitled-1213098600.jpg. Then just sort by the timestamp.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-10-2008, 08:42 PM
Whitey's Avatar   
Whitey Whitey is offline
Programming Professional
 
Join Date: Feb 2008
Location: Loveland, Colorado
Posts: 225
Rep Power: 6
Whitey has a spectacular aura aboutWhitey has a spectacular aura aboutWhitey has a spectacular aura about
Send a message via AIM to Whitey Send a message via MSN to Whitey Send a message via Skype™ to Whitey
Default Re: How to start this?

someone gave me this code
PHP Code:
<?php
//Open images directory
$dir = @ dir("/images/icons/");

//List files in images directory
while (($file $dir->read()) !== false)
  {
 
$imagelist[$i] = array('filename' => $file 'lastModified ' => filemtime('images/icons/'.$file)); 
 
$i++;
  }
  
print_r($imagelist);

$dir->close();
?>
But it doesn't really seem to work. And i dont really understand it

P.S The upload has nothing to do with a database

Last edited by Whitey; 06-10-2008 at 09:02 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-10-2008, 10:50 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,433
Last Blog:
Google Web Toolkit
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default Re: How to start this?

Quote:
Originally Posted by Whitey View Post
P.S The upload has nothing to do with a database
Perhaps it should. As mentioned in my previous post, without manually logging it, I'm pretty sure it is impossible to get the creation date of the file.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-10-2008, 11:33 PM
Whitey's Avatar   
Whitey Whitey is offline
Programming Professional
 
Join Date: Feb 2008
Location: Loveland, Colorado
Posts: 225
Rep Power: 6
Whitey has a spectacular aura aboutWhitey has a spectacular aura aboutWhitey has a spectacular aura about
Send a message via AIM to Whitey Send a message via MSN to Whitey Send a message via Skype™ to Whitey
Default Re: How to start this?

I figured a way around it with a help of a friend.. i will post what i did later.. atm i need help at something else..

okay so i do
PHP Code:
$_SERVER['PHP_SELF']; 
gets /upload_script/whitey/home.php

but i want to strip the home.php.. so it shows /upload_script/whitey/ If you guys figure out how to do this before me let me know...

EDIT:
FIgured it out.. To fast for you
PHP Code:
$address_url $_SERVER['PHP_SELF'];
        
$address_url_new str_replace("home.php"""$address_url);
        die(
$address_url_new); 

Last edited by Jaan; 06-11-2008 at 01:13 PM. Reason: Please use tags when you're posting your codes!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 06-11-2008, 07:43 AM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,433
Last Blog:
Google Web Toolkit
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default Re: How to start this?

PHP Code:
dirname($_SERVER['PHP_SELF']); 
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog
Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 06-12-2008, 01:54 PM
Xav's Avatar   
Xav Xav is offline
Code Warrior
 
Join Date: Mar 2008
Location: On God's Planet
Posts: 9,583
Last Blog:
Web slideshow in JavaS...
Rep Power: 76
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Default Re: How to start this?

There seems to be an endless stream of predefined PHP functions, for everything! I wouldn't be surprised if there was a function called ShowTheUsersImagesMostRecentTwentyImages().
__________________


Mr. Xav | Website | Forums | Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 06-13-2008, 07:28 AM
ReekenX's Avatar   
ReekenX ReekenX is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 79
Rep Power: 7
ReekenX is on a distinguished road
Send a message via Skype™ to ReekenX
Default Re: How to start this?

Why you do not using database? It's more secure and when you decide add some functions (features) you will see that it was good idea to use database system.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 06-14-2008, 02:01 AM
Whitey's Avatar   
Whitey Whitey is offline
Programming Professional
 
Join Date: Feb 2008
Location: Loveland, Colorado
Posts: 225
Rep Power: 6
Whitey has a spectacular aura aboutWhitey has a spectacular aura aboutWhitey has a spectacular aura about
Send a message via AIM to Whitey Send a message via MSN to Whitey Send a message via Skype™ to Whitey
Default Re: How to start this?

Yeah i understand that but this is the way i started it. I will be probably making a version 2 for that some other time.. But i am coding in all different aspects for learning purpose's so if i run into something like this later i will know how to do it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 06-14-2008, 09:10 AM
ReekenX's Avatar   
ReekenX ReekenX is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 79
Rep Power: 7
ReekenX is on a distinguished road
Send a message via Skype™ to ReekenX
Default Re: How to start this?

ShowTheUsersImagesMostRecentTwentyImages() - short and self describing name
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows XP Tricks & Tips!!!!..new ones. pranky Tutorials 9 08-23-2008 04:22 PM
What arrays and pointers have in common - or - Why arrays start at zero Kernel Programming News 0 05-07-2008 08:36 AM
C++: How should you start learning it? WingedPanther C Tutorials 8 03-25-2008 01:24 PM
IRC: Where do I start? I like pie General Programming 1 04-27-2007 12:34 PM
Start a free domain service xtraze Hosting and Registrars 8 01-11-2007 12:35 AM


All times are GMT -5. The time now is 05:03 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59