Upload System I'm Working On

Started by MeltingIce, February 14, 2007, 04:22:58 AM

Previous topic - Next topic

MeltingIce

Quote from: 3DGuy on February 14, 2007, 04:12:51 PM
Move it to a folder the user can't access (preferably out of the www folder). Then just reference it. If you can't because it's not your own server stick it in a special folder (like config) and put a .htaccess in it preventing access to it by webusers.
It is my own server, but I think I will just use .htaccess rules since I want this script to be available for anyone to download and it would be easier if they don't have to change the config directory.

MeltingIce Network | Wii Number: 3881 9574 8304 0277

Will

I do love the layout of the site and the GUI is very nice.
The world is round... so you have to use spherical projection.

old_blaggard

MeltingIce - You said you wanted to make this script available to everyone.  That means that you can't hardcode the username and password to the MySQL database.  How and where do you plan on storing that data?
http://www.terragen.org - A great Terragen resource with models, contests, galleries, and forums.

MeltingIce

I have written a register.php script that takes a username and password (and hashes the password of course) and sends it to MySQL  ;)

By the way, when I say make the script available to anyone, I mean anyone can download the script, upload it to their server, and run it themselves.

MeltingIce Network | Wii Number: 3881 9574 8304 0277

old_blaggard

Yeah, I know that.  Sorry, I didn't phrase my question well.  You will need the username and password to the MySQL database somewhere.  Something like "mysql_connect ('localhost' , 'username' , 'password');" will have to be used - if this script can be used on other servers, you shouldn't require the admins to hard-code their username and password.  How are you planning on getting around that problem?
http://www.terragen.org - A great Terragen resource with models, contests, galleries, and forums.

3DGuy

That's where the config.php comes in. That holds the user/passwd. That's why he wanted to make it impossible to download ;)

MeltingIce

Well, right now I'm doing it the way a lot of scripts do it, but I might change that later on.  Heres the code for my config.php script:

<?php
/*Needed MySQL information.  Make sure to fill it out correctly!*/
$mysqlhost "localhost";
$mysqluser "username";
$mysqlpass "password";
$mysqldb "database";

$uploaddir "/home/meltingi/public_html/uploaddirectory/"//Absolute base upload directory


@mysql_pconnect($mysqlhost$mysqluser$mysqlpass)
or die("Could not connect to MySQL Server!");

@mysql_select_db($mysqldb)
or die("Could not select database!");

?>


Then I have a install.php script that you only run once and it automatically makes the database tables for you.

MeltingIce Network | Wii Number: 3881 9574 8304 0277

Will

Nice, it makes the tabels that will be helpfulfor people like me know arn't so good at that type of thing.

regards,

Will
The world is round... so you have to use spherical projection.

MeltingIce

Quote from: Will on February 14, 2007, 05:35:11 PM
Nice, it makes the tabels that will be helpfulfor people like me know arn't so good at that type of thing.

regards,

Will
To be honest, I'm not entirely sure how to create tables in phpMyAdmin either but I know how to do it in PHP code  :P

MeltingIce Network | Wii Number: 3881 9574 8304 0277

Will

Hey more then I now.
I don't know PHP that well, been meaning to learn it though, that and python.

regards,

Will
The world is round... so you have to use spherical projection.

MeltingIce

Quote from: Will on February 14, 2007, 06:13:30 PM
Hey more then I now.
I don't know PHP that well, been meaning to learn it though, that and python.

regards,

Will
If you know any programming languages like java, C#, C++, ect.  then PHP and python will be a breeze.  I was able to learn everything I needed to know to make this upload system in one day's worth of reading and work.  Just implemented a file viewer by the way.  Right now all it does is return text saying whats in the folder, so my next goal is to turn them into links.

MeltingIce Network | Wii Number: 3881 9574 8304 0277

Will

Good do know, I may try my hand and doing some over winder break next week. As for the file veiwer if you could turn into links then that would be great!

regards,

Will
The world is round... so you have to use spherical projection.

Dark Fire

Quote from: MeltingIce on February 14, 2007, 06:15:12 PM
Quote from: Will on February 14, 2007, 06:13:30 PM
Hey more then I now.
I don't know PHP that well, been meaning to learn it though, that and python.

regards,

Will
If you know any programming languages like java, C#, C++, ect.  then PHP and python will be a breeze.  I was able to learn everything I needed to know to make this upload system in one day's worth of reading and work.  Just implemented a file viewer by the way.  Right now all it does is return text saying whats in the folder, so my next goal is to turn them into links.
Why, oh why did I bother learning a dead-end language like NSIS? As a consequence of learning NSIS before anything else, I have a habit of creating logical conditional stuff (ifs and elses) to an immense depth, and then getting confused (there is nothing like 'if' in NSIS, so I never end up with that problem when programming in it). That's why I rarely put a lot of PHP code into a single file - I end up spreading it accross a number of files...

Anyway, good luck with the project MeltingIce...

old_blaggard

Quote from: 3DGuy on February 14, 2007, 05:29:39 PM
That's where the config.php comes in. That holds the user/passwd. That's why he wanted to make it impossible to download ;)

Thanks.  That will help clear it up for me, and also help out when/if I make my script available to the public.
http://www.terragen.org - A great Terragen resource with models, contests, galleries, and forums.

MeltingIce

#29
Quote from: Will on February 14, 2007, 06:18:04 PM
Good do know, I may try my hand and doing some over winder break next week. As for the file veiwer if you could turn into links then that would be great!

regards,

Will
My plan in the end is to actually make it so you can move, delete, create folders, and open files in your user folder.  I'll see how that goes though.  I might need to study some other directory listing scripts to see how they work.

EDIT: Just updated the preview page for kicks and giggles.  Basically thats how I want the final product to look.

MeltingIce Network | Wii Number: 3881 9574 8304 0277