40 users online (0 members and 40 guests)  


  Results 1 to 7 of 7

Related

  1. Replies: 0
  2. creating a login page    Forum: CGI Perl Forum
    Replies: 0
  3. Replies: 1
  4. Creating scroll bar    Forum: HTML Forum
    Replies: 1
  1. #1
    Muqq's Avatar
    New User

    Status
    Offline
    Join Date
    May 2011
    Posts
    5

    Need help creating a login using perl / cgi

    Hello everyone. I'm new to these forums and I'm in quite a bit of situation with a class I'm currently taking so I'm going to go ahead and explain what's being asked of us and what we're working with in hopes that I may be able to find the help or direction I need to complete this project.

    I'm taking a networking troubleshooting class where the instructor has assigned us a project that, in my opinion, has NOTHING to do with network TS.

    TDL: He's assigned us to work on a WAMP server using EasyPHP-5.3.5.0 where we have to build a fully functioning page. None of us have ever taken advanced web page classes or know anything about perl / cgi.

    The project itself is graded based on the following:

    Guestbook-perl (working)
    Guestbook-php (working)
    Login-php (working)
    Login-perl
    Logout-php (working)
    Logout-perl
    Session-php (working)
    Session-perl
    Manage Users-php (working)
    Manage Users-perl

    All of my PHP content is working as it was very easy to find tutorials and online references to getting PHP and MySQL to work together. However I've run into a huge snag concerning the perl and cgi scripts.

    I'm finding that perl in general for authentication isn't very popular and it's difficult to find working scripts that aren't relying on a back end database such as MySQL for authentication.

    The instructor is expecting Login-perl to work as such:

    Authentication is verified by reading from a flat text file with the information inside it upon which a cookie is created and stored on the machine. This cookie is used to allow access to the session-perl (nothing more than a blank page that just requires the cookie to be present to view) and the manage users-perl pages.

    The Manage Users page is nothing more than being able to add and remove users and their passwords from the flat text file. Both session-perl and manage users-perl must contain a script that checks for the cookie. If the cookie isn't present, the page redirects the user to the login-perl page.

    The logout-perl does nothing more than destroy the cookie. I've spent weeks searching around for information along these lines but the information is very scattered and mixed. Hopefully someone here can give me some idea of where to go or how to even get started on something like this O.O

    Again, I'm not a programmer and I really know nothing about perl or cgi. I can follow scripts somewhat as I read them but really have no knack for creating of my own (and is not expected of the class). We were simply advised to search around the net for already working scripts.

    I apologize for the long post but I felt the more information I could put out, the easier it would be for others to see what exactly it is that's expected of the project objective and how it's supposed to work.

    Thank you all for your time and hopefully I can make some progress on this soon

  2. #2
    Muqq's Avatar
    New User

    Status
    Offline
    Join Date
    May 2011
    Posts
    5

    Re: Need help creating a login using perl / cgi

    Login-perl and session perl pages are done. Anyone have any idea how I can destroy the cookie if I click the logout-perl link? Please let me know if you need to see my cookie-get.cgi script

    I'm gonna start working on the manage users page today. Adding users into the textfile shouldn't be too complicated. What I'm not certain about is how I'm going to remove them. My instructor suggested using an array that wipes the text file and re-writes it with the remaining data that wasn't removed.

    Any ideas on how I could accomplish this? Or at least get it started :\

  3. #3
    Muqq's Avatar
    New User

    Status
    Offline
    Join Date
    May 2011
    Posts
    5

    Re: Need help creating a login using perl / cgi

    I decided to try having a logout page that prompts for logout confirmation

    <td><center>Are you sure you want to logout of your perl session?</td></center>
    <td><center><input value="Yes" type="submit"><input value="No" type="reset"></td>
    with a form action of

    <form action="/cgi-bin/logout.cgi" method="get">
    Here is my logout.cgi file:
    #!../perl/bin/perl.exe -Tw
    use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;
    use CGI qw(:standard);

    $query = new CGI;

    $cookie = $query->cookie(-name=>'MY_COOKIE',
    -value=>'BEST_COOKIE=chocolatechip',
    -expires=>'now',
    -path=>'/');


    print $query->header(-cookie=>$cookie);

    print $query->start_html('My cookie-set.cgi program');
    print $query->h3('The cookie has been destroyed');
    print "<INPUT TYPE=\"button\" VALUE=\"Go back to login\" onClick=\"location.href='../login-perl.html'\">";

    print $query->end_html;
    but I don't think it's working as intended because I am still able to view my session-perl page which has a java script that checks for the cookie. Currently using this java scrip

    <script type-"text/javascript">
    <!--
    function confirm_it()
    {
    if (document.cookie != '')
    (
    return ("Cookie exists");
    }
    else
    {
    window.history.back(-1);
    ;
    }}
    //-->
    </script>
    Which I think is fine. Problem is most likely in my logout.cgi coding

    I'm aware "no" is set as a reset in my table. I'll fix that later to redirect back to the index.html page

  4. #4
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel

    Re: Need help creating a login using perl / cgi

    Sadly, I do not see many perl/CGI foks around here
    AHFBWEB Less customers per server, more power for you!

    Business Class Shared Hosting

  5. #5
    Muqq's Avatar
    New User

    Status
    Offline
    Join Date
    May 2011
    Posts
    5

    Re: Need help creating a login using perl / cgi

    this project is driving me insane. I wasted a month researching the perl/cgi stuff. I've only come as far as I have right now because the instructor finally took pity on us and let us see his login.cgi script which was excellent for getting started.

    What sucks the most is I'm a total newbe with perl/cgi and advanced html / java

  6. #6
    Muqq's Avatar
    New User

    Status
    Offline
    Join Date
    May 2011
    Posts
    5

    Re: Need help creating a login using perl / cgi

    I've got my sesssion, login and logout scripts working perfectly now. It was an error in my java script that was causing the issues

    I could really use some direction on how get perl to write to the flat text file and how to remove selected user/password with an array

  7. #7
    annaya's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2015
    Posts
    1

    Re: Need help creating a login using perl / cgi

    My instructor suggested using an array that wipes the text file and re-writes it with the remaining data that wasn't removed.

    ___________________
    emma