Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. ------------
  2. INDEX1.HTML
  3. -------------
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <title> HTML Forms </title>
  8. </head>
  9.  
  10. <body>
  11. <H1> HTML Forms</h1>
  12. <form id="form-id" action="/cgi-bin/DBconnect.pl" method="post">
  13. <button type="submit">Connect to DB</button>
  14.  
  15. </form>
  16. </body>
  17. </html>
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. ---------------
  27. DBconnect.pl (Put into CGI-bin, change permissions to 0755)
  28. ---------------
  29. #!/usr/bin/perl -w
  30.  
  31. use strict;
  32. use warnings;
  33. use DBI;
  34. use CGI qw(:standard);
  35. use CGI::Carp qw(fatalsToBrowser);
  36.  
  37. print "Content-type: text/html\n\n";
  38.  
  39. my $driver = "mysql";
  40. my $database = "erwilban_Contact_Information";
  41. my $dsn = "DBI:$driver:$database:localhost";
  42. my $userid = "erwilban_contact";
  43. my $password = "password";
  44.  
  45. my $dbh = DBI->connect($dsn, $userid, $password) or die $DBI::errstr;
  46.  
  47. $dbh->disconnect();
  48. print "DB Connection Successful";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement