Advertisement
Guest User

Untitled

a guest
Aug 10th, 2013
730
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 2.00 KB | None | 0 0
  1. #!/usr/bin/perl
  2. sub login_enable{
  3.     open(my $CONFIG_FILE, "<", "/etc/wsd.conf") or die("Could not open wsd.conf"); 
  4.     my ($LOGIN_ENABLE, $LOGIN_USER, $LOGIN_PWD);
  5.     while( my $line = <$CONFIG_FILE> ){
  6.         chomp($line);      
  7.         if($line=~/Login-set : (.*)/){               
  8.            $LOGIN_ENABLE=$1;
  9.                    
  10.         }
  11.         if($line=~/Login-user : (.*)/){
  12.            $LOGIN_USER=$1;
  13.         }
  14.         if($line=~/Login-password : (.*)/){
  15.            $LOGIN_PWD=$1;
  16.         }        
  17.    }
  18.    close(WIRELESS_FILE);  
  19.    return ($LOGIN_ENABLE, $LOGIN_USER, $LOGIN_PWD);
  20. }
  21. my @LOGIN_INFO=&login_enable();
  22. print "Content-type: text/html\n\n";
  23. print "<html>";
  24. print "<head>";
  25. print "<title>KCard Login</title>";
  26. print "<script type=\"text/javascript\">
  27. function check_input(user,pwd,enable,onload){
  28. var oForm = document.forms[\"kcard_login\"];
  29. if (enable == \"No\"){
  30.    document.cookie = \"securitydisable\";
  31.    history.back();
  32. }else{  
  33.  if(onload == 1){   //Enable to insert user name and password
  34.  }else{
  35.     if (oForm.user.value==user && oForm.pwd.value==pwd){
  36.      window.alert(\"Login successfully.!\");
  37.       document.cookie = \"securityenable\";
  38.       history.back();
  39.    }else{
  40.          window.alert(\"Please insert the right user name and password!\");
  41.    }  
  42.  }      
  43. }    
  44. }</script>";
  45. print "<style>
  46. <!--
  47. body{
  48.     background-color:#ffdee0;
  49. }
  50. -->
  51. </style>";
  52. print "</head>";
  53. print "<body onLoad=\"check_input('$LOGIN_INFO[1]','$LOGIN_INFO[2]','$LOGIN_INFO[0]',1)\">";
  54. print "<form name=\"kcard_login\">";
  55. print "<br><br>Please insert your user name and password. <br>";
  56. print "<li><b>User Name : </b><input id=\"user\" name=\"user\" type=\"text\" value=\"\"></li>";
  57. print "<li><b>&nbsp;&nbsp;Password   : </b><input id=\"pwd\" name=\"pwd\" type=\"text\" value=\"\"></li><br>";
  58. print "<br><input type=\"button\" value=\"Submit\" onClick=\"check_input('$LOGIN_INFO[1]','$LOGIN_INFO[2]','$LOGIN_INFO[0]',0)\">";
  59. print "<input type=\"reset\" value=\" ClearAll \" >";
  60. print "</form></body>";
  61. print "</html>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement