Horas..!!


Archive

Connecting to Mysql - PHP <-- jo2

Sensitive Directory File-1 Sensitive Directory File-2 Shell Dork Advisories and Vulnerabilities-1 Advisories and Vulnerabilities-2 Vectors in C++ Visual Basic Irc Bot Make a Basic Batch Viruses How To Hack a Website (SUPER noobified) PHP Injection - Access Server Modifying Paypal Values on Lowlevel Web's Wireless Hacking Tracking Down a Botnet File of Password Page of Network Data Various Online Devices Vulnerable Servers Error Messages File of Important Information Page of Login Portals Analyzing a Trac SPAM Attempt Knock, Knock, Knockin' on EnGarde's Door (with FWKNOP) RPM and a perl.req Heredoc Bug HowTo: Secure your Ubuntu Apache Web Server :)~~~ Automatically Report all SSH Brute Force Attacks to ISPs <-- ???? :( Website Editing from the Perl Command Line <--wooowww ...... :) SSH Tunnel; HowTo <-- great job's :D Mitigating DNS Cache Poisoning Attacks with iptables Single Packet Authorization with Port Randomization How to write a port scanner in C Server Security <-- hehehehe..... :P Xss (Cross site scripting)  PuttyHijack V1.0 - Hijack SSH/PuTTY Connections on Windows  Pass-The-Hash Toolkit v1.4 Released for Download  SIPcrack - SIP Login Dumper & Hash/Password Cracker  Angry IP Scanner - Cross Platform Port Scanner Advanced SPA with fwknop Profiling psad with Devel::DProf Connecting to Mysql - PHP <-- jo2 Free Software Mapper and Cracker Tools Bot Search by Lateral Exploit from NewOrder and SecurityVulns ru

Connecting to Mysql - PHP <-- jo2

HI all,

hari ini kita akan belajar bagaimana konek ke database mysql dengan
menggunakan fungsi PHP.

sebelum kita mulai akan lebih baik bila kita tahu panduan berikut ini:

1. mysql host (biasanya localhost tapi bisa juga free host)
2. The mysql username (tau dong)
3. The mysql password (tau juga dong)
4. The mysql database (tau juga dong....kwkwkwkwkwk)

sekarang mari kita mulai,
terlebih dahulu buka notepad,phpdesign, dsb... dan tulis code di bawah ini:

-scripts start here- //the usual format for php code looks like so, begins with
?> -end here-

selanjutnya,,, kita akan mencoba menyediakan beberapa variable utk digunakan pada
koneksi database tsb..

-scripts start here-
$host = "localhost"; //Change this to your host or leave it alone if your not sure
$username = "turbocharged"; //Change this to your username
$password = "turbocharged_real_hard_password"; //Change this to your password
$db = "my_db"; //Change this to your database

?> -end here-

Sekarang,,, setelah variablenya sudah tersedia dan diberi nilai yg benar... kita akan
mencoba utk konek ke databasenya menggunakan mysql_connect function in php

-scripts start here-
$host = "localhost"; //Change this to your host or leave it alone if your not sure
$username = "turbocharged"; //Change this to your username
$password = "turbocharged_real_hard_password"; //Change this to your password
$db = "my_db"; //Change this to your database

$connect = mysql_connect($host,$user,$password); //connects to the mysql database

?> -end here-

sekarang qt mungkin sudah terkoneksi dgn databasenya, mungkin juga tidak.. ap yg bisa dilakukan
skg adalah mengetahui secara pasti apabila qt benar2 sudah berhasil terkoneksi dgn databasenya..
kalo mmg qt tdk berhasil makan biasanya akan terdapat pesan error sebagai pemberitahuan..

-scripts start here-
$host = "localhost"; //Change this to your host or leave it alone if your not sure
$username = "turbocharged"; //Change this to your username
$password = "turbocharged_real_hard_password"; //Change this to your password
$db = "my_db"; //Change this to your database

$connect = mysql_connect($host,$user,$password); //connects to the mysql database
if(!$connect){
//^ the above says if the connection is false ($connect is the connection and the ! mark means false)
die("Error connecting to the mysql host"); //ends the script and echos an error
}

?> -end here-

sekarang kita akan lihat apabila koneksinya udah tersambung dgn benar.. jika tidak coba balik dan
ganti variablenya sampe kamu dpet variable yg bnr.. sekarang kita harus memilih databasenya jika
koneksinya udah2 benar2 berhasil tersambung ke databasenya..

-scripts start here-
$host = "localhost"; //Change this to your host or leave it alone if your not sure
$username = "turbocharged"; //Change this to your username
$password = "turbocharged_real_hard_password"; //Change this to your password
$db = "my_db"; //Change this to your database

$connect = mysql_connect($host,$user,$password); //connects to the mysql database
if(!$connect){
//^ the above says if the connection is false ($connect is the connection and the ! mark means false)
die("Error connecting to the mysql host"); //ends the script and echos an error
}else{
$select = mysql_select_db($db);
}
?> -end here-

sekarang... koneksinya mungkin bisa memlih database tapi mungkin juga tidak.. oleh sebab itu, cobalah untuk
membuat kondisi yg sepeti di atas...

-scripts start here-
$host = "localhost"; //Change this to your host or leave it alone if your not sure
$username = "turbocharged"; //Change this to your username
$password = "turbocharged_real_hard_password"; //Change this to your password
$db = "my_db"; //Change this to your database

$connect = mysql_connect($host,$user,$password); //connects to the mysql database
if(!$connect){
//^ the above says if the connection is false ($connect is the connection and the ! mark means false)
die("Error connecting to the mysql host"); //ends the script and echos an error
}else{
$select = mysql_select_db($db);
if(!$select){
die("Error selecting database.");
}
}
?> -end here-

sekarang,,, jika semuanya berjalan lancar,, kita tidak akan melihat adanya error di scriptnya,,, n sekarang
jika kita mw menggunakan script tsb.,, hmm.. masukkan aja srciptnya di file yg kamu mw.


BY : JO2
Thx to : special My God Jesus Christ, MI
zz grace kwkwkwkw, and crew zonabatakhacker team