Hi!
I wrote this little peace of code, which is supposed to check if a certain database exists, and if not, create one.
(Maybe there's a much better way to do it, but I don't know it)
Anyway, here's the code:
use DBI;
$username = 'root';$password = '';$database = 'tina'; $hostname = '';
if...
I've managed to do it this way:
use DBI;
$username = 'root';$password = '';$database = 'tina'; $hostname = '';
$dbh = DBI->connect("dbi:mysql:database=$database;" .
"host=$hostname;port=3306", $username, ) or $result=`mysqladmin -u root create tina`;
Basically, it's doing what I wanted, but...
Hi, everyone!
Is there a way to create a database using Perl?
I've been searching the Net, and all examples I came across were for connecting to an existing database.
I tried using: $result=$dbh->createdb("dbname"),
but it returns an error: Can't call method createdb on an undefined value...
Hi, everyone!
I was wondering... If I write:
# yum install mysql
...
# yum install mysql-server
...
Is DBI installed together with those, or do I have to install it separately?
Tnx.
Hello guys and gals!
I have a perl script which captures ARP packets on the network.
Right now I'm starting it from command-line and stopping it with Ctrl-C.
But, I'd like to start it and stop it from perl/CGI stript (HTML page, Start and Stop buttons).
I know I could start it using...
Wow, that's great! You helped a lot.
(I had to change this just a little bit: instead of capital "S+", it has to be "s+").
But, I couldn't have done it without you! [sunshine]
Hi!
This is one of the lines I get when I use nbtscan to detect computers' NetBIOS name:
192.153.1.5 STARI <server> STARI 00-c0-df-13-66-49
I'd like to parse that line in such way that I store IP address to variable $ip and NetBIOS name "STARI" to variable $nbt...
I know eq and ne operators are for comparing strings. But what I can't figure out is how to extract the value (or name) and put it in a variable so I can do something with it.
Something tells me I should maybe use "param()", but I don't know how.
Hi!
If I have two submit buttons in one form (like shown below), how do I get the "name" part in a variable to be able to use it with "if" statement?
print "<br>";
print "<form>";
print "<input type=submit name=update value=\"Write NIC name\" >";
print "<font align=middle>OR</font>";
print...
Is it possible to write HTML form in perl so that the action points to a subroutine in the same script?
E.g.
print "<form action=\"do_something()\">";
where do_something is a subroutine?
After adding those lines and trying it out, a thought came to me...
There is no action specified in my form, so Submit calls upon this same script, but it loses information about MAC along the way. That's why mysql statement in the end looks like this:
update table set nameMAC='something'...
Hi!
I have a problem (again). :-(
This script I wrote is supposed to update mysql table with new data. When I write in mysql: update table set nameMAC='something' where MAC='something else', everything works just fine. But my script just won't do it!
Here's my code, so if anyone can figure...
Thanks for the advice, PaulTEG!
It was very helpful - it got me started. But I had to print the whole form using the CGI module, as well.
Now it's working. [thumbsup2]
Hello!
I have a strange thing going on. This is my perl code:
______________________________________
#! /usr/bin/perl
use CGI;
use DBI;
print "Content-type: text/html\n\n";
print "<HTML><HEAD><meta http-equiv=Content-Type content=text/html; charset=iso-8859-2><TITLE> Adding a NIC card...
Hi.
I'm supposed to scan the network, find out NETbios computer names and store them in a database.
I know there are tools like nmap and nbtscan. I tried nmap from command line and it shows everything BUT computer names.
Nbtscan works perfectly from command line, but I don't know how to start...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.