powershellを起動し、Select-String “search name”で検索する。
file
powershell
> select-string "server" koneksi.php
koneksi.php:3: $server = "localhost"; //sesuaikan dengan nama server
koneksi.php:8: $connect = mysql_connect($server, $user, $password) or die ("Koneksi gagal!");
koneksi.php:12: // $con = mysqli_connect($server, $user, $password, $database);
select-string はslsでも代替可能。
> sls "user" koneksi.php
koneksi.php:4: $user = "root"; //sesuaikan username
koneksi.php:8: $connect = mysql_connect($server, $user, $password) or die ("Koneksi gagal!");
koneksi.php:12: // $con = mysqli_connect($server, $user, $password, $database);
unixのcatとのようなコマンドはmore
n> more koneksi.php
/* ===== www.dedykuncoro.com ===== */
$server = "localhost"; //sesuaikan dengan nama server
$user = "root"; //sesuaikan username
$password = "enter"; //sesuaikan password
$database = "kuncoro_login"; //sesuaikan target databese
$connect = mysql_connect($server, $user, $password) or die ("Koneksi gagal!");
mysql_select_db($database) or die ("Database belum siap!");
/* ====== UNTUK MENGGUNAKAN MYSQLI DI UNREMARK YANG INI, YANG MYSQL_CONNECT DI REMARK ======= */
// $con = mysqli_connect($server, $user, $password, $database);
// if (mysqli_connect_errno()) {
// echo "Gagal terhubung MySQL: " . mysqli_connect_error();
// }
複数ファイルを検索する場合は、ワイルドカードを使う。
sls "user" *.php
koneksi.php:4: $user = "root"; //sesuaikan username
koneksi.php:8: $connect = mysql_connect($server, $user, $password) or die ("Koneksi gagal!");
koneksi.php:12: // $con = mysqli_connect($server, $user, $password, $database);
login.php:7: $username = $_POST["username"];
login.php:10: if ((empty($username)) || (empty($password))) {
login.php:17: $query = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password'");
login.php:24: $response->message = "Selamat datang ".$row['username'];
login.php:26: $response->username = $row['username'];
login.php:32: $response->message = "Username atau password salah";
login.php:44: // $username = $_POST["username"];
login.php:47: // if ((empty($username)) || (empty($password))) {
login.php:54: // $query = mysqli_query($con, "SELECT * FROM users WHERE username='$username' AND password='$password'")
;
login.php:61: // $response->message = "Selamat datang ".$row['username'];
login.php:63: // $response->username = $row['username'];
login.php:69: // $response->message = "Username atau password salah";
register.php:7: $username = $_POST["username"];
register.php:11: if ((empty($username))) {
register.php:14: $response->message = "Kolom username tidak boleh kosong";
register.php:27: if (!empty($username) && $password == $confirm_password){
register.php:28: $num_rows = mysql_num_rows(mysql_query("SELECT * FROM users WHERE username='".$username."'"));
register.php:31: $query = mysql_query("INSERT INTO users (id, username, password) VALUES(0,'".$username."','".$passw
ord."')");
register.php:42: $response->message = "Username sudah ada";
register.php:48: $response->message = "Username sudah ada";
register.php:62: // $username = $_POST["username"];
register.php:66: // if ((empty($username))) {
register.php:69: // $response->message = "Kolom username tidak boleh kosong";
register.php:82: // if (!empty($username) && $password == $confirm_password){
register.php:83: // $num_rows = mysqli_num_rows(mysqli_query($con, "SELECT * FROM users WHERE username='".$username."
'"));
register.php:86: // $query = mysqli_query($con, "INSERT INTO users (id, username, password) VALUES(0,'".$username."'
,'".$password."')");
register.php:97: // $response->message = "Username sudah ada";
register.php:103: // $response->message = "Username sudah ada";
ほお~