FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Explain and get up to 30FRIH!





DecayClan
Here it comes:I am a noob as for databases and stuff like that, so i would like someone to eplain the whole system to me.With simple words, and as detailed as possible.What i want to learn?For example, you enter a webpage, were you can register.The regestration info and everything, is automatically saved somewhere(how?).And then depending on if someone has already logged in or not, they get specific privilages...How exactly does this system work?Can i create(or find in the internet a ready one) that could work for me in this way, and how?
If i find your answer aquantake you get 20Frih
If i find your answer SUPER you get 25Frih
If your answer is super and what you said worked or me after all, you get 30FRIH
wumingsden
For what kind of database, mySQL?
Nyizsa
1. You need a server-side scripting language like PHP. This is a programming language just like any other. The difference is that it will be executed on the server.
2. You need a database on the server, which you will store the members' data in.
3. On the registration page the user fills the details in, then submits the form. (= sends the data he just entered to the server.)
4. PHP (or the chosen language) verifies the data, encrypts the password and puts it into the database. (This happens on the server.)
5. On the login page the user enters the username and password. These are sent to the server. Then PHP verifies if they match any entry from the database. If yes, it sets a session cookie. (Think of it as a simple variable which exists on both the server and at the client.)
6. The main page first of all checks the presence of this session cookie. If it is OK, it may show restricted content, allow users to edit, etc. If it is not set, it may display a message "You must be logged in to view this page!" or display data read-only, etc.
7. A lot of tutorials are available about this on the net, and also here on Frihost. Try checking the Scripting topic. If you have any further questions, post it there, or you can send me a private message.
I hope it helped!
vinx_18
Database- is an organized collection of data.
- is a collection of records stored in a computer in a systematic way, such that a computer program can consult it to answer questions. For better retrieval ans sorting, each record is usually organized as a set of data elements (facts). The items retrieved in answer to queries become information that can be used to make decisions.
SQL is a standard computer language for a accessing and manipulating databases. Check this out... http://www.w3schools.com/sql/sql_intro.asp this explains more how to access and manipulate databases.
For logging in and registering you need to have a server side scripting language such as PHP or ASP to access the database. Check this out...
http://www.w3schools.com/asp/default.asp --ASP tutorials
http://www.w3schools.com/php/default.asp --PHP tutorials
For logging in and out scripts..check this out...http://www.free2code.net/plugins/articles/read.php?id=99...There are so many tutorials in the internet....

I think that helps...
ulruc
I think that I can help you on that point if you understand french text. I do, so I have no problem with that help site but if you talk only english or any others langages but not french, forgot about what I'm going to say next.

You can go to the http://www.siteduzero.com/index.php to learn all from xhtml and css to php and databases and a lot of others cool things to spice up your programming skills.

I learned php and mysql myself in less than 1 week and now I know how to do my own guestbook, my own chat, my own newletter and a lot of others cool things for my web site.

If you undestrand french, go for it. that's probably the best site that I found in french about programming a web site yourself.
LukeakaDanish
Explaining enough of PHP and mySQL for you to be able to start using it, in one post is physically imposible, so i suggest you follow the links written by the others...

or...

I dunno how good libraries are in greece, but when i have to learn a new language (like PHP) i usually get a BIG HEAVY book from my local library. This way you will be able to follow an eloquent introduction to the language and easily look up accurate information later when you start writing stuff yourself.

Othewise, search for whatever you want on google, and follow the instructions!

An other solution is installing phpBB (again search for this on google). This is a free forum application that is very easy to install if you follow the instructions. Then just set all your forums to "viewable only by members", and no-one else will be allowed in.

Databases, permissions etc. is already explained really well above so read!

Hope I was of some use...
wumingsden
LukeakaDanish wrote:
Explaining enough of PHP and mySQL for you to be able to start using it, in one post is physically imposible, so i suggest you follow the links written by the others...

or...

I dunno how good libraries are in greece, but when i have to learn a new language (like PHP) i usually get a BIG HEAVY book from my local library. This way you will be able to follow an eloquent introduction to the language and easily look up accurate information later when you start writing stuff yourself.

Othewise, search for whatever you want on google, and follow the instructions!

An other solution is installing phpBB (again search for this on google). This is a free forum application that is very easy to install if you follow the instructions. Then just set all your forums to "viewable only by members", and no-one else will be allowed in.

Databases, permissions etc. is already explained really well above so read!

Hope I was of some use...


Sorry but i kind of disagree. I knew ABSOLUTELY nothing about PHP, databases, etc before making my own website and now I'm writing my own hacks for phpbb and scripts and i've only had my account a couple of months. I do learn things quickly though so this is a great advantage on my part
LukeakaDanish
wumingsden wrote:
LukeakaDanish wrote:
...(see quote above)


