Skip to content

Instantly share code, notes, and snippets.

View secureboot.php
public function boot()
{
if(env('APP_ENV') == 'production') {
\URL::forceScheme('https');
}
}
View secureapp.blade.php
<link rel="dns-prefetch" href="//fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
<script defer src="{{secure_asset('js/all.js')}}" crossorigin="anonymous"></script>
<!-- Styles -->
<link href="{{secure_asset('css/app.css')}}" rel="Stylesheet">
<link rel="stylesheet" href="{{secure_asset('css/intlTelInput.css')}}">
<link href="{{secure_asset('css/select2.min.css')}}" rel="stylesheet" />
</head>
<body>
View TrustProxies.php
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array|string
*/
protected $proxies = '*';
/**
View multi_search_table_blog.sql
--
-- Table structure for table `tbl_blog`
--
CREATE TABLE IF NOT EXISTS `tbl_blog` (
`blog_id` int(11) NOT NULL AUTO_INCREMENT,
`blog_title` varchar(300) NOT NULL,
`blog_link` varchar(100) NOT NULL,
PRIMARY KEY (`blog_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=40 ;
--
View multi-search-index.php
<?php
$connect = mysqli_connect("localhost", "root", "", "auto_refresh");
if(isset($_POST["submit"]))
{
if(!empty($_POST["search"]))
{
$query = str_replace(" ", "+", $_POST["search"]);
header("location:index.php?search=" . $query);
}
}
View auto-load-table-post.sql
CREATE TABLE `tbl_post` (
`post_id` int(11) NOT NULL,
`post_name` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
View auto-load-display.php
<?php
//fetch.php
$connect = mysqli_connect("localhost", "root", "", "auto_refresh");
$query = "SELECT * FROM tbl_post ORDER BY post_id DESC";
$result = mysqli_query($connect, $query);
if(mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_array($result))
{
echo '<p>'.$row["post_name"].'</p>';
View auto-load-post.php
<?php
//insert.php
if(isset($_POST["post_name"]))
{
$connect = mysqli_connect("localhost", "root", "", "auto_refresh");
$post_name = mysqli_real_escape_string($connect, $_POST["post_name"]);
$sql = "INSERT INTO tbl_post (post_name) VALUES ('".$post_name."')";
mysqli_query($connect, $sql);
}
View auto-load-index.php
<html>
<head>
<title>Auto Refresh Div Content Using jQuery and AJAX</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<style>
body
{
margin:0;
View .htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]