Jump to content

Create Page using PHP


Warptweet

Recommended Posts

Hi there. My website has a file uploading system, which people can upload their games. The only thing is, once they upload their game, they cant download or see it on my website!

My website is as of now incomplete. I need a way so that my downloads page lists ALL the uploaded files in my /uploads directory, BUT, I need another thing...

I need a code to MAKE a brand new page, for EACH and EVERY uploaded file in the /uploads directory. For instance, newgrounds.com, it creates a page for EACH and EVERY flash file uploaded to their website, with a downloads link. How can I do this?

Anyone have a tutorial for php page creation like this?
Link to comment
Share on other sites

[code]
<?php
$filename = $_POST['filename'];
$newfile = fopen("/uploads/$filename.php", "x");

if($newfile){
echo "$filename.php created";
}else {
echo "failure";
}
?>
[/code]

If the file exists it wont do anything, if it doesn't PHP will try to create it.
Link to comment
Share on other sites

[quote]So this is somewhat different.[/quote]

No it isn't. The concepts are much the same. A big part of learning to program is learning to think about solutions based on simular problems. You'd be suprised how much stuff is simular.

Think of it like this. Normally a [i]profile[/i] page might display info about a certain user. Instead, you want it to display info about a certain file. Its really no different.

The first thing you need to do is creeate a table to store the names of your files along with the location they are stored at. Once this is built you have a script which updates this database everytime a file is added.

Next, you need a page which lists the names of all these files as links to there respective pages.

Then, on the pages themselves you can create the download links.

Its the same basic concept, you just need to think a little differently.
Link to comment
Share on other sites

Yes... but, I need the following:

A way to make a form with the following possible entries:

Download Link:
Screenshot Link:
Author:
Description:

------------------------------------
And after they click the submit button, it will submit the data to a database or make a php file or something.
Of course, I have a .com website and have unlimited databases available, support php and many more codes.

So I wont mind if somebody gives me a code that uses mysql or anything.
BUT, I also need a code that creates a table on the downloads page:

Game  l  Author
          l
          l
          l
          l

The "Author" will take the name of the creator which was submitted, and display it.
The "Game" will create a link to a download page that is automatically created, which will display the "Download Link" which was added at the form I stated before, the download page will also display a screenshot by using the link to the screenshot image in the "Screenshot Link" field I stated above, and the download will also display the Author of the game again, and the Description aswell which would be submitted at the "Author" and "Description" field that I said above.

Does anyone have a code for this?
I'm quite sure this has been done many many times, simply storing information.
By the way... I'm not asking for an uploader. The "Game Link" can be attached to the same file storing the "Game Link" "Screenshot Link" "Author" and "Description", which can probably be stored as variables, and recalled.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.