• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

RESOLVED Can't access my site on every pages/post

Messages
1
Likes
0
Points
1
#1
I have some problem for this plugin.
1) I'd try to make an order form on my wordpress site that must use PHP code. When I creating PHP Code in text editor Gutenberg on Wordpress 5.0.2, I used code [insert_php] [/insert_php] for alternate of <php ?> then wordpress can't saving or publishing it page even through I get preview mode then it's code is work corectly. But the problem is I can't publish my new page even I use that's alternate code.
2) After that I tried to put that code on snippet and it has work as I hope:) then I tried to delete a database that I didn't use at all from cPanel, but, I've got blank page with “Koneksi gagal” words on every pages of my wordpress. I think it can be happened 'cause I deleted a database, but I wrong because it is nothing in deleted database.

*sorry for my bad english, I hope u understand what I mean:)

The deleted database is "aqiqahbe_input-form"
Database I used is "aqiqahbe_orderan"

This my snippet code :

PHP:
$host =”localhost”; //host server
$user =”aqiqahbe”; //user login phpMyAdmin
$pass =”1Cgf5kO1n5″; //pass login phpMyAdmin
$db =”aqiqahbe_orderan”; //nama database
$conn = mysqli_connect($host, $user, $pass, $db) or die (“Koneksi gagal”);

if($_SERVER[‘REQUEST_METHOD’] == “POST”){
$name = $_REQUEST[‘nama’];
$pkt = $_REQUEST[‘paket’];
$tlp = $_REQUEST[‘telp’];
$imail = $_REQUEST[’email’];
$hr = $_REQUEST[‘tanggal’];
$jam = $_REQUEST[‘waktu’];
$alm = $_REQUEST[‘alamat’];
$cttn = $_REQUEST[‘catatan’];
$submit = $_REQUEST[‘submit’];
function ubahTanggal($hr){
$pisah = explode(‘/’,$hr);
$array = array($pisah[2],$pisah[0],$pisah[1]);
$satukan = implode(‘-‘,$array);
return $satukan;
}
$tgl = ubahTanggal($hr);
$mysqli = “INSERT INTO order_tabel (nm, paket, tlp, mail, tgl, wkt, addr, note) VALUES (‘$name’, ‘$pkt’, ‘$tlp’,’$imail’,’$tgl’,’$jam’,’$alm’,’$cttn’)”;
if(isset($submit)){
if(empty($name) or empty($pkt) or empty($tlp) or empty($tgl) or empty($jam) or empty($alm)){
echo “<script>window.alert(‘Maaf, form tidak boleh kosong…’)</script>”;
} else {
$result = mysqli_query($conn, $mysqli);
}
if ($result) {
echo ”<center>Pemesanan berhasil<br>Silakan segera hubungi kontak kami untuk konfirmasi pemesanan</center>”;
} else {
echo “<center>Pemesanan gagal<br>Mohon coba lagi</center>”;
}
}
mysqli_close($conn);
}
e2.PNG
 
Last edited:

Kirill

Support team
Messages
82
Likes
4
Points
8
#2
Hello

1) Unfortunately, the old syntax with [insert_php] creates various problems and is deprecated. It is recommended to use snippets.
2) "Koneksi gagal". Anyway check the database credentials. Or maybe you have another snippet that use deleted database.
3) "On every pages of my wordpres". Yes, it's bug if option "run everywhere" not used. For fix it read the post .

For avoid error and get access to the site you may use secure mode. It temporary disable all snippets.
a) Go to the safe mode by this link: http://your-site-name.dev/wp-admin/?wbcr-php-snippets-safe-mode
b) Edit the snippet
c) Leave safe mode by clicking the link: http://your-site-name.dev/wp-admin/?wbcr-php-snippets-disable-safe-mode

Best regards