小编Ahm*_*lal的帖子

在 Perl 中使用 Bycrypt

#!/usr/bin/perlml -Tw
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser); # show errors in browser
use Authen::Passphrase::BlowfishCrypt;
use Bytes::Random::Secure;

print "Content-type:text/html\n\n";

# read the CGI params
my $cgi = CGI->new;
my $username = $cgi->param("username");
my $password = $cgi->param("password");
if ($username =~ /[^a-zA-Z0-9]/) { die "Illegal characters" };
if ($password =~ /[^a-zA-Z0-9]/) { die "Illegal characters" };

my $settings = './settings.cnf';

use DBI;
my $dsn =
  "DBI:mysql:DB;" . 
  "mysql_read_default_file=$dbsettings";    

my $dbh = DBI->connect($dsn, undef, undef,{RaiseError=>1})
                or die "Could not connect to database: …
Run Code Online (Sandbox Code Playgroud)

perl hash blowfish salt bcrypt

2
推荐指数
1
解决办法
2088
查看次数

为 Mariadb 安装连接器 C

所以,我想使用 Mariadb。有这个连接器-C。 https://downloads.mariadb.org/connector-c/

我该如何安装?坦率地说,它的文档很糟糕。甚至 3.0.5 的 src 文件也链接到 3.0.4 页面。

我没有找到安装二进制文件的方法,从 src 构建的文档很模糊。我更想知道如何安装两种方式(二进制和从源代码构建)

我正在使用 CentOS7 64 位。

c mysql centos connector mariadb

2
推荐指数
4
解决办法
4627
查看次数

如何组合两个字符串并将结果视为变量的名称?

如何组合两个字符串并将结果视为变量的名称?

我试过这个:

my $container0 = "voila";
my $container1 = "ssss"; 
my $container2 = "swat"; 

my $container3 = int rand 2; 

my $ans = '$container'."$container3"; 

print "$ans"; 
Run Code Online (Sandbox Code Playgroud)

但它打印:

$container2
Run Code Online (Sandbox Code Playgroud)

我要打印:

swat
Run Code Online (Sandbox Code Playgroud)

(变量的值$container2).我怎样才能做到这一点?

perl

0
推荐指数
1
解决办法
98
查看次数

标签 统计

perl ×2

bcrypt ×1

blowfish ×1

c ×1

centos ×1

connector ×1

hash ×1

mariadb ×1

mysql ×1

salt ×1