Sorry but i kind of disagree. I knew ABSOLUTELY nothing about PHP, databases, etc before making my own website and now I'm writing my own hacks for phpbb and scripts and i've only had my account a couple of months. I do learn things quickly though so this is a great advantage on my part


Hm...not sure what we're disagreing on....i made my first couple of phpBB forums, and modded them, before konwing pretty much any PHP...mainly because this only requires following instructions, not thinking for yourself...
MWANGI
Check whether this code will work for the login and logout

First create a form using this code
Code:



<form action="checklogin.php" method="post">

<a href="login.php?PHPSESSID=$sess_id&message=$message&logout=1" ><font color="#000099">LOGOUT</font> <br></a>

    Username:<br>
    <input name="username" type="text">
    <br>
    Password:<br>
    <input name="password" type="password">
    <br>
    <input type="submit" name="submit" value='Login'>
 
  </form>




Then in a file called checklogin.php and paste the following code

Code:


<?php

session_start();
$connection=mysql_connect("localhost","test","test");
if(!$connection) die ('Unable to connect you to the database.....' . mysql_error());
else mysql_select_db("test", $connection);

//SECTION #1
$username = trim($_POST['username']);
$password = trim($_POST['password']);

//Check whether database exists and checks for user row
    if(!mysql_select_db("test", $connection)) die(sql_error());
      $res=mysql_query("select * from logins where User='" . $username . "'");

   if(mysql_num_rows($res)==0) die('Please enter a valid username!');
   $valid_user=$res;
//Checks whether password is valid and prints error message if not
   $passwd= mysql_result($res,0,1);
   if($passwd!=$password) die ('Please enter a valid password!');
   

//Assign usertype from database to variable
   $UserType=mysql_result($res,0,2);
   
//SECTION #1

$c_hour = date("H");    //Current Hour
$c_min = date("i");    //Current Minute
$c_sec = date("s");    //Current Second
$c_mon = date("m");    //Current Month
$c_day = date("d");    //Current Day
$c_year = date("Y");    //Current Year

//SECTION #2
$t_timestamp = mktime($c_hour,$c_min,$c_sec,$c_mon,$c_day,$c_year);

//SECTION #2
if (($username) AND ($password)) {
    if ($valid_user) {        //<--Optional
         
        session_register('username');
        session_register('password');
        $sess_id = session_id();
      
        header("Location: index.php?PHPSESSID=$sess_id&new_login=1&stamp=$t_timestamp");
        exit;         
    } else {
        $message = urlencode("<b>ERROR:</b> Username does not exist.");
      
        header("Location: login.php?message=$message");
        exit;
    }
} else {
    $message = urlencode("<b>ERROR:</b> You must enter a username and password to enter.");
    header("Location: login.php?message=$message");
    exit;
}

?>




Then in the index page, paste the following code

Code:


<?php
 
//SECTION #1
$refresh_time = 10;
$c_hour = date("H");    //Current Hour
$c_min = date("i");    //Current Minute
$c_sec = date("s");    //Current Second
$c_mon = date("m");    //Current Month
$c_day = date("d");    //Current Day
$c_year = date("Y");    //Current Year

//SECTION #2
$c_timestamp = mktime($c_hour,$c_min,$c_sec,$c_mon,$c_day,$c_year);

//SECTION #3
$t_timestamp = trim($_GET['stamp']);
    if (!$t_timestamp) {
        $t_timestamp = trim($_POST['stamp']);
    }

//SECTION #4
if (!$new_login) {
    if (!$t_timestamp) {
        $message = urlencode("<b>ERROR:</b> Inactive monitor unable to establish time. Please login again.");
        header("Location: login.php?PHPSESSID=$sess_id&message=$message&logout=1");
        exit;
    }
    elseif ($t_timestamp < $c_timestamp) {
        $message = urlencode(" Your account has been inactive for $refresh_time minutes. Please login again.");
        header("Location: login.php?PHPSESSID=$sess_id&message=$message&logout=1");
        exit;
    }
}

//SECTION #5
$t_timestamp = mktime($c_hour,$c_min+$refresh_time,$c_sec,$c_mon,$c_day,$c_year);
echo $t_timestamp;
session_destroy();
?>



Remember to change the database name and password for the localhost
database plus the tablename for where your records are stored!!



Idea May I request for my $Fri pointsnow please. I need them to upload my site on the net. Thanks

REMEMBER
Quote:
EASY COME.......EASY GO>>>!
Twisted Evil
Related topics
Reply to topic    Frihost Forum Index -> Miscellaneous -> Contests

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.