Announcement

Collapse
No announcement yet.

Sitewide Registration

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sitewide Registration

    Well, we've got this great board now, and I'm just getting started rewriting our other scripts to integrate with the registration. I had everything working great with the UBB since all the scripts were in perl, so they were much easier to integrate with each other. Unfortunately, I don't have any knowledge of php (yet), I know what quotemeta does, and that's about it.

    What I'm really stuck on is how to grab the username info from the mySQL database and verify it with the password in perl, I found this tutorial from thescripts.com, but it said I needed all kinds of modules. I was just wondering if there was an easy way of doing this. If there are any perl/php gurus that could help a poor girl out, I would appreciate it!
    Attached Files
    We're Here Forums!
    jessica@webstyles.net

  • #2
    soon...soon...

    As soon as I get payment from clients, I'll grab a copy of the code and begin working on it... Never really liked perl, but I LOVE PHP... And the first thing I need to write is an Active Topics type program if anyone hasn't already done it...
    Attached Files

    Comment


    • #3
      That would be nice. And what about a program (or code) that lets you see vB info on other pages of one's site?
      Attached Files
      - Insert viable disclaimer here -

      ArtBeast!

      Comment


      • #4
        is it possible to create a standard sort of api for authenticating users against the vb db. that way you can have any other prog or script on your site access that api for authentication as well as registration.

        H
        Attached Files
        The BIG Network: Soccer - Aussie Rules - Cricket - Travel - Lacrosse - Music

        Comment


        • #5
          I actually have figured it out since I posted this Huss. Here's the code I used:

          ----------------------------------------
          function process_form($action){
          global $username,$password;

          // Make sure neither $username or $password is left blank

          if (empty($username) || empty($password)){

          echo "You must fill out both the username, and password fields";

          } else {

          mysql_connect("hostname", "username", "password") or die ("Unable to connect to database.");

          // select database on MySQL server
          mysql_select_db("forum") or die ("Unable to select database.");

          // Store the query in $sql
          $sql = "SELECT *
          FROM user
          WHERE username='$username' and password='$password'";

          // Execute the query and put results in $result
          $result = mysql_query($sql);

          // Get number of rows in $result. 0 if invalid, 1 if valid.
          $num = mysql_numrows($result);

          if ($num >= "1") {
          echo "You're Authorized!";
          exit;
          } else {
          echo "Invalid Username/Password";
          exit;
          }
          }
          }
          ----------------------------------------

          Way easier than in perl! Also note that this is my very first PHP script, so there may be mistakes in there.
          We're Here Forums!
          jessica@webstyles.net

          Comment


          • #6
            can you give a url where you use this?

            thanks,
            j
            The BIG Network: Soccer - Aussie Rules - Cricket - Travel - Lacrosse - Music

            Comment


            • #7
              Well, I was using it for all the functions that required a password on http://www.were-here.com (in the Career Center and Flash Directory mostly), but then we finally got the DBI module for perl installed, so I rewrote it in perl, put it back in the form and eliminated the extra login script.

              I haven't deleted the old login script off of the server yet so you can test it out here if you want.
              We're Here Forums!
              jessica@webstyles.net

              Comment


              • #8
                can you post the entire login.php code, or is that it above?
                The BIG Network: Soccer - Aussie Rules - Cricket - Travel - Lacrosse - Music

                Comment


                • #9
                  There's one more function that displays the form, then some code that decides whether to display the form or process it. This code goes below the code that I gave before:

                  ----------------------------
                  function display_form() {

                  global $PHP_SELF,$username,$password;

                  ?>

                  <p> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">Please

                  enter your username and password below. If you aren't already a

                  member, <a href="http://www.were-here.com/forums/member.php?action=signup">sign

                  up now</a>! It's free and easy.</font></p>

                  <form method="post" action="<?php $PHP_SELF; ?>">

                  <table border=0 cellspacing=2 cellpadding=2 align="center">

                  <tr>

                  <td><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Username:</font></td>

                  <td><font face="Verdana, Arial, Helvetica, sans-serif" size="1">

                  <input type="text" name="username" size="25" maxlength="25"> <a href="http://www.were-here.com/forums/member.php?action=signup">Want to register?</a></font></td>

                  </tr>

                  <tr>

                  <td><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Password:</font></td>

                  <td><font face="Verdana, Arial, Helvetica, sans-serif" size="1">

                  <input type="password" name="password" size="13" maxlength="13"> <a href="http://www.were-here.com/forums/member.php?action=lostpw">Forgotten your password?</a></font></td>

                  </tr>

                  <tr>

                  <td colspan="2"><input type="submit" name="Login" value="Login"></td>

                  </tr>

                  </table>

                  </form>

                  <?php

                  }


                  if (empty($Login)) {
                  display_form();
                  } else {
                  process_form(); }

                  ?>
                  ----------------------------

                  Just put all that code where you want the form to be in a regular HTML page (with a php extension of course ).
                  We're Here Forums!
                  jessica@webstyles.net

                  Comment

                  widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                  Working...
                  X