Jump to content

PHP & mySQL Help.


GiTMApostle

Recommended Posts

Here's the thing. I do not know much about PHP but would like to learn. However I would like some help with a problem I am having..

I would like to have an 'file upload' script where only I can upload files.. meaning have a user name and password. I would like the file type to be limited to files with the exstenion ".rep" and once they have been uploaded I would like them displayed in a table on the webpage with the information I uploaded them with, example of form information:

Player 1
Player 2
Map
Download

In the table I would like them to be downloadable from clicking on a link under the "Download" row. So to have them displayed there in order from oldest on the bottom and newest on the top would be great. I dont really care about having more than 1 page if it helps me get this done sooner.

So could someone point me in the right direction? I'm killing myself over this :(
Link to comment
Share on other sites

That's a long wish list for not knowing PHP. I would suggest trying to find something off the shelf that you can tweak, maybe from hotscripts.com. I don't think you're going to get anyone here to give you chucks of pre-written code, tailor made to your request. Sorry.
Link to comment
Share on other sites

Here is a sample upload script...  

[CODE]
<table width = "500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form action="multiple_upload_ac.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td><strong>Multiple Files Upload</strong></td>
</tr>
<tr>
<td>Select File: <input name="ufile[]" type="file" id="ufile[]" size="50" /></td>
</tr>
<tr>
<td>Select File: <input name="ufile[]" type="file" id="ufile[]" size="50" /></td>
</tr>
<tr>
<td>Select File: <input name="ufile[]" type="file" id="ufile[]" size="50" /></td>
</tr>
<tr>
<td align="center"><input type="submit" name="Submit" value="Upload" /></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
[/CODE]

This is the form.. and next will be the processing part of it...

[CODE]
<?php
echo $HTTP_POST_FILES['ufile']['name'][0];
echo "<br>";
echo $HTTP_POST_FILES['ufile']['name'][1];
echo "<br>";
echo $HTTP_POST_FILES['ufile']['name'][2];
echo "<br>";
?>
[/CODE]

This is a simple way to do it...  I haven't actually tested this code yet as I got it before I actually needed it..  You may have to throw some mysql queries into the second file to make the file location and name etc be entered into a database.. then on the output you would query the database again requesting the url of each download and parsing them out using something like this

echo "<a href=\"'$file'\">Download 1</a>";

and it's really that simple.. as far as the login there are tons of login script examples which will also help you get familiar with php and mysql -- in fact in the tutorials section on this site i believe there is a login example.. if you cant find it let me know and i'll post one...
Link to comment
Share on other sites

Simplify your life. If you are the only person able to upload files and you want to restrict them to a particular type, then use FTP or your File Manager to move them to your site.  You'll have that working in a minute - must faster then implementing some password protected file uploader script.
Link to comment
Share on other sites

[quote author=AndyB link=topic=105879.msg423132#msg423132 date=1156732203]
Simplify your life. If you are the only person able to upload files and you want to restrict them to a particular type, then use FTP or your File Manager to move them to your site.  You'll have that working in a minute - must faster then implementing some password protected file uploader script.
[/quote]

I wish I could simplify my life..  Though with the project I am working on it's impossible to simplify it any more than I already have without using pre-made code...  My tutorial site I'm coding everything -- forums included..  It's proving to be a pain in the ass but oh well thats okay... 

Working on the admin console right now --- plus i'm using a template engine that I ended up re-writing to make work and so yeah..  simplify my life seems impossible at this point.. though for this guy -- seems like a valid idea...
Link to comment
Share on other sites

Yeah; I can do the file upload via FTP easily but I would still like a page where the information (files) are displayed in a table.. Other then that it's cool. :D I also am not asking for people to write me anything because I know it takes alot of time, just wondering where to be pointed is all.
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.