Postingan lainnya
Kelas Premium!
Belajar bikin website dari nol sekarang
Gunakan kupon "lebihcepat" untuk diskon 25%!
Website di localhost muncul, tapi ketika di hosting tidak muncul
saya membuat website, ketika di localhost webnya bisa di akses. ketika saya mau hosting webnya tidak bisa di buka. pesan erorpun tidak ada..
mohon bantuanyaa.. deadline tugasss
koneksinya
<?php
$host_db = 'localhost';
$user_db = 'root';
$pass_db = '';
$nama_db = 'motor_db';
mysql_connect($host_db,$user_db,$pass_db) or die ("Ada Masalah Di Koneksi!");
mysql_select_db($nama_db) or die ("ada masalah di koneksi");
?>
indexya
<?php
session_start();
if (empty($_SESSION['username'])) {
header('location:login.php');
}
error_reporting(0);
require_once "inc/koneksi.php";
require_once "inc/function.php";
?>
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sistem Informasi Penjualan Motor</title>
<link rel="shortcut icon" href="./asset/images/icon.png">
<link href='./asset/css/style.css' rel='stylesheet'>
<script src="./asset/js/SpryValidationSelect.js" type="text/javascript"></script>
<script src="./asset/js/SpryValidationTextField.js" type="text/javascript"></script>
<script src="./asset/js/fontawesome.min.js" type="text/javascript"></script>
<link href="./asset/css/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="./asset/css/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
<link href="./asset/css/fontawesome.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id='header'>
<form method="POST" class='cari' action="index.php?mod=cari">
<input type='text' name='cari' placeholder='Pencarian' required>
</form>
<!-- <div class='date'>Tanggal : <?php echo date('d M Y'); ?></div> -->
<a href='index.php?mod=keluar'>Keluar</a>
</div>
<?php
$aksi = $_GET['aksi'];
$mod = $_GET['mod'];
$id = $_GET['id'];
$page = $_GET['page'];
switch ($mod) {
case 'cash':
$cash = 'background-color : white';
if ($aksi == 'edit' || $aksi == 'hapus' || $aksi == 'tambah') {
$content = './module/k-cash.php';
} else {
$content = './module/cash.php';
}
break;
case 'kredit':
$kredit = 'background-color : white';
if ($aksi == 'edit' || $aksi == 'hapus' || $aksi == 'tambah') {
$content = './module/k-kredit.php';
} else {
$content = './module/kredit.php';
}
break;
case 'paket':
$paket = 'background-color : white';
if ($aksi == 'edit' || $aksi == 'hapus' || $aksi == 'tambah') {
$content = './module/k-paket.php';
} else {
$content = './module/paket.php';
}
break;
case 'cicilan':
$cicilan = 'background-color : white';
if ($aksi == 'edit' || $aksi == 'hapus' || $aksi == 'tambah') {
$content = './module/k-cicilan.php';
} else {
$content = './module/cicilan.php';
}
break;
case 'pembeli':
$pembeli = 'background-color : white';
if ($aksi == 'edit' || $aksi == 'hapus' || $aksi == 'tambah') {
$content = './module/k-pembeli.php';
} else {
$content = './module/pembeli.php';
}
break;
case 'motor':
$motor = 'background-color : white';
if ($aksi == 'edit' || $aksi == 'hapus' || $aksi == 'tambah') {
$content = './module/k-motor.php';
} else {
$content = './module/motor.php';
}
break;
case 'user':
$user = 'background-color : white';
if ($aksi == 'edit' || $aksi == 'hapus' || $aksi == 'tambah') {
$content = './module/k-user.php';
} else {
$content = './module/user.php';
}
break;
case 'keluar':
session_destroy();
session_unset();
header('location:login.php');
break;
case 'cari':
$content = './module/cari.php';
break;
default:
$active = 'background-color : white';
$content = './module/dashboard.php';
break;
}
?>
<div id='side'>
<div class='profile'>
<a href='./asset/images/profile.png'><img src='./asset/images/profile.png' width='50px' height='50px'></a>
<b><span><?php echo ucfirst($_SESSION['username']);?></span></b><br>
<font> administrator</font>
</div>
<div class='menu'>
<ul>
<li style='<?php echo $active ?>'></i><a href='index.php?mod=dashboard'><img src="./asset/images/home.ico"></i> Beranda</a></li>
<li style='<?php echo $motor ?>'><a href='index.php?mod=motor'><img src="./asset/images/data.ico"></i>Data Motor</a></li>
<li style='<?php echo $pembeli ?>'><a href='index.php?mod=pembeli'><img src="./asset/images/data.ico"></i>Data Pembeli</a></li>
<li style='<?php echo $cash ?>'><a href='index.php?mod=cash'><img src="./asset/images/beli.ico"></i>Beli Cash</a></li>
<li style='<?php echo $kredit ?>'><a href='index.php?mod=kredit'><img src="./asset/images/beli.ico"></i>Beli Kredit</a></li>
<li style='<?php echo $cicilan ?>'><a href='index.php?mod=cicilan'><img src="./asset/images/bayar.png">Bayar Cicilan</a></li>
<li style='<?php echo $user ?>'><a href='index.php?mod=user'><img src="./asset/images/admin.ico"></i>Menu Admin</a></li>
</ul>
</div>
<div class='copyright'>
<center><font>Sisfo Penjualan Motor © 2020<br> <?php base64_encode("ZWNobyAiPGEgaHJlZj0naHR0cHM6Ly9sdXFtYW4ud2ViLmlkJz5MdXFtYW4gRGV2ZWxvcG1lbnQ8L2E+Ijs=") ?></font></center>
</div>
</div>
<div id='content'>
<?php include $content ?>
</div>
</body>
</html>
login
<?php
session_start();
error_reporting(0);
require_once "inc/koneksi.php";
if (isset($_POST['sigin'])) {
$username = htmlentities(trim($_POST['username']));
$password = htmlentities(trim(($_POST['password'])));
$sql_login = mysql_query("SELECT *FROM user WHERE username='" . $username . "' AND password='" . $password . "'");
$log = mysql_num_rows($sql_login);
$row_login = mysql_fetch_assoc($sql_login);
if ($log == 1) {
$_SESSION['username'] = $row_login['username'];
$_SESSION['password'] = $row_login['password'];
echo "<script>window.location='index.php?mod=dashboard';</script>";
} else {
$respond = "<script>alert('Login Failed!');</script>";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sistem Informasi Penjualan Motor</title>
<link href='./asset/css/login.css' rel='stylesheet'>
</head>
<center>
<form method="POST" action=''>
<div class="kotak_login">
<p class="tulisan_login">Silahkan Login</p><br>
<?php echo $respond ?>
<form>
<label>Username</label>
<input type="text" name="username" id="username" class="form_login" placeholder="Username....">
<label>Password</label>
<input type="password" name="password" id="password" class="form_login" placeholder="Password..">
<input type="submit" name="sigin" id="sigin" class="tombol_login" value="LOGIN">
</form>
</form>
<h5></h5>
</div>
<body>
</body>
</html>
4 Jawaban:
Harus dicek dulu di hosting, apakah display_error dan error_reportingnya sudah diaktifkan di php.ini? Sehingga bisa tau, errornya seperti apa
Tanggapan
Aktifinya gmna?
Coba cek versi phpnya gan, biasanya di hosting pakai versi PHP terbaru, kalo dari script punya agan masih pake mysql extension, dimana fungsi mysql ini sudah tidak di support di versi PHP terbaru
apakah sudah ganti password, username dan database_name sesuai yang di sediakan hosting itu koneksinya masih mengarah ke lokal komputer, secara default tanpa password.
Selain itu biasanya perusahaan hosting juga ada password khusus untuk FTP(file transfer protocol)