Advertisement
Guest User

Untitled

a guest
Jun 17th, 2017
543
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #!/usr/bin/perl -w
  2. use strict;
  3. use DBI;
  4. use Data::Dumper;
  5.  
  6. my $dbhost = 'localhost';
  7. my $db = 'correio';
  8. my $dbuser = 'exim';
  9. my $dbpass = 'eximuser';
  10. my $dbport = '3306';
  11. my $dsn = "DBI:mysql:database=$db;host=$dbhost;port=$dbport";
  12.  
  13. my $haha = &getinfacc('fabricio@ofertaperfeita.com.br');
  14. foreach my $h (@{$haha}) {
  15. foreach my $rs (keys %{$h}) {
  16. print "$rs -> $h->{$rs}\n";
  17. }
  18. }
  19.  
  20. #it's gonna get all information about the user
  21. sub getinfacc {
  22. if (@_ and @_ == 1) {
  23. my $account = shift;
  24. my $dbc = DBI->connect($dsn, $dbuser, $dbpass);
  25. my $sel = $dbc->prepare("SELECT * FROM users where email=\'$account\'");
  26. $sel->execute;
  27. return $sel->fetchall_arrayref({});
  28. $dbc->disconnect;
  29. } else {
  30. return 1;
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement