This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
if ($http_x_forwarded_proto = "http") { | |
return 301 https://$server_name$request_uri; | |
} | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream app { | |
# Path to Unicorn SOCK file, as defined previously | |
server unix:/var/www/APP_NAME/shared/sockets/unicorn.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
#listen [::]:80 default_server ipv6only=on; | |
root /var/www/APP_NAME/public; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'config.php'; | |
/* QUERY SELECT */ | |
$sql = "SELECT kurs FROM kurs WHERE valas = 'USD'"; | |
$stmt = $pdo->prepare($sql); | |
$stmt->execute(); | |
$pkurs = $stmt->fetch(PDO::FETCH_ASSOC); | |
$post_kurs = $pkurs['kurs']; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import MySQLdb as mdb | |
import sys | |
try: | |
con = mdb.connect('localhost', 'USERNAME MYSQL', 'PASSWORD MYSQL', 'NAMA DATABASE'); | |
cur = con.cursor() | |
cur.execute("SELECT VERSION()") | |
ver = cur.fetchone() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
#listen 80 default_server; if default server | |
root /var/www/DOMAIN; | |
index index.php index.html index.htm; | |
server_name DOMAIN.COM www.DOMAIN.COM; | |
if ($http_x_forwarded_proto = "http") { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Database Access Object | |
class dao { | |
private $db = NULL; | |
private $connection_string = NULL; | |
private $db_type = DB_TYPE; | |
private $db_path = DB_PATH; | |
private $db_host = DB_HOST; | |
private $db_user = DB_USER; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
if(!$_SESSION['logged']){ | |
header("Location: signin.php"); | |
exit; | |
} | |
// Setelah berhasil login | |
require_once 'php/config.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://stackoverflow.com/questions/14094697/javascript-how-to-create-new-div-dynamically-change-it-move-it-modify-it-in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="javascript:doSomething();"> | |
<script> | |
$(function(){ | |
$( "#target" ).on("click",function(){ | |
$("#successModal").modal(); | |
}); | |
}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
listen [::]:80; | |
server_name your-domain.name; | |
location / { | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |