Got me site going just one thing

  • 18 years ago

    I have a members section.
    Which you register or join and the information gets posted to the mysql database and finds the table the info slots in.
    Then the thing that im trying to figure out is how do make users login by having them use the username and password and get the database to check if both were correct and if so it goes into the members section.
    How do i check to make sure

  • 18 years ago

    hey i dont really know anything about this language but i use this in my web page and it works perfectly !!!

    Code:
    <SCRIPT LANGUAGE="JavaScript">


    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->


    <!-- Begin
    function Login(){
    var done=0;
    var username=document.login.username.value;
    username=username.toLowerCase();
    var password=document.login.password.value;
    password=password.toLowerCase();
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }


    if (done==0) { alert("Invalid login Not a member yet ?? "); }
    }
    // End -->
    </SCRIPT>


    hope this helps

  • 18 years ago

    Hi psn


     There are many ways to do your job done for you.


     One way of doing things HTTp authentication stuff let me show u that. It is purely php stuffs. If this code doesn't surve you tell me let me help u with something else ok


    Code:

    <?php


       header ("Cache-Control: no-cache, must-revalidate");
       header ("Pragma: no-cache");


       if ((!isset( $PHPAUTHUSER )) || (!isset($PHPAUTHPW)))
       {
           header( 'WWW-Authenticate: Basic realm="Please Login"' );
           header( 'HTTP/1.0 401 Unauthorized' );
           //if the user press cancel the redirect to some page
           print '<meta http-equiv="refresh" content="0;URL=login.php">';
           exit;
       }
       else
       {
           //if the user give the name and password then do your stuffs
           // these are some server side includes for my sql stuffs
           include "../include/database.php";
           include "../include/mdbc.inc.php";


           //connect the database
           $sql = new db($siteusername, $sitepassword);
           //select the database
           $sql->setdb($sitedatabase);
           $querycommand = "select useruserid,userpassword from userdetails where userloginname ='$PHPAUTHUSER'";
           $query2 = new query($sql, $query
    command);
           if($query2->numrows==0)
           {
               //when no user is present with that name
               unset ($PHPAUTHUSER,$PHPAUTHPW);
               print '<meta http-equiv="refresh" content="0;URL=login.php?ans=1">';
               die('-');
           }
           else
           {
               //now check for usernama and password
               $query2->fetchrow();
               $user
    id = $query2->rowdata[0];
               $user
    pass = $query2->rowdata[1];
               if ($user
    pass==$PHPAUTHPW)
               {
                   //verification over
               }
               else
               {
                   //password wrong redirect to some page
                   unset ($PHPAUTHUSER,$PHPAUTHPW);
                   print '<meta http-equiv="refresh" content="0;URL=login.php?ans=2">';
                   die('-');
               }
           }
       }
    ?>





  • 18 years ago

    Quote:
    [1]Posted by sammio2 on 21 Jul 2002 09:35 AM[/1]
    hey i dont really know anything about this language but i use this in my web page and it works perfectly !!!
    Code:
    <SCRIPT LANGUAGE="JavaScript">


    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->


    <!-- Begin
    function Login(){
    var done=0;
    var username=document.login.username.value;
    username=username.toLowerCase();
    var password=document.login.password.value;
    password=password.toLowerCase();
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }
    if (username=="username" && password=="pelling") { window.location="http://www.samsite.btinternet.co.uk/funarea.htm"; done=1; }


    if (done==0) { alert("Invalid login Not a member yet ?? "); }
    }
    // End -->
    </SCRIPT>


    hope this helps


    I hate to tell you sammio2 if you use that its very easy to hack, and get into your site. i suggest that you use a server side language such as php, asp or perl to protect locked areas not javascript

  • 18 years ago

    Ah well never mind as i said i dont really use this code much but there are blocks u can use and if u put enough of them on then dumasses wont beable to get into it and only dum asses use my web page !!!!!!!!!!! lol

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook