Advertisement
Guest User

Untitled

a guest
May 5th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. #!/usr/bin/perl
  2. # safety net
  3. use strict;
  4. use warnings;
  5.  
  6. # Register User Email Script
  7.  
  8. sub password {
  9. pass:{
  10. my $quest5 = "What do you want your password to be: ";
  11. print "NOTE: Your answer will be visable to you and we will not ask you to type it again\n";
  12. print $quest5; chomp(my $pass = <STDIN>);
  13. print ( "your answer is: ", $pass, "\n", "is this what you wanted to answer? (Y/n)\n: " ); chomp(my $answer5 = <STDIN>);
  14. if ( $answer5 =~ /no/i or $answer5 =~ /n/i ) { redo pass; }
  15. if ( $answer5 =~ /yes/i or $answer5 =~ /y/i ) {
  16. open my $logfile2, ">>", "answers_$ENV{USER}_$$";
  17. print $logfile2 $quest5, $pass, "\n";
  18. system( "cat answers_$ENV{USER}_$$ | sendmail root | echo finished" );
  19. }
  20. else { print "please try again \n"; redo pass; }
  21. }}
  22.  
  23.  
  24. sub username {
  25. user:{
  26. my $quest4 = "What do you want your username to be: ";
  27. print ( $quest4 ); chomp(my $user = <STDIN>);
  28. print ( "your answer is: ", $user, "\n", "is this what you wanted to answer? (Y/n)\n: " ); chomp(my $answer4 = <STDIN>);
  29. if ( $answer4 =~ /no/i or $answer4 =~ /n/i ) { redo user; }
  30. if ( $answer4 =~ /yes/i or $answer4 =~ /y/i ) { open my $logfile2, ">>", "answers_$ENV{USER}_$$" or die "Could not open my.log: $!";
  31. print $logfile2 ( $quest4, $user, "\n" ); password; }
  32. else { print "please try again \n"; redo user; }
  33. }}
  34.  
  35.  
  36. sub question3 {
  37. quest3:{
  38. my $quest3 = "What is your e-mail address: ";
  39. print ( $quest3 ); chomp(my $email = <STDIN>);
  40. print ( "your answer is: ", $email, "\n", "is this what you wanted to answer? (Y/n)\n: " ); chomp(my $answer3 = <STDIN>);
  41. if ( $answer3 =~ /no/i or $answer3 =~ /n/i ) { redo quest3; }
  42. if ( $answer3 =~ /yes/i or $answer3 =~ /y/i ) { open my $logfile2, ">>", "answers_$ENV{USER}_$$" or die "Could not open my.log: $!";
  43. print $logfile2 ( $quest3, $email, "\n" ); username; }
  44. else { print "please try again \n"; redo quest3; }
  45. }}
  46.  
  47.  
  48. sub question2 {
  49. quest2:{
  50. my $quest2 = "what will your primary use of pulpie be: ";
  51. print ( $quest2 ); chomp(my $use = <STDIN>);
  52. print ( "your answer is: ", $use, "\n", "is this what you wanted to answer? (Y/n)\n: " ); chomp(my $answer2 = <STDIN>);
  53. if ( $answer2 =~ /no/i or $answer2 =~ /n/i ) { redo quest2; }
  54. if ( $answer2 =~ /yes/i or $answer2 =~ /y/i ) { open my $logfile2, ">>", "answers_$ENV{USER}_$$" or die "Could not open my.log: $!";
  55. print $logfile2 ( $quest2, $use, "\n" ); question3; }
  56. else { print "please try again \n"; redo quest2; }
  57. }}
  58.  
  59. question:{
  60. my $quest1 = "What is pulpie: ";
  61. print ( $quest1 ); chomp(my $pulpie = <STDIN>);
  62. print ( "your answer is: ", $pulpie, "\n", "is this what you wanted to answer? (Y/n)\n: " ); chomp(my $answer1 = <STDIN>);
  63. if ( $answer1 =~ /no/i or $answer1 =~ /n/i ) { redo question; }
  64. if ( $answer1 =~ /yes/i or $answer1 =~ /y/i ) {
  65. open my $logfile2, ">", "answers_$ENV{USER}_$$" or die "Could not open my.log: $!";
  66. print $logfile2 ( $quest1, $pulpie, "\n" ); question2; }
  67. else { print "please try again \n"; redo question; }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement