Jump to content


Photo

PHP & mySQL Help.


  • Please log in to reply
5 replies to this topic

#1 GiTMApostle

GiTMApostle
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 28 August 2006 - 01:32 AM

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 :(

#2 jvalarta

jvalarta
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 28 August 2006 - 02:22 AM

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.

#3 radar

radar
  • Members
  • PipPipPip
  • Advanced Member
  • 645 posts
  • LocationSLC

Posted 28 August 2006 - 02:26 AM

Here is a sample upload script...  

<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>

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

<?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>";
?>

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...

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 28 August 2006 - 02:30 AM

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.
Legend has it that reading the manual never killed anyone.
My site

#5 radar

radar
  • Members
  • PipPipPip
  • Advanced Member
  • 645 posts
  • LocationSLC

Posted 28 August 2006 - 02:33 AM

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.


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...

#6 GiTMApostle

GiTMApostle
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 28 August 2006 - 04:47 AM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users