Page 1 of 1

Newbie wanting very basic help...

Posted: Mon Jul 01, 2002 11:22 am
by swinny
Hi y'all

I have recently started work on a new personal project, that will eventually be a resource for video editing software.

I have signed up for a hosting account that has PHP and MySQL...I'm basically looking to see if some things I want to do are possible and if anyone can point me in the direction of source sites etc that might help me out.

Bascially I want the site to have a simple login system so that users can maybe have their own profiles as part of a forum (this forum in fact is perfect, but I'd bet probably not in my price range!)...the only other thing I need is some kind of file upload facility that would allow users to maybe upload their videos (although, obvioulsy this may depend on what my ISP allows and also on the amount of room I have...currently 500Mb, but that could soon fill up if things get popular)...so maybe, something that allows me to link to their files but kinda makes it look like they are hosted by me...

If anyone has seen http://www.alamdv.com - thats the kinda thing I'd really love to get going...

Sorry if this makes little sense...any help would be really appreciated...and sorry if I have posted on the wrong board.

Cheers in advance.

Well....

Posted: Mon Jul 01, 2002 12:53 pm
by icesolid
If you are looking for PHP help or tips on PHP.

You might want to try and use the resources and web sites that are in the http://www.devnetwork.net ring.

Such as:

http://www.evilwalrus.com
http://www.phpcomplete.com
http://www.phpdeveloper.org

Oh, and everything that you said above makes perfect sense and can all be done in PHP.

Posted: Mon Jul 01, 2002 1:05 pm
by RandomEngy
I can help you with the profiles, as I just did something similar. To start off:

Check out the PHP Beginners Tutorial.
Learn SQL syntax for editing databases at http://www.sqlcourse.com .
Learn how to use PHP and mySQL together at http://www.phpcomplete.com/content.php?id=3
Look up PHP functions at http://www.php.net

You may or may not want to try to install Apache, PHP, and mySQL on your machine. It's a lot of hassle, but it's much easier to test your PHP scripts.

Before you tackle the whole project, make lots of little test pages, to make sure you can pass data to PHP using forms, verify passwords correctly, etc, so you can easily identify your problem.

Now that you know all that, I would reccomend putting your user list in a table, along with their personal info (like a profile), and their password.

To access their profile, have a login screen that sends information via forms to a modify page. There you can start a session using session_start(); . session_start() starts a session if one does not exist, and resumes a session if it does exist. To store session variables (such as the user's username and password they entered), use $_SESSION['varname']. The $_SESSION variables will always be accessible if you have session_start() on that page. For a log out page, make a page with session_start() then session_destroy(). That will kill all the $_SESSION variables. This modify page should first set the $_SESSION['user'] and $_SESSION['pass'] variables using the $_POST array, assuming you used method="post" in your login form. Then verify that the $_SESSION username and password match up with the username and password stored in the database. After that is done, you can display a form with all the categories of information for the profile. Their default values can be the values gotten from the database, so they don't have to re-type their whole profile when they want to change. You can do that, or have the page you send the information to check if the field was blank or not, and choose not to update if it was blank. After they have made their changes, they can submit to another page that will process the request.

That page can have the same $_SESSION password checking and all. Then, ask the database to update their information based on the submitted info. After that, you can create a profile html page created based on the database information. Make an include file with a function that does that, based on all of the different categories. A basic one might look like this:

Code: Select all

<?php

function make_page($username, $hobby)
&#123;
  // The "w" will clear the file if it exists and create it if it does not
  $pfile = fopen("profile_".$username.".html","w");
  flock($pfile,1);

  fputs($pfile,"<html><body>\n".
    "Hobby: ".$hobby."\n".
    "</body></html>");

  flock($pfile,3);
  fclose($pfile);
&#125;

?>
A note about the passwords: it may be good to run your passwords through a hash before storing them in the database. You can run the password through md5() before you submit it to the database, and check passwords by comparing the md5($submitted_password) to the password in the database. That would make your user's passwords more secure.

I don't know how to do the file uploading, but I know it can be done.

Good luck on the project.

Posted: Tue Jul 02, 2002 7:44 am
by allevon
Swinny,

If your really a very new user of php, I would highly recommend using either PhpNuke.org or PostNuke.com to get the site you want going. Its an entire Content Management System running in php with an sql database system. Theres alot of people using it and for newbies, its a real easy way to break into php as well as getting a great amount of support from users. Anyway, its just something to consider since your looking to do what they offer already built.

Posted: Tue Jul 02, 2002 9:06 am
by jason
Just on a note: Do NOTE use PHPNuke. PostNuke is a good alternative, with better support, and it is actually an open source project. PHPNuke is not an open source project.

a point to make

Posted: Wed Jul 03, 2002 5:16 pm
by Gremlin
and, just to clarify.. the forums that are being used here.. ARE FREE

if thats out of your price range, im terribly sorry.