New Website (database help)

bobby5589

Member
Reaction score
15
Well, im makeing a new website. I have html down and the layout set up pretty much. What I really need to know is how to put a login on the web pages. I know how to do the form in html, but id like to have it were after you log in some personaly settings show on the pages, such as your avi or other personal info like posts and maybe forum stats. :banghead:

Ill be using phpBB and MySQL.

I have two samples on ripway for now so you can see what the layout looks like.(& no, its not a ripway website, theyre just samples)

http://h1.ripway.com/bobby5589/TestPages/5589Home.html
http://h1.ripway.com/bobby5589/TestPages/5589test-MMO-GPotato.html

For those who help I thank you.
 

mase

____ ___ ____ __
Reaction score
154

undeadorcjerk

The Ulitimate TheHelper.net Lurker
Reaction score
223
we already know of that place, there were we learned about it.
 

bobby5589

Member
Reaction score
15
yes, i know that and i read those. Mostly i was asking for some help cause i was a little confused. :banghead:

Ok, for example I would use
Code:
<html>
<body><form action="welcome.php" method="post">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" />
</form></body>
</html>
to make a form, but i'd what i should replace welcome.php with if im useing phpBB. Also after they log in, how would i get info bout the person that loged in and have it show on all the pages they visit on the site that theyre loged in?
 

mase

____ ___ ____ __
Reaction score
154
You would have to go into the phpBB tables in your database and get that user's info.

You would a query like this: "SELECT * FROM *TABLE* WHERE username=".*USER*
 

bobby5589

Member
Reaction score
15
um, that gives me an idea. Could i do it like this?

After they enter the username & password in the form, it checks to see if the two match and if they do, that create a session cookie containin the data from the database. Then when a page is viewed and finds the session cookie it loads the varibale data from it. And when ever the person clicks some button to logout the session is ended.

Idk, if i could do that, but its an idea.
 

DDRtists

ɹoʇɐɹǝpoɯ ɹǝdns
Reaction score
415
Login.php:
See updated post below...

Logout.php:
PHP:
<?php

session_start();
session_unset();
session_destroy(); 

?>

Of course, you would have to modify the first one with the info of your table, ect ect.
 

bobby5589

Member
Reaction score
15
thats more like the kind of help I was looking for. Now one more question, how would i put that in html or do i change it to .php? Also could you explain what i replace the red with?
 

mase

____ ___ ____ __
Reaction score
154
You don't change the red, only the login and password if neccesary. And you would have to change it to .php
 

bobby5589

Member
Reaction score
15
No, phpBB doesnt have SSI. Iv worked with phpBB alone before, but i havent installed it on my site as of yet so ill look at SMF.


Ok, i looked at SMF. I dont like it, but i do think i got how to do this now. Ill try my idea tmr and post how it goes.
Thx for all the help, expesially to DDRtists for the code. ;)
 

enouwee

Non ex transverso sed deorsum
Reaction score
240
Login.php:
PHP:
$query = 'SELECT * FROM accounts WHERE login = "'.$_POST['user'].'" AND

You never heard the words SQL INJECTION, did you? How can you even dare putting such a thing when you know that it could be reused in some website?

exploits_of_a_mom.png


EDIT: what makes things worse, is that you are actually a moderator in this part of the forum!
 

DDRtists

ɹoʇɐɹǝpoɯ ɹǝdns
Reaction score
415
Well, for my last post in this thread, I'm sorry for posting that code without the stuff to protect against Injection attacks. I took it from my script, and the checks for that stuff were in the middle of my MySQL login stuff, and I didn't really see them there.

However, be sure to check out the function:
http://us2.php.net/mysql_escape_string
For more info on how to protect your MySQL queries from Attacks.

My apologies. :)
 

bobby5589

Member
Reaction score
15
well, thx anyways DDRtists. You dont need to worry bout me doing anything, but i cant say the same for those who look at thread. +rep to you & mase
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top