Header location not work - php

Hello I have a method to added text on picture:
class Generate
{
public function image($name, $surname, $city){
if (empty($_GET['name'])) {
return header("Location: https://wsaib.pl/index.php?error=name&surname=$surname&city=$city");
//exit();
} elseif(strlen(mb_strlen($_GET['name'])) > 20){
return header("Location: index.php?error=longname&surname=$surname&city=$city");
//exit();
} elseif($_GET['surname'] === null) {
return header("Location: index.php?error=surname&name=$name&city=$city");
//exit();
} elseif (strlen(mb_strlen($_GET['surname'])) > 20){
return header("Location: index.php?error=longsurname&name=$name&city=$city");
//exit();
} elseif($_GET['city'] === null) {
return header("Location: index.php?error=city&name=$name&surname=$surname");
//exit();
} elseif (strlen(mb_strlen($_GET['city'])) > 15){
return header("Location: index.php?error=longcity&name=$name&surname=$surname");
//exit();
} else {
if ((isset($_GET['send']) && $_GET['send'] == 'card') && (isset($_GET['name']) && $_GET['name'] == $name) && (isset($_GET['surname']) && $_GET['surname'] == $surname) && (isset($_GET['city']) && $_GET['city'] == $city)) {
$getName = $name;
$getSurname = $surname;
$getCity = $city;
//$getWishes = "";
$today = date("d.m.Y");
$text_length = 38;
//$textName = wordwrap($getName, $text_length, "<br />", true);
$textSurname= wordwrap($getSurname, 18, "-<br />", true);
$textCity = wordwrap($getCity, 11, "-<br />", true);
//$textN = str_replace('<br />', "\n", $textName);
$textS = str_replace('<br />', "\n", $textSurname);
$textC = str_replace('<br />', "\n", $textCity);
$picture = imagecreatefrompng("merry-christmas.png");
//$black = imagecolorallocate($picture, 0, 0, 0);
$white = imagecolorallocate($picture, 0xFF, 0xFF, 0xFF);
// zyczenia
//imagettftext($picture, 18, 2, 20, 60, $white, 'fonts/Courgette/Courgette-Regular.ttf', trim(ucfirst($textW)));
// imie i nazwisko
if (strlen($getName) >= 15 ) {
imagettftext($picture, 35, 5, 280, 540, $white, 'fonts/Cookie/Cookie-Regular.ttf', trim(ucfirst($getName)));
imagettftext($picture, 35, 5, 280, 590, $white, 'fonts/Cookie/Cookie-Regular.ttf', trim(ucfirst($textS)));
} else {
imagettftext($picture, 35, 5, 280, 540, $white, 'fonts/Cookie/Cookie-Regular.ttf', trim(ucfirst($getName . " " . $textS)));
}
// data
imagettftext($picture, 20, 0, 530, 710, $white, 'fonts/Cookie/Cookie-Regular.ttf', trim(ucfirst($textC.", ".$today)));
header("Content-type: image/png");
$generateImage = imagepng($picture, "kartka_swiateczna_wsaib.png");
//imagedestroy($picture, "kartka_swiateczna_wsaib.png");
}
}
}
public function location($getName, $getSurname, $getCity){
return header("Location: index.php?query=done&name=$getName&surname=$getSurname&city=$getCity");
}
And file form:
<?php
require_once "generator.php";
?>
<!DOCTYPE html>
<html>
<head>
<title>Kartka Świąteczna</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" >
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="Stylesheet" type="text/css" href="style.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="./bootstrap-3.3.7-dist/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="./bootstrap-3.3.7-dist/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="./bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
</head>
<body style="background-color: #c13213">
<div class="container">
<div class="row">
<div class="col-md-8">
<?php
#$getName = $_GET['name'];
#$getSurname = $_GET['surname'];
#$getCity = $_GET['city'];
if ( (isset($_GET['send']) && $_GET['send'] === 'card') && (isset($_GET['name']) && $_GET['name'] === $getName) && (isset($_GET['surname']) && $_GET['surname'] === $getSurname) && (isset($_GET['city']) && $_GET['city'] === $getCity)) {
$image = new Generate();
$image->image($getName, $getSurname, $getCity); // zamiana !!!!!!!
$image->location($getName, $getSurname, $getCity); // zamiana !!!!!!!
} if (isset($_GET['query']) && $_GET['query'] === 'done'){
$saveFile = "kartka_swiateczna_wsaib.png";
echo '<img src="' . $saveFile . '" id="kartka-photo" width="100%" height="100%"/>'; ?>
<p><a class="btn btn-success" href="kartka_swiateczna_wsaib.png" download="kartka_swiateczna_wsaib.png">Pobierz kartkę</a></p>
<?php } else { ?>
<img src="merry-christmas.png" id="kartka-photo" width="100%" height="100%">
<?php }
?>
</div>
<div class="col-md-4">
<p id="title">Zaprojektuj kartkę</p>
<form action="index.php" method="get">
<input type="text" class="form-control" placeholder="Podaj imię" id="name" name="name" value="<?php echo $getName; ?>"><div id="counterName"></div><br />
<?php if (isset($_GET['error']) && $_GET['error'] === 'name') { ?>
<div class="alert alert-danger fade in">
×
<strong><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Nie podałeś imienia.</strong>
</div>
<?php } elseif (isset($_GET['error']) && $_GET['error'] === 'longname'){ ?>
<div class="alert alert-danger fade in">
×
<strong><span class="glyphicon glyphicon-th-list" aria-hidden="true"></span> Maksymalna długość imienia to 20 znaków.</strong>
</div>
<?php } ?>
<input type="text" class="form-control" placeholder="Podaj nazwisko" id="surname" name="surname" value="<?php echo $getSurname; ?>"><div id="counterSurname"></div><br />
<?php if (isset($_GET['error']) && $_GET['error'] === 'surname') { ?>
<div class="alert alert-danger fade in">
×
<strong><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Nie podałeś nazwiska.</strong>
</div>
<?php } elseif (isset($_GET['error']) && $_GET['error'] === 'longsurname'){ ?>
<div class="alert alert-danger fade in">
×
<strong><span class="glyphicon glyphicon-th-list" aria-hidden="true"></span> Maksymalna długość nazwiska to 20 znaków.</strong>
</div>
<?php } ?>
<input type="text" class="form-control" placeholder="Podaj miasto" id="city" name="city" value="<?php echo $getCity; ?>"><div id="counterCity"></div><br />
<?php if (isset($_GET['error']) && $_GET['error'] === 'city') { ?>
<div class="alert alert-danger fade in">
×
<strong><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Nie podałeś nazwy miasta.</strong>
</div>
<?php } elseif (isset($_GET['error']) && $_GET['error'] === 'longcity'){ ?>
<div class="alert alert-danger fade in">
×
<strong><span class="glyphicon glyphicon-th-list" aria-hidden="true"></span> Maksymalna długość miasta to 15 znaków.</strong>
</div>
<?php } ?>
<button type="submit" class="btn btn-info" name="send" id="send" value="card" style="margin-bottom: 20px;">Generuj</button>
Odśwież
<?php
if (isset($_GET['query']) && $_GET['query'] === 'done') { ?>
<div class="alert alert-success fade in">
×
<strong><span class="glyphicon glyphicon-ok" aria-hidden="true"></span> Grafika została wygenerowana poprawnie, możesz ją teraz pobrać kikając na przycisk <i>Pobierz kartkę</i>.</strong>
</div>
<?php } ?>
</form>
</div>
</div>
</div>
<script type="text/javascript">
var minName = 20;
document.querySelector('#name').onkeyup = function(e){
document.querySelector('#counterName').innerHTML =
this.value.length <= minName
? 'Pozostało '+(minName - this.value.length)+' znaków.'
: 'Imię zbyt długie!';
}
var minSurname = 20;
document.querySelector('#surname').onkeyup = function(e){
document.querySelector('#counterSurname').innerHTML =
this.value.length <= minSurname
? 'Pozostało '+(minSurname - this.value.length)+' znaków.'
: 'Nazwisko zbyt długie!';
}
var minCity = 15;
document.querySelector('#city').onkeyup = function(e){
document.querySelector('#counterCity').innerHTML =
this.value.length <= minCity
? 'Pozostało '+(minCity - this.value.length)+' znaków.'
: 'Nazwa miasta zbyt długa!';
}
</script>
The problem is with function Header Location:
return header("Location: index.php?error=longcity&name=$name&surname=$surname");
In GET (in url) I have ONLY name=$name&surname=$surname but function header not returned error=longcity. Where is the problem ? When I added to url for example ?query=done script work ok. I don't know were is the error.

I found solution. I have to add at the beginning of the file index.php:
<?php ob_start(); ?>
http://php.net/manual/en/function.ob-start.php
This is very good answer: How to fix "Headers already sent" error in PHP

Related

Problem in PHP Code with installation of system

Hello i'm having trouble with the install script for my system.
Currectly i try to solve some issues, but now it left me to skip this part and make installation correctly. Can someone help me to solve the code to be correct way.
So i'm struggling in this zone: if ($action == 'result') {
So i skip check the website adress and so one and go directly to install.
But after i enter dbname, host, user, pass, admin, password it does not install the .sql file and gives me error "Database Credential is Not Valid"
<?php
$itemName = 'playlab';
error_reporting(0);
$action = isset($_GET['action']) ? $_GET['action'] : '';
function appUrl()
{
$current = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$exp = explode('?action', $current);
$url = str_replace('index.php', '', $exp[0]);
$url = substr($url, 0, -8);
return $url;
}
if ($action == 'requirements') {
$passed = [];
$failed = [];
$requiredPHP = 8.1;
$currentPHP = explode('.', PHP_VERSION)[0] . '.' . explode('.', PHP_VERSION)[1];
if ($requiredPHP == $currentPHP) {
$passed[] = 'PHP version 8.1 is required';
} else {
$failed[] = 'PHP version 8.1 is required. Your current PHP version is ' . $currentPHP;
}
$extensions = ['BCMath', 'Ctype', 'cURL', 'DOM', 'Fileinfo', 'GD', 'JSON', 'Mbstring', 'OpenSSL', 'PCRE', 'PDO', 'pdo_mysql', 'Tokenizer', 'XML'];
foreach ($extensions as $extension) {
if (extension_loaded($extension)) {
$passed[] = strtoupper($extension) . ' PHP Extension is required';
} else {
$failed[] = strtoupper($extension) . ' PHP Extension is required';
}
}
if (function_exists('curl_version')) {
$passed[] = 'Curl via PHP is required';
} else {
$failed[] = 'Curl via PHP is required';
}
if (file_get_contents(__FILE__)) {
$passed[] = 'file_get_contents() is required';
} else {
$failed[] = 'file_get_contents() is required';
}
if (ini_get('allow_url_fopen')) {
$passed[] = 'allow_url_fopen() is required';
} else {
$failed[] = 'allow_url_fopen() is required';
}
$dirs = ['../core/bootstrap/cache/', '../core/storage/', '../core/storage/app/', '../core/storage/framework/', '../core/storage/logs/'];
foreach ($dirs as $dir) {
$perm = substr(sprintf('%o', fileperms($dir)), -4);
if ($perm >= '0775') {
$passed[] = str_replace("../", "", $dir) . ' is required 0775 permission';
} else {
$failed[] = str_replace("../", "", $dir) . ' is required 0775 permission. Current Permisiion is ' . $perm;
}
}
if (file_exists('database.sql')) {
$passed[] = 'database.sql should be available';
} else {
$failed[] = 'database.sql should be available';
}
if (file_exists('../.htaccess')) {
$passed[] = '".htaccess" should be available in root directory';
} else {
$failed[] = '".htaccess" should be available in root directory';
}
}
if ($action == 'result') {
$url = 'https://license.viserlab.com/';
$params = $_POST;
$params['product'] = $itemName;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
$response = json_decode($result, true);
$response = array('error' => 'ok', 'message' => 'Valid license!');
if (#$response['error'] == 'ok') {
try {
$db = new PDO("mysql:host=$_POST[db_host];dbname=$_POST[db_name]", $_POST['db_user'], $_POST['db_pass']);
$dbinfo = $db->query('SELECT VERSION()')->fetchColumn();
$engine = #explode('-', $dbinfo)[1];
$version = #explode('.', $dbinfo)[0] . '.' . #explode('.', $dbinfo)[1];
if (strtolower($engine) == 'mariadb') {
if ($version < 10.3) {
$response['error'] = 'error';
$response['message'] = 'MariaDB 10.3+ Or MySQL 5.7+ Required. <br> Your current PHP version is MariaDB ' . $version;
}
} else {
if ($version < 5.7) {
$response['error'] = 'error';
$response['message'] = 'MariaDB 10.3+ Or MySQL 5.7+ Required. <br> Your current PHP version is MySQL ' . $version;
}
}
} catch (Exception $e) {
$response['error'] = 'error';
$response['message'] = 'Database Credential is Not Valid';
}
}
if (#$response['error'] == 'ok') {
try {
$query = file_get_contents("database.sql");
$stmt = $db->prepare($query);
$stmt->execute();
$stmt->closeCursor();
} catch (Exception $e) {
$response['error'] = 'error';
$response['message'] = 'Problem Occurred When Importing Database!<br>Please Make Sure The Database is Empty.';
}
}
if (#$response['error'] == 'ok') {
try {
$db_name = $_POST['db_name'];
$db_host = $_POST['db_host'];
$db_user = $_POST['db_user'];
$db_pass = $_POST['db_pass'];
$email = $_POST['email'];
$siteurl = appUrl();
$app_key = base64_encode(random_bytes(32));
$envcontent = "
APP_NAME=Laravel
APP_ENV=production
APP_KEY=base64:$app_key
APP_DEBUG=false
APP_URL=$siteurl
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=$db_host
DB_PORT=3306
DB_DATABASE=$db_name
DB_USERNAME=$db_user
DB_PASSWORD=$db_pass
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME='${APP_NAME}'
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY='${PUSHER_APP_KEY}'
MIX_PUSHER_APP_CLUSTER='${PUSHER_APP_CLUSTER}'
";
$envpath = dirname(__DIR__, 1) . '\core\.env';
file_put_contents($envpath, $envcontent);
} catch (Exception $e) {
$response['error'] = 'error';
$response['message'] = 'Problem Occurred When Writing Environment File.';
}
}
if (#$response['error'] == 'ok') {
try {
$db->query("UPDATE admins SET email='" . $_POST['email'] . "', username='" . $_POST['admin_user'] . "', password='" . password_hash($_POST['admin_pass'], PASSWORD_DEFAULT) . "' WHERE username='admin'");
} catch (Exception $e) {
$response['message'] = 'EasyInstaller was unable to set the credentials of admin.';
}
}
}
$sectionTitle = empty($action) ? 'Terms of Use' : $action;
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Easy Installer by ViserLab</title>
<link rel="stylesheet" href="../assets/global/css/bootstrap.min.css">
<link rel="stylesheet" href="../assets/global/css/all.min.css">
<link rel="stylesheet" href="../assets/global/css/installer.css">
<link rel="shortcut icon" href="https://license.viserlab.com/external/favicon.png" type="image/x-icon">
</head>
<body>
<header class="py-3 border-bottom border-primary bg--dark">
<div class="container">
<div class="d-flex align-items-center justify-content-between header gap-3">
<img class="logo" src="https://license.viserlab.com/external/logo.png" alt="ViserLab">
<h3 class="title">Easy Installer</h3>
</div>
</div>
</header>
<div class="installation-section padding-bottom padding-top">
<div class="container">
<div class="installation-wrapper">
<div class="install-content-area">
<div class="install-item">
<h3 class="title text-center"><?php echo $sectionTitle; ?></h3>
<div class="box-item">
<?php
if ($action == 'result') {
echo '<div class="success-area text-center">';
if (#$response['error'] == 'ok') {
echo '<h2 class="text-success text-uppercase mb-3">Your system has been installed successfully!</h2>';
if (#$response['message']) {
echo '<h5 class="text-warning mb-3">' . $response['message'] . '</h5>';
}
echo '<p class="text-danger lead my-5">Please delete the "install" folder from the server.</p>';
echo '<div class="warning">Go to website and Activate</div>';
} else {
if (#$response['message']) {
echo '<h3 class="text-danger mb-3">' . $response['message'] . '</h3>';
} else {
echo '<h3 class="text-danger mb-3">Your Server is not Capable to Handle the Request.</h3>';
}
echo '<div class="warning mt-2"><h5 class="mb-4 fw-normal">You can ask for support by creating a support ticket.</h5>create ticket</div>';
}
echo '</div>';
} elseif ($action == 'information') {
?>
<form action="?action=result" method="post" class="information-form-area mb--20">
<div class="info-item">
<h5 class="font-weight-normal mb-2">Website URL</h5>
<div class="row">
<div class="information-form-group col-12">
<input name="url" value="<?php echo appUrl(); ?>" type="text" required>
</div>
</div>
</div>
<div class="info-item">
<h5 class="font-weight-normal mb-2">Database Details</h5>
<div class="row">
<div class="information-form-group col-sm-6">
<input type="text" name="db_name" placeholder="Database Name" required>
</div>
<div class="information-form-group col-sm-6">
<input type="text" name="db_host" placeholder="Database Host" required>
</div>
<div class="information-form-group col-sm-6">
<input type="text" name="db_user" placeholder="Database User" required>
</div>
<div class="information-form-group col-sm-6">
<input type="text" name="db_pass" placeholder="Database Password">
</div>
</div>
</div>
<div class="info-item">
<h5 class="font-weight-normal mb-3">Admin Credential</h5>
<div class="row">
<div class="information-form-group col-lg-3 col-sm-6">
<label>Username</label>
<input name="admin_user" type="text" placeholder="Admin Username" required>
</div>
<div class="information-form-group col-lg-3 col-sm-6">
<label>Password</label>
<input name="admin_pass" type="text" placeholder="Admin Password" required>
</div>
<div class="information-form-group col-lg-6">
<label>Email Address</label>
<input name="email" placeholder="Your Email address" type="email" required>
</div>
</div>
</div>
<div class="info-item">
<div class="information-form-group text-end">
<button type="submit" class="theme-button choto">Install Now</button>
</div>
</div>
</form>
<?php
} elseif ($action == 'requirements') {
$btnText = 'View Detailed Check Result';
if (count($failed)) {
$btnText = 'View Passed Check';
echo '<div class="item table-area"><table class="requirment-table">';
foreach ($failed as $fail) {
echo "<tr><td>$fail</td><td><i class='fas fa-times'></i></td></tr>";
}
echo '</table></div>';
}
if (!count($failed)) {
echo '<div class="text-center"><i class="far fa-check-circle success-icon text-success"></i><h5 class="my-3">Requirements Check Passed!</h5></div>';
}
if (count($passed)) {
echo '<div class="text-center my-3"><button class="btn passed-btn" type="button" data-bs-toggle="collapse" data-bs-target="#collapsePassed" aria-expanded="false" aria-controls="collapsePassed">' . $btnText . '</button></div>';
echo '<div class="collapse mb-4" id="collapsePassed"><div class="item table-area"><table class="requirment-table">';
foreach ($passed as $pass) {
echo "<tr><td>$pass</td><td><i class='fas fa-check'></i></td></tr>";
}
echo '</table></div></div>';
}
echo '<div class="item text-end mt-3">';
if (count($failed)) {
echo '<a class="theme-button btn-warning choto" href="?action=requirements">ReCheck <i class="fa fa-sync-alt"></i></a>';
} else {
echo '<a class="theme-button choto" href="?action=information">Next Step <i class="fa fa-angle-double-right"></i></a>';
}
echo '</div>';
} else {
?>
<div class="item">
<h4 class="subtitle">License to be used on one(1) domain(website) only!</h4>
<p> The Regular license is for one website or domain only. If you want to use it on multiple websites or domains you have to purchase more licenses (1 website = 1 license). The Regular License grants you an ongoing, non-exclusive, worldwide license to make use of the item.</p>
</div>
<div class="item">
<h5 class="subtitle font-weight-bold">You Can:</h5>
<ul class="check-list">
<li> Use on one(1) domain only. </li>
<li> Modify or edit as you want. </li>
<li> Translate to your choice of language(s).</li>
</ul>
<span class="text-warning"><i class="fas fa-exclamation-triangle"></i> If any issue or error occurred for your modification on our code/database, we will not be responsible for that. </span>
</div>
<div class="item">
<h5 class="subtitle font-weight-bold">You Cannot: </h5>
<ul class="check-list">
<li class="no"> Resell, distribute, give away, or trade by any means to any third party or individual. </li>
<li class="no"> Include this product into other products sold on any market or affiliate websites. </li>
<li class="no"> Use on more than one(1) domain. </li>
</ul>
</div>
<div class="item">
<p class="info">For more information, Please Check The License FAQ</p>
</div>
<div class="item text-end">
I Agree, Next Step
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="py-3 text-center bg--dark border-top border-primary">
<div class="container">
<p class="m-0 font-weight-bold">©<?php echo Date('Y') ?> - All Right Reserved by ViserLab</p>
</div>
</footer>
<script src="../assets/global/js/bootstrap.bundle.min.js"></script>
</body>
</html>

AJAX pagination not working properly after new entry

I am having a main page "landing.php", here in a div i am calling another page using ajax function "fetch_pages.php". In fetch_pages.php, i am loading data from db as 5 records at a time, when the user reaches the end of page then next 5 records are displayed. Thats working perfectly.
But in landing.php, when i enter a new record and reload the div, then the div content becomes blank, it doesn't show the latest content, after refreshing the full page manually then its again shows all the records. Can't understand whats wrong, kindly help.
landing.php page
<div class="mainsection">
<div>
<div class="pull-left postimage"><?php echo "<img src=profile_pic/".$ProfilePic ." />"; ?></div>
<div class="pull-left posttext">
<div class="postname"><?php echo $Name; ?></div>
<p><?php echo $UT." - ".$Designation." - ".$Company; ?></p></div>
<textarea id="posting" name="posting" rows="2" cols="50" placeholder="Share something here..."></textarea>
<div class="clear"></div>
<hr>
</div>
<div class="fileUpload btn btn-default">
<span><i class="fa fa-camera-retro" style="margin-right: 6px;" aria-hidden="true"></i>Upload Image</span>
<input type="file" class="upload" />
</div>
<div>
<input class="postall btn btn-primary pull-right" type="submit" onClick="UserPost()" value="Post">
</div>
<div class="clear"></div>
</div>
<!-- Loading User Posts -->
<div id="mainsectionID">
<div id="results"><!-- results appear here as list --></div>
</div>
<script>
(function($){
$.fn.loaddata = function(options) {// Settings
var settings = $.extend({
loading_gif_url : "images/ajax-loader.gif", //url to loading gif
end_record_text : 'No more records found!', //no more records to load
data_url : 'fetch_pages.php', //url to PHP page
start_page : 1 //initial page
}, options);
var el = this;
loading = false;
end_record = false;
contents(el, settings); //initial data load
$(window).scroll(function() { //detact scroll
if($(window).scrollTop() + $(window).height() >= $(document).height()){ //scrolled to bottom of the page
contents(el, settings); //load content chunk
}
});
};
//Ajax load function
function contents(el, settings){
var load_img = $('<img/>').attr('src',settings.loading_gif_url).addClass('loading-image'); //create load image
var record_end_txt = $('<div/>').text(settings.end_record_text).addClass('end-record-info'); //end record text
if(loading == false && end_record == false){
loading = true; //set loading flag on
el.append(load_img); //append loading image
$.post( settings.data_url, {'page': settings.start_page}, function(data){ //jQuery Ajax post
if(data.trim().length == 0){ //no more records
el.append(record_end_txt); //show end record text
load_img.remove(); //remove loading img
end_record = true; //set end record flag on
return; //exit
}
loading = false; //set loading flag off
load_img.remove(); //remove loading img
el.append(data); //append content
settings.start_page ++; //page increment
})
}
}
})(jQuery);
$("#results").loaddata(); //load the results into element
</script>
fetch_pages.php code-
<?php
session_start();
include 'db.php'; //include config file
$UserID=$_SESSION['uid'];
$UserType=$_SESSION['utype'];
$GLOBALS['lks']=0;
$GLOBALS['cmnts']=0;
$GLOBALS['disabled']="";
//sanitize post value
$page_number = filter_var($_POST["page"], FILTER_SANITIZE_NUMBER_INT, FILTER_FLAG_STRIP_HIGH);
//throw HTTP error if page number is not valid
if(!is_numeric($page_number)){
header('HTTP/1.1 500 Invalid page number!');
exit();
}
//get current starting point of records
$position = (($page_number-1) * $item_per_page);
?>
<!---post start -->
<?php
//fetch records using page position and item per page.
$results = $linkID1->query("select slno,posts,img_link,video_link,likes,comments,shares,post_date,post_time,UserID from user_posts where UserID='$UserID' or UserID in(select MyFriendsUserID from user_connections where MyUserID='$UserID') or UserID in(select MyUserID from user_connections where MyFriendsUserID='$UserID') order by slno desc LIMIT $position, $item_per_page")
or
die(mysqli_error());
//output results from database
?>
<?php
while($row = mysqli_fetch_array($results))
{ //fetch values
$CUID=$row['UserID'];
$stmt = $linkID1->prepare("select Name,Company,Designation,UserType from user_details where UserID=?");
$stmt->bind_param("s", $CUID);
$stmt->execute();
$stmt->bind_result($Name2,$Company2,$Designation2,$UType);
$stmt->fetch();
$stmt->close();
$UT2='';
if($UType=='A')
{
$UT2='Advertiser';
}
else if($UType=='P')
{
$UT2='Publisher';
}
$stmt = $linkID1->prepare("select ProfilePic from user_picture where UserID=?");
$stmt->bind_param("s", $CUID);
$stmt->execute();
$stmt->bind_result($PPic);
$stmt->fetch();
$stmt->close();
?>
<div class="mainsection">
<div>
<div class="pull-left postimage"><?php echo "<img src=profile_pic/".$PPic ." />"; ?></div>
<div class="pull-left posttext">
<div class="postname"><?php echo $Name2; ?></div>
<p><?php echo $UT2." - ".$Designation2." - ".$Company2; ?></p></div>
<div class="clear"></div>
<div class="postdowntxt"><p><?php echo $row['posts']; ?></p></div>
<hr>
</div>
<div class="btnclasess" id="likescommentID<?php echo $row[slno]; ?>">
<div class="likescomment"><?php dataLC($linkID1, $row['slno'],$CUID); ?><a style="padding-right: 7px" href="#"><?php if($GLOBALS['lks']==0){echo '';}else{ echo $GLOBALS['lks']." Likes"; } ?></a><?php if($GLOBALS['cmnts']==0){echo '';}else{ echo $GLOBALS['cmnts']." Comments"; } ?></div>
<div class="pull-left likebtn"><button <?php echo $disabled; ?> class="btn" id="likeButton<?php echo $row[slno]; ?>" onClick="connect(<?php echo $row[slno]; ?>)"><i class="fa fa-thumbs-up" style="margin-right: 6px;"></i>Like</button></div>
<button class="pull-left btnhideshow show_hide" data-toggle="collapse" data-target="#demo<?php echo $row['slno']; ?>"><li class="fa fa-comments show_hide" style="margin-right: 6px;"></li>Comment</button>
<button class="pull-left btnhideshow show_hide"><li class="fa fa-share-alt show_hide" style="margin-right: 6px;"></li>Share</button>
<div class="clear"></div>
<div class="clear"></div>
</div>
<!-- Display All Comments -->
<div id="myModal<?php echo $row['slno']; ?>" class="modal">
<div id="DialogDiv<?php echo $row['slno']; ?>">
<!-- Modal content -->
<div class="modal-content" id="modalDialog<?php echo $row['slno']; ?>">
<p class="popupheading"><?php if($GLOBALS['cmnts']==0){echo '';}else{ echo $GLOBALS['cmnts']." Comments"; } ?></p>
<?php
$result2 = $linkID1->query("select upc.slno,upc.Comment,upc.CommentedUserID,up.ProfilePic from user_posts_comments upc join user_picture up on upc.CommentedUserID=up.UserID where PostID='$row[slno]' order by upc.slno")
or
die(mysqli_error());
while($row2 = mysqli_fetch_array($result2))
{
?>
<div class="pull-left commnetprofile"><?php echo "<img src=profile_pic/".$row2['ProfilePic']." />"; ?></div>
<div class="pull-right commentextstyle commentandreply">
<?php echo $row2['Comment']; ?>
</div>
<div class="pull-left likebtn"><i class="fa fa-reply" style="margin-right: 6px;"></i>Reply</div>
<!--<div class="pull-left likebtn"><i class="fa fa-thumbs-up" style="margin-right: 6px;"></i>Like</div>-->
<div class="clear"></div>
<div id="nReply2<?php echo $row2['slno']; ?>" class="collapse">
<div>
<input class="replybox" type="text" id="nReplyBox2<?php echo $row2['slno']; ?>" onkeyup="enter_reply2(<?php echo $row2['slno']; ?>,<?php echo $CUID; ?>,<?php echo $row['slno']; ?>);">
</div>
</div>
<div class="clear"></div>
<!-- Nested Comments Starts -->
<div id="NestedCmntsDialog" class="nestedcmnts">
<?php
$result3 = $linkID1->query("select upcr.slno,upcr.PostID,upcr.ReplyTo,upcr.ReplyBy,upcr.Comments,up.ProfilePic from user_posts_comments_reply upcr join user_picture up on upcr.ReplyBy=up.UserID where upcr.PostID='$row2[slno]' and (upcr.ReplyTo='$row2[CommentedUserID]' or upcr.ReplyBy='$row2[CommentedUserID]') order by upcr.slno")
or
die(mysqli_error());
while($row3 = mysqli_fetch_array($result3))
{
?>
<div class="pull-left commnetprofile"><?php echo "<img src=profile_pic/".$row3['ProfilePic']." />"; ?></div>
<div class="pull-right commentextstyle commentandreply">
<?php echo $row3['Comments']; ?>
</div>
<div class="pull-left likebtn"><i class="fa fa-reply" style="margin-right: 6px;"></i>Reply</div>
<div class="clear"></div>
<div id="nReply2<?php echo ($row3['slno'] * $row3['slno'])+$row3['PostID']; ?>" class="collapse">
<div>
<input class="replybox" type="text" id="nReplyBox2<?php echo ($row3['slno'] * $row3['slno'])+$row3['PostID']; ?>" onkeyup="enter_nested_reply2(<?php echo $row3['slno']; ?>,<?php echo $row3['ReplyBy']; ?>,<?php echo $row['slno']; ?>,<?php echo $row3['PostID']; ?>);">
</div>
</div>
<!--<div class="pull-left likebtn"><i class="fa fa-thumbs-up" style="margin-right: 6px;"></i>Like</div>-->
<div class="clear"></div>
<?php
}
?>
</div>
<!-- Nested Comments Ends -->
<?php
}
?>
<div class="invidone">Close</div>
</div>
</div>
</div>
<!-- Display All Comments -->
<div class="slidingDiv collapse" id="demo<?php echo $row['slno']; ?>">
<div class="viewallcomments">View All Comments</div>
<div class="allcomment" id="commentsLoad<?php echo $row['slno']; ?>">
<?php
$result2 = $linkID1->query("select upc.slno,upc.Comment,upc.CommentedUserID,up.ProfilePic from user_posts_comments upc join user_picture up on upc.CommentedUserID=up.UserID where upc.PostID='$row[slno]' order by upc.slno desc limit 3")
or
die(mysqli_error());
while($row2 = mysqli_fetch_array($result2))
{
?>
<!-- Showing Top 3 Comments -->
<div id="nestedReplyDiv<?php echo $row['slno']; ?>">
<div class="pull-left commnetprofile"><?php echo "<img src=profile_pic/".$row2['ProfilePic']." />"; ?></div>
<div class="pull-right commentextstyle commentandreply">
<?php echo $row2['Comment']; ?>
</div>
<div class="pull-left likebtn"><i class="fa fa-reply" style="margin-right: 6px;"></i>Reply</div>
<div class="clear"></div>
<div id="nReply<?php echo $row2['slno']; ?>" class="collapse">
<div>
<input class="replybox" type="text" id="nReplyBox<?php echo $row2['slno']; ?>" onkeyup="enter_reply(<?php echo $row2['slno']; ?>,<?php echo $CUID; ?>);">
</div>
</div>
<!--<div class="pull-left likebtn"><i class="fa fa-thumbs-up" style="margin-right: 6px;"></i>Like</div>-->
<div class="clear"></div>
<!-- Nested Comments Starts -->
<div id="NestedCmnts" class="nestedcmnts">
<?php
$result3 = $linkID1->query("select upcr.slno,upcr.PostID,upcr.ReplyTo,upcr.ReplyBy,upcr.Comments,up.ProfilePic from user_posts_comments_reply upcr join user_picture up on upcr.ReplyBy=up.UserID where upcr.PostID='$row2[slno]' and (upcr.ReplyTo='$row2[CommentedUserID]' or upcr.ReplyBy='$row2[CommentedUserID]') order by upcr.slno")
or
die(mysqli_error());
while($row3 = mysqli_fetch_array($result3))
{
?>
<div class="pull-left commnetprofile"><?php echo "<img src=profile_pic/".$row3['ProfilePic']." />"; ?></div>
<div class="pull-right commentextstyle commentandreply">
<?php echo $row3['Comments']; ?>
</div>
<div class="pull-left likebtn"><i class="fa fa-reply" style="margin-right: 6px;"></i>Reply</div>
<div class="clear"></div>
<div id="nReply<?php echo ($row3['slno'] * $row3['slno'])+$row3['PostID']; ?>" class="collapse">
<div>
<input class="replybox" type="text" id="nReplyBox<?php echo ($row3['slno'] * $row3['slno'])+$row3['PostID']; ?>" onkeyup="enter_nested_reply(<?php echo $row3['slno']; ?>,<?php echo $row3['ReplyBy']; ?>,<?php echo $row['slno']; ?>,<?php echo $row3['PostID']; ?>);">
</div>
</div>
<!--<div class="pull-left likebtn"><i class="fa fa-thumbs-up" style="margin-right: 6px;"></i>Like</div>-->
<div class="clear"></div>
<?php
}
?>
</div>
<!-- Nested Comments Ends -->
</div>
<?php
}
?>
</div>
<textarea id="commentarea<?php echo $row[slno]; ?>" class="secondtextareay pull-left" rows="2" cols="50" placeholder="Post comments here..." onkeyup="enter_comment(<?php echo $row['slno']; ?>,<?php echo $CUID; ?>);"></textarea>
<!--<div class="fileUpload second_fileupload btn btn-default pull-left">
<span><i class="fa fa-camera-retro" style="margin-right: 6px;" aria-hidden="true"></i></span>
<input type="file" class="upload" />
</div>-->
<div class="clear"></div>
</div>
</div>
<?php
}
?>
<!--post end-->
<?php
function dataLC($linkID1, $val, $CUID)
{
$UserID=$CUID;
$LgUserID=$_SESSION['uid'];
$stmt = $linkID1->prepare("select likes,comments from user_posts where slno=?");
$stmt->bind_param("s", $val);
$stmt->execute();
$stmt->bind_result($lksD,$cmntsD);
$stmt->fetch();
$stmt->close();
$GLOBALS['lks']=$lksD;
$GLOBALS['cmnts']=$cmntsD;
$stmt = $linkID1->prepare("select count(slno) from user_posts_likes where MyUserID=? and FrUserID=? and PostID=?");
$stmt->bind_param("sss", $UserID,$UserID,$val);
$stmt->execute();
$stmt->bind_result($cnt);
$stmt->fetch();
$stmt->close();
if($cnt>=1)
{
$GLOBALS['disabled']="disabled";
}
else
{
$GLOBALS['disabled']="enabled";
}
$stmt = $linkID1->prepare("select count(slno) from user_posts_likes where MyUserID=? and FrUserID=? and PostID=?");
$stmt->bind_param("sss", $UserID,$LgUserID,$val);
$stmt->execute();
$stmt->bind_result($cnt2);
$stmt->fetch();
$stmt->close();
if($cnt2>=1)
{
$GLOBALS['disabled']="disabled";
}
else
{
$GLOBALS['disabled']="enabled";
}
$stmt = $linkID1->prepare("select count(slno) from user_posts_likes where MyUserID=? and FrUserID=? and PostID=?");
$stmt->bind_param("sss", $LgUserID,$UserID,$val);
$stmt->execute();
$stmt->bind_result($cnt3);
$stmt->fetch();
$stmt->close();
if($cnt3>=1)
{
$GLOBALS['disabled']="disabled";
}
else
{
$GLOBALS['disabled']="enabled";
}
}
?>
<script>
$('.btn').on('click', function(e)
{
$(this).prop('disabled',true); });
</script>
<script>
function UserPost() {
var x = document.getElementById('posting').value;
var timezone_offset_minutes = new Date().getTimezoneOffset();
timezone_offset_minutes = timezone_offset_minutes == 0 ? 0 : -timezone_offset_minutes;
$.ajax({
type: "POST",
url: "user-post.php?p="+x+"&tz="+timezone_offset_minutes,
success: function(data) {
$("#mainsectionID").load(" #mainsectionID");
document.getElementById('posting').value='';
}
});
}
</script>
<script type="text/javascript">
function connect(num) {
$.ajax({
type: "POST",
url: "user-likes.php?id="+num,
success: function(data) {
if(data=='1')
{
$("#likescommentID"+num).load(" #likescommentID"+num);
}
}
});
}
function enter_comment(postid,userpostedid) {
if (event.keyCode == 13 && event.shiftKey) {
// shift+enter pressed
}
else if(event.keyCode == 13){
//enter key pressed
var cmnt = document.getElementById('commentarea'+postid).value;
$.ajax({
type: "POST",
url: "user-comments.php?id="+postid+"&cmnt="+cmnt,
success: function(data2) {
if(data2=='1')
{
$("#commentsLoad"+postid).load(" #commentsLoad"+postid);
$("#likescommentID"+postid).load(" #likescommentID"+postid);
}
}
});
document.getElementById('commentarea'+postid).value='';
}
else{
//nothing
}
}
</script>
<script type="text/javascript">
function enter_reply(slno,userpostedid) {
if (event.keyCode == 13 && event.shiftKey) {
// shift+enter pressed
}
else if(event.keyCode == 13){
//enter key pressed
var cmnt = document.getElementById('nReplyBox'+slno).value;
$.ajax({
type: "POST",
url: "user-comments-reply.php?id="+slno+"&cmnt="+cmnt,
success: function(data2) {
if(data2=='1')
{
$("#commentsLoad"+slno).load(" #commentsLoad"+slno);
}
}
});
document.getElementById('nReplyBox'+slno).value='';
}
else{
//nothing
}
}
function enter_reply2(slno,userpostedid,dno) {
if (event.keyCode == 13 && event.shiftKey) {
// shift+enter pressed
}
else if(event.keyCode == 13){
//enter key pressed
var cmnt = document.getElementById('nReplyBox2'+slno).value;
$.ajax({
type: "POST",
url: "user-comments-reply.php?id="+slno+"&cmnt="+cmnt,
success: function(data2) {
if(data2=='1')
{
$("#DialogDiv"+dno).load(" #DialogDiv"+dno);
//$("#modalDialog"+dno).load(" #modalDialog"+dno);
}
}
});
document.getElementById('nReplyBox2'+slno).value='';
}
else{
//nothing
}
}
</script>
<script type="text/javascript">
function enter_nested_reply(slno,userpostedid,divNo,pid) {
if (event.keyCode == 13 && event.shiftKey) {
// shift+enter pressed
}
else if(event.keyCode == 13){
//enter key pressed
var tot=(slno*slno)+pid;
var cmnt = document.getElementById('nReplyBox'+tot).value;
$.ajax({
type: "POST",
url: "user-comments-reply-nested.php?id="+slno+"&cmnt="+cmnt+"&upid="+userpostedid,
success: function(data2) {
if(data2=='1')
{
$("#nestedReplyDiv"+divNo).load(" #nestedReplyDiv"+divNo);
}
}
});
document.getElementById('nReplyBox'+tot).value='';
}
else{
//nothing
}
}
function enter_nested_reply2(slno,userpostedid,divNo,pid) {
if (event.keyCode == 13 && event.shiftKey) {
// shift+enter pressed
}
else if(event.keyCode == 13){
//enter key pressed
var tot=(slno*slno)+pid;
var cmnt = document.getElementById('nReplyBox2'+tot).value;
$.ajax({
type: "POST",
url: "user-comments-reply-nested.php?id="+slno+"&cmnt="+cmnt+"&upid="+userpostedid,
success: function(data2) {
if(data2=='1')
{
$("#DialogDiv"+divNo).load(" #DialogDiv"+divNo);
//$("#modalDialog"+divNo).load(" #modalDialog"+divNo);
}
}
});
document.getElementById('nReplyBox2'+tot).value='';
}
else{
//nothing
}
}
</script>
<script>
function LoadComment(num) {
var modal2 = document.getElementById('myModal'+num);
var span2 = document.getElementById("close3");
span2.onclick = function() {
modal2.style.display = "none";
}
window.onclick = function(event) {
if (event.target == modal2) {
modal2.style.display = "none";
}
}
var x = document.getElementById('myBtn2');
modal2.style.display = "block";
}
</script>
Problem resolved. Called the pagination again in the success method of ajax.

Register page not store data in the database

I have a problem with the register page in PHP language. When I click the submit button the form is submitting but no data is storing in the database. And can not use the registered user to login into the site. The same codes are working properly in the local server (Wampp server) but not working in the website.
these are the codes:
<?php
require_once("../includes/functions.php");
$sess_start->start_session(false);
if(check_login(1, $sess_start->get_dbhandler()) == true)
{
header('Location: userportal.php');
}
else
{
if (!empty($_POST['RegisterFname']) || !empty($_POST['RegisterLname']) || !empty($_POST['RegisterEmail']) || !empty($_POST['RegisterUsername']) || !empty($_POST['RegisterPassword']) || !empty($_POST['RegisterRPassword']) || !empty($_POST['RegisterDob']) || !empty($_POST['RegisterAddress']) || !empty($_POST['RegisterRegion']) || !empty($_POST['RegisterCountry']) || !empty($_POST['RegisterPhone']))
{
if (!empty($_POST['RegisterFname']) && !empty($_POST['RegisterLname']) && !empty($_POST['RegisterEmail']) && !empty($_POST['RegisterUsername']) && !empty($_POST['RegisterPassword']) && !empty($_POST['RegisterRPassword']) && !empty($_POST['RegisterDob']) && !empty($_POST['RegisterAddress']) && !empty($_POST['RegisterRegion']) && !empty($_POST['RegisterCountry']) && !empty($_POST['RegisterPhone']))
{
if (($_POST['RegisterPassword'] == $_POST['RegisterRPassword']))
{
if (strlen($_POST['RegisterRPassword']) >= 8)
{
$registeruser = new user();
$registeruser->nickname = clean_string($sess_start->get_dbhandler(), $_POST['RegisterUsername']);
$registeruser->sql = mysqli_query($sess_start->get_dbhandler(), "SELECT * FROM `users` WHERE n_name = '$registeruser->nickname'");
if (mysqli_num_rows($registeruser->sql) == 0)
{
$registeruser->fname = clean_string($sess_start->get_dbhandler(), $_POST['RegisterFname']);
$registeruser->lname = clean_string($sess_start->get_dbhandler(), $_POST['RegisterLname']);
$registeruser->email = clean_string($sess_start->get_dbhandler(), $_POST['RegisterEmail']);
$registeruser->password = $_POST['RegisterRPassword'];
$registeruser->password = hash('sha512', $registeruser->password);
$registeruser->dob = clean_string($sess_start->get_dbhandler(), $_POST['RegisterDob']);
$registeruser->addr = clean_string($sess_start->get_dbhandler(), $_POST['RegisterAddress']);
$registeruser->state = clean_string($sess_start->get_dbhandler(), $_POST['RegisterRegion']);
$registeruser->country = clean_string($sess_start->get_dbhandler(), $_POST['RegisterCountry']);
$registeruser->phone = clean_string($sess_start->get_dbhandler(), $_POST['RegisterPhone']);
$registeruser->regtime = time();
$registeruser->sql = mysqli_query($sess_start->get_dbhandler(), "INSERT INTO `users` (f_name, l_name, email, n_name, password, age, addr, state, country, phone, l_login, r_time) VALUES ('$registeruser->fname', '$registeruser->lname', '$registeruser->email', '$registeruser->nickname', '$registeruser->password', '$registeruser->dob', '$registeruser->addr', '$registeruser->state', '$registeruser->country', '$registeruser->phone', '0', '$registeruser->regtime')");
if (!empty($_GET['RegisterPromo']))
{
$registeruser->coupon = clean_string($sess_start->get_dbhandler(), $_POST['RegisterPromo']);
$registeruser->sql = mysqli_query($sess_start->get_dbhandler(), "UPDATE `users` SET promo = '$registeruser->coupon' WHERE n_name = '$registeruser->nickname'");
}
$_SESSION['RegisterUserError'] = 5;
header('Location: register.php');
}
else
{
$_SESSION['RegisterUserError'] = 4;
header('Location: register.php');
}
}
else
{
$_SESSION['RegisterUserError'] = 3;
header('Location: register.php');
}
}
else
{
$_SESSION['RegisterUserError'] = 2;
header('Location: register.php');
}
}
else
{
$_SESSION['RegisterUserError'] = 1;
header('Location: register.php');
}
}
else
{
echo '
meta tages and links for the stylesheets
';
?>
<?php
?>
<div class="container" id="registration-form">
<div class="image"></div>
<form role="form" class="form-signin" method="post" action="<?php echo clean_url($_SERVER['PHP_SELF']); ?>">
<section class="panel">
<div class="panel-body">
<?php
if (isset($_SESSION['RegisterUserError']))
{
if ($_SESSION['RegisterUserError'] == 1)
{
?>
<div class="alert alert-block alert-danger fade in">
<strong>Fill all mandatory fields(*) for completing user registeration</strong>
</div>
<?php
}
else if ($_SESSION['RegisterUserError'] == 2)
{
?>
<div class="alert alert-block alert-danger fade in">
<strong>Entered passwords do not match</strong>
</div>
<?php
}
else if ($_SESSION['RegisterUserError'] == 3)
{
?>
<div class="alert alert-block alert-danger fade in">
<strong>Passwords must be 8 or more character longer</strong>
</div>
<?php
}
else if ($_SESSION['RegisterUserError'] == 4)
{
?>
<div class="alert alert-block alert-danger fade in">
<strong>There is already a user exist with this same username</strong>
</div>
<?php
}
else if ($_SESSION['RegisterUserError'] == 5)
{
?>
<div class="alert alert-success fade in">
<strong>Successfully completed the user registeration. However, your account is not verified unless you complete "Know your customer" process after login to your account.</strong>
</div>
<?php
}
else
{
?>
<div class="alert alert-block alert-danger fade in">
<strong>Unexpected error occured</strong>
</div>
<?php
}
unset($_SESSION['RegisterUserError']);
}
else
{
?>
<div class="alert alert-success fade in">
<strong>Fields indicated using * are mandatory in registeration</strong>
</div>
<?php
}
?>
<div class="frm">
inputs here
</form>
<div class="form-footer">
<div class="row">
<div class="col-xs-5 col-sm-5 col-md-5">
<i class="fa fa-check"></i> Sign In
</div>
</div>
</div>
</div>
</div>
<script src="js/bootstrap.min.js"></script>
</body>
</html>
<?php
}
}
?>
if it is working on your local server, then check your web hosting service. Most Service provider will ask you to the these three things :
1.Create the database
2.Create a database user
3.Assign the user to the database
These steps could be confusing depending on your host and is usually carried out in your cpanel database page or use the database creation wizard if available.

Search is not working in laravel

I have a project in this i am stuck because i want to search by industry, educational level, Areas of Experience but it does not act in the way i want to do. I have a dropdown list named industry after selecting industry the educational level, Areas of Experience comes in a checkbox. After selecting the box i want to search and display the result. My Search controller is
public function searchProfessionals (Request $request)
{
$industry = $request->input('industry');
$educationLevels = $request->input('educationLevels');
$areasOfExperiences = $request->input('areasOfExperiences');
$startPrice = $request->input('start_price');
$endPrice = $request->input('end_price');
$meetingType = $request->input('meeting_type');
if ($meetingType == 1) {
$type = [1, 1];
} elseif ($meetingType == 2) {
$type = [2, 2];
} elseif ($meetingType === 3) {
$type = [1, 2];
} else {
$type = [1, 2];
}
$userMeetings = array();
$userRoles = array();
$users = array();
$showUsers = array();
$userHourRates = array();
$userIndus = UserIndustry::where('industry_id', $industry)->get();
$userDegrees = UserDegree::where('degree_id', $educationLevels)->get();
$userAreaOfExperiences = UserAreaOfExperience::where('area_of_experience_id', $areasOfExperiences)->get();
if (!empty($userIndus)) {
foreach ($userIndus as $userInd) {
if (!empty($userDegrees)) {
foreach ($userDegrees as $userDegree) {
if (!empty($userAreaOfExperiences)) {
foreach ($userAreaOfExperiences as $userAreaOfExperience) {
$userHourRates[] = UserTime::where('user_id', $userAreaOfExperience->user_id)->whereBetween('hour_rate', [$startPrice, $endPrice])->first();
}
}
$userHourRates[] = UserTime::where('user_id', $userDegree->user_id)->whereBetween('hour_rate', [$startPrice, $endPrice])->first();
}
}
$userHourRates[] = UserTime::where('user_id', $userInd->user_id)->whereBetween('hour_rate', [$startPrice, $endPrice])->first();
}
My blade template is
#extends ('frontends.layouts.app')
#section ('main')
<div id="content-block" class="margin-top-140">
<div class="container-fluid block custom-container">
<h3 class="block-title">Browse Professionals</h3>
<div class="block-subtitle"><span>Connect</span> <span>Learn</span> <span>Inspire</span> <span>Thrive</span> </div>
<div class="row">
{{--<form action="" method="post">--}}
<div class="col-md-2 left-feild">
<div class="margin-bottom-30">
<h3>Search Filters</h3>
</div>
#if(Auth::check() && Auth::user()->user_role->role_id == 1000000)
<div class="be-vidget">
<h3 class="letf-menu-article"> Looking To </h3>
<div class="creative_filds_block">
<div class="radio">
<label><input type="radio" name="lookingTo" onclick="lookingTo(2)"> Seek Advice</label>
</div>
<div class="radio">
<label><input type="radio" name="lookingTo" onclick="lookingTo(3)"> Share Advice</label>
</div>
</div>
</div>
<script>
function lookingTo(e) {
$.ajax({
type: 'POST',
url: '{{ URL::to('looking/to') }}/' + e,
success: function (result) {
$('#browse_professionals').html(result);
}
});
}
</script>
#endif
<div class="be-vidget">
<h3 class="letf-menu-article">Professionals</h3>
<div class="-creative_filds_block">
<div class="fp-panel-wrap">
<a class="toggle-btn active" onclick="open_industry()" href="#" data-target="#ul_industry" id="a_industry">Industry</a>
<ul id="ul_industry" class="fp-panel open" style="overflow:scroll; height:200px;">
#if(!empty($industries))
#foreach($industries as $industry)
<li value="{{ $industry->id }}">{{ (!empty($industry['name'])) ? $industry['name'] : '' }} </li>
#endforeach
#endif
</ul>
<script>
function industry_search(e) {
$.ajax({
type: 'POST',
url: '{{ URL::to('professionals/industry') }}/' + e,
success: function (result) {
$('#education_experience').html(result);
$('#a_industry').attr('class', 'toggle-btn');
$('#ul_industry').css('display', 'none');
$('#education_experience').css('display', 'block');
$('#eduLevel').css('display', 'block');
$('#areaExperience').css('display', 'block');
}
});
}
function open_industry() {
$('#education_experience').css('display', 'block');
$('#education_experience').css('display', 'block');
$('#eduLevel').css('display', 'none');
$('#areaExperience').css('display', 'none');
}
</script>
<div id="education_experience" style="">
<a id="a_education" class="toggle-btn" href="#" data-target="#eduLevel">Education Level</a>
<ul id="eduLevel" class="no-link fp-panel" style="overflow:scroll; height:200px;">
#if(!empty($degrees))
#foreach($degrees as $degree)
<li value="{{ $degree->id }}">{{ (!empty($degree['name'])) ? $degree['name'] : '' }}</a> </li>
#endforeach
#endif
</ul>
<a id="a_experience" class="toggle-btn" href="#" data-target="#areaExperience">Areas of Experience</a>
<ul id="areaExperience" class="no-link fp-panel" style="overflow:scroll; height:200px;">
</ul>
</div>
</div>
</div>
</div>
<div class="be-vidget">
<h3 class="letf-menu-article">Meeting Preferences</h3>
<label>Price</label>
<br> <br>
<input type="hidden" id="price_ranger" class="range-slider" value="23"/>
<label style="margin-top: 30px;">Type</label>
<div class="form-group">
<select class="form-input" id="meeting_type">
<option value="3">All</option>
<option value="1">Phone Meeting</option>
<option value="2">Web Meeting</option>
</select>
</div>
</div>
<button id="search_professionals" type="button" class="btn color-2 size-2 btn-block hover-1">Apply Filter</button>
#if(Session::has('remove_filter'))
<button type="button" class="btn btn-danger size-2 btn-block hover-1">Remove Filter</button>
#endif
<script>
var industry = '';
$('#ul_industry li').click(function() {
industry = $(this).attr('value');
// console.log(industry);
});
$("#search_professionals").click(function () {
var degrees = new Array();
$('input[name="degrees_checkbox"]:checked').each(function() {
degrees.push(this.value);
});
var experiences = new Array();
$('input[name="experiences_checkbox"]:checked').each(function() {
experiences.push(this.value);
});
var price_ranger = $("#price_ranger").val();
var price_ranger_array = price_ranger.split(",");
var start_price = price_ranger_array[0];
var end_price = price_ranger_array[1];
var meeting_type = $("#meeting_type").val();
$.ajax({
'type' : 'post',
'url' : '{{ URL::to('search/professionals') }}',
'data' : {
'industry' : industry,
'educationLevels' : degrees,
'areasOfExperiences' : experiences,
'start_price' : start_price,
'end_price' : end_price,
'meeting_type' : meeting_type
},
'success' : function (result) {
console.log(result);
$('#browse_professionals').html(result);
}
});
});
</script>
</div>
{{--</form>--}}
<div class="col-md-10">
<div id="browse_professionals" class="row _post-container_">
#if (!empty($valid_providers))
#foreach ($valid_providers as $provider)
<div class="category-1 custom-column-5">
<div class="be-post">
<figure class="ratio-4-3 be-img-block-alt">
<div class="ratio-inner" style="background-image: url('{{ !empty($provider->user_detail->avatar) ? URL::to($provider->user_detail->avatar) : '' }}')">
<img src="{{ !empty($provider->user_detail->avatar) ? URL::to($provider->user_detail->avatar) : '' }}" alt="{{ !empty($provider->username) ? URL::to($provider->username) : '' }}">
</div>
</figure>
<div class="be-post-title">{{ (!empty($provider->user_share->share)) ? str_limit($provider->user_share->share, 90) : '' }}</div>
<div class="author-post">
<span>{{ !empty($provider->user_detail->first_name) ? $provider->user_detail->first_name : '' }} {{ !empty($provider->user_detail->last_name) ? $provider->user_detail->last_name : '' }}</span>
</div>
<span>{{ (!empty($provider->user_detail->credentials)) ? str_limit($provider->user_detail->credentials, 25) : '' }}</span>
<div data-value="4" class="static-rating"></div>
<div class="info-block clearfix">
<a class="btn color-1 size-2 hover-1 pull-right" href="{{ !empty($provider->username) ? URL::to($provider->username) : '' }}">Contact</a>
<h3 class="rate"> ${{ (!empty($provider->user_time->hour_rate)) ? $provider->user_time->hour_rate : '' }} /hr</h3>
</div>
</div>
</div>
#endforeach
#endif
</div>
</div>
</div>
</div>
</div>
#endsection
please help me. I am stuck this very badly. Sorry for my bad English
The answer will be
public function searchProfessionals(Request $request)
{
$industry = $request->input('industry');
$educationLevels = $request->input('educationLevels');
$areasOfExperiences = $request->input('areasOfExperiences');
$startPrice = $request->input('start_price');
$endPrice = $request->input('end_price');
$meetingType = $request->input('meeting_type');
$userDetails = array();
$userMeetings = array();
$userRoles = array();
$users = array();
$showUsers = array();
$userHourRates = array();
$userDegrees = array();
$userIndustryArray = array();
$userExperience = array();
$userAr = array();
$data['usersDegress'] = '';
$data['usersExperience'] = '';
$intersect_array = array();
$data['userDetails'] = UserDetail::all();
$data['userTime'] = UserTime::whereBetween('hour_rate',[$startPrice,$endPrice])->get();
$userPriceArray = array();
foreach ($data['userTime'] as $price) {
foreach ($data['userDetails'] as $userDetail) {
if ($price->user_id == $userDetail->user_id) {
$userPriceArray[] = $userDetail;
}
}
}
$newArray = array();
$data['userMeeting'] = UserMeeting::where('meeting_id', $meetingType)->get();
foreach ($userPriceArray as $price) {
foreach ($data['userMeeting'] as $meet) {
if ($price->user_id == $meet->user_id) {
$newArray[] = $price;
}
}
}
if(!empty($industry)) {
$data['userIndustry'] = UserIndustry::where('industry_id',$industry)->get();
foreach ($data['userIndustry'] as $userIn){
foreach ($newArray as $new){
if($new->user_id == $userIn->user_id){
$userIndustryArray[] = $new ;
}
}
}
if(count($educationLevels) >0){
$data['usersDegress'] = UserDegree::whereIn('degree_id',$educationLevels)->get();
foreach ($data['usersDegress'] as $education ){
foreach ($userIndustryArray as $n){
if($n->user_id == $education->user_id){
$userDegrees[] = $n ;
}
}
}
}
if(count($areasOfExperiences) >0){
$data['usersExperience'] = UserAreaOfExperience::whereIn('area_of_experience_id',$areasOfExperiences)->get();
foreach ($data['usersExperience'] as $experience ){
foreach ($userIndustryArray as $ex){
if($ex->user_id == $experience->user_id){
$userExperience[] = $ex ;
}
}
}
}
}else{
$userIndustryArray = $newArray ;
}
if(count($educationLevels)> 0 && count($areasOfExperiences) >0) {
$intersect_array = array_intersect ($userDegrees,$userExperience);
$userIndustryArray =$intersect_array;
}else if(count($educationLevels) == 0 && count($areasOfExperiences) >0) {
$intersect_array = $userExperience;
$userIndustryArray =$intersect_array;
}
else if(count($educationLevels)> 0 && count($areasOfExperiences) == 0) {
$intersect_array = $userDegrees;
$userIndustryArray =$intersect_array;
}else if(count($educationLevels) == 0 && count($areasOfExperiences) == 0) {
$userIndustryArray =$userIndustryArray;
}
$string = '' ;
foreach ($userIndustryArray as $item){
$userRatingShow = Review::where('provider_id',$item->user_id)->avg('rating');
if(empty($userRatingShow)){
$userRatingShow = 0;
}
$avatar = '';
$name = '';
$user = User::find($item->user_id) ;
if(!empty($user)){
$name = $user->username ;
}
if(!empty($item->avatar )){
$avatar = url($item->avatar);
}else{
}
$userTime= UserTime::where('user_id',$item->user_id)->orderby('id','desc')->first();
if(!empty($userTime)){
$userTimeShow = $userTime->hour_rate ;
}
$bio = '';
$user_share = UserShare::where('user_id',$item->user_id)->orderby('id','desc')->first();
if(!empty($user_share)) {
$bio =str_limit($user_share->share,85);
}
$string .= '<div class="category-1 custom-column-5">
<div class="be-post">
<figure class="ratio-4-3 be-img-block-alt">
<div class="ratio-inner" style="background-image: url(' . $avatar . ')">
<img src="' . $avatar . '" alt="omg">
</div>
</figure>
<div class="be-post-title">' . $bio . '</div>
<div class="author-post">
<span>
<a href="' . url($name) . '">' .
$item->first_name . ' ' . $item->last_name . '
</a>
</span>
</div>
<span>' . $item->credentials . '</span>
</div>
<div data-value="' . $userRatingShow . '" class="static-rating"></div>
<div class="info-block clearfix">
<a class="btn color-1 size-2 hover-1 pull-right" href="' . url($name) . '">Contact</a>
<h3 class="rate">$' . $userTimeShow . '/hr</h3>
</div>
</div>
</div>
';
}
if(!empty($string)) {
return response($string);
}else{
echo '<div class="text-center margin-top-140"><h2>Sorry, no members meet your criteria.</h2></div>';
echo '<div class="text-center margin-top-50"><h2>Please revise your search.</h2></div>';
}
}

Division by zero in code

I have been working on a site. It displays the following error,
Warning: Division by zero in
/home/sunshine/public_html/wp-content/themes/DailyDeal/index.php on
line 63
Now I went to check the index.php file but on line 63 I have nothing but a closing brace (})
I would be very thankful if someone could point out the error here(I have tried deactivating all the plugins but the problem still holds).
Below is the complete index.php for the reference,
<?php get_header(); ?>
<script type="text/javascript" >
var root_path_js = '<?php echo get_option('siteurl')."/";?>';
</script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/library/js/jquery-ui-1.8.14.custom.min.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/timer.js"></script>
<script type="text/javascript">
jQuery.noConflict();
function a()
{
return false;
}
jQuery(function() {
jQuery( "#slider-range-min-var" ).slider({
range: "min",
value: jQuery("#sellsqlinfo1").val(),
min: 0,
max: jQuery("#noofcoupon1").val(),
enable: false,
slide: function( event, ui ) {
jQuery("#amount").val("$"+ ui.value );
}
});
jQuery( "#amount" ).val( "$" + jQuery( "#slider-range-min-var" ).slider( "value" ) );
});
</script>
<?php
/* Mail To Friend BOF */
if($_POST['sendact']=='email_frnd') {
require_once (TEMPLATEPATH . '/monetize/send_to_friend/email_friend_frm.php');exit;
}
/* Mail To Friend EOF */
/* Home Page Deal Display BOF */
global $wpdb,$deal_db_table_name;
$postmeta_db_table_name = $wpdb->prefix."postmeta";
$post_db_table_name = $wpdb->prefix."posts";
$destination_path = site_url().'/wp-content/uploads/';
$args = array('numberposts' => 1,'meta_key' =>'is_expired' , 'meta_value' =>'0','post_status' => 'publish','post_type' => 'seller','meta_key' =>'status' , 'meta_value' =>'2' ,'orderby' => 'DESC');
$recent_posts = get_posts( $args );
if(mysql_affected_rows() > 0) { // 1st IF Condition BOF
$post_large = bdw_get_images($destination_path.get_post_meta($post->ID,'file_name',true),'large');
$post_images = bdw_get_images($destination_path.get_post_meta($post->ID,'file_name',true),'thumb'); ?>
<div class="top_content">
<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('home_above')) { } else { }?>
</div>
<!-- top content #end -->
<div class="box_header"></div>
<div class="box_bg">
<div class=" box_bottom">
<?php foreach( $recent_posts as $post ){ // foreach loop BOF
if((get_post_meta($post->ID,'status',true) == 2) && (get_post_meta($post->ID,'is_expired',true) == 0)) {
deal_expire_process($post->ID);
$home_deal_id = $post->ID;
global $home_deal_id;
$coupon_website= get_post_meta($post->ID,'coupon_website',true);
$owner_name= get_post_meta($post->ID,'owner_name',true);
$our_price= get_post_meta($post->ID,'our_price',true);
$current_price= get_post_meta($post->ID,'current_price',true);
$sellsql = "select count(*) from $transection_db_table_name where post_id=".$post->ID." and status=1";
$totdiff = $current_price - $our_price;
$percent = $totdiff * 100;
$percentsave = $percent/$current_price;
$sellsqlinfo = $wpdb->get_var($sellsql);
$date = get_post_meta($post->ID,'coupon_end_date_time',true);
$tardate= date("F d, Y H:i:s",get_post_meta($post->ID,'coupon_end_date_time',true));
$stdate= date("F d, Y H:i:s",get_post_meta($post->ID,'coupon_start_date_time',true));
$tardate1= date("F d, Y",get_post_meta($post->ID,'coupon_end_date_time',true));
if(get_post_meta($post->ID,'coupon_end_date_time',true) != "") {
if(date("Y-m-d H:i:s") >= $tardate1 && get_post_meta($post->ID,'enddate',true) != '0' || (get_post_meta($post->ID,'no_of_coupon',true)==$sellsqlinfo)) {
if(get_post_meta($post->ID,'is_expired',true)== '0' || get_post_meta($post->ID,'is_expired',true)== '') {
update_post_meta($post->ID,'is_expired','1');
}
}
} else {
if(get_post_meta($post->ID,'enddate',true) != '0' || (get_post_meta($post->ID,'no_of_coupon',true)==$sellsqlinfo)) {
if(get_post_meta($post->ID,'is_expired',true)== '0' || get_post_meta($post->ID,'is_expired',true)== '') {
update_post_meta($post->ID,'is_expired','1');
}
}
}
$geo_longitude = get_post_meta($post->ID,'geo_longitude',true);
$geo_latitude = get_post_meta($post->ID,'geo_latitude',true);
$shhiping_address = get_post_meta($post->ID,'shhiping_address',true);
$coupon_type = get_post_meta($post->ID,'coupon_type',true);
$no_of_coupon = get_post_meta($post->ID,'no_of_coupon',true); ?>
<div class="content_left"> <a href="<?php the_permalink(); ?>">
<?php if(get_post_meta($post->ID,'file_name',true) != "") { ?>
<img src="<?php echo templ_thumbimage_filter(get_post_meta($post->ID,'file_name',true),'&w=330&h=250&zc=1&q=80');?>" alt="" />
<?php } else { ?>
<img src="<?php echo templ_thumbimage_filter(get_template_directory_uri()."/images/no-image.png",'&w=330&h=250&zc=1&q=80');?>" alt="" />
<?php } ?>
</a> </div>
<div class="content_right">
<span class="title_yellow">Today's Top Cruise Holiday Deal</span>
<h3><?php echo $post->post_title; ?></h3>
<?php if(date("Y-m-d H:i:s")>= date("Y-m-d H:i:s",get_post_meta($post->ID,'coupon_end_date_time',true))){
if(get_post_meta($post->ID,'is_expired',true)=='1' || get_post_meta($post->ID,'no_of_coupon',true)==$sellsqlinfo) {
?>
<div class="i_expire"><?php _e('This deal has','templatic');?><span><?php _e(' expired','templatic');?></span><?php _e('on','templatic');?>
<span><?php echo $tardate1;?></span></div>
<?php }
} else {
if(get_post_meta($post->ID,'coupon_end_date_time',true)){ ?>
<div id="demo" style="pointer-events:none; cursor:default;">
<div id="slider-range-min-var" ></div>
</div>
<div class="deal_time_box">
<div class="time_line"></div>
<div id="countdowncontainer"></div>
<script type="text/javascript">
var dealexpire=new cdtime("countdowncontainer", "<?php echo $tardate; ?>")
dealexpire.displaycountdown("days", formatresults)
</script>
<div class="fr">
<div class="price_main"> <span class="strike_rate"><?php echo get_currency_sym();?><?php echo $current_price;?></span> <span class="rate"><?php echo get_currency_sym();?><?php echo $our_price;?></span> </div>
<?php if(get_post_meta($post->ID,'coupon_type',true) == 1) { ?>
<?php _e(BUY_NOW,'templatic');?>
<?php } else { ?>
<?php _e(BUY_NOW,'templatic');?>
<?php }?>
</div>
</div>
<?php } ?>
<?php } ?>
<!-- Rate Summery BOF -->
<ul class="rate_summery border_bottom">
<li class="rate_current_price"><span><?php _e(CURRENT_PRICE,'templatic');?></span> <strong><small><?php echo get_currency_sym();?></small><?php echo $current_price;?></strong></li>
<li class="rate_our_price"><span><?php _e(OUR_PRICE,'templatic');?></span> <strong><small><?php echo get_currency_sym();?></small><?php echo $our_price;?></strong></li>
<li class="rate_percentage"><span><?php _e(YOU_SAVE,'templatic');?></span> <strong><?php echo #number_format($percentsave,2);?>%</strong></li>
<?php if($sellsqlinfo == 0 ) {
$enddate = explode(" ",$tardate);
$curdate = explode(" ",date("F d, Y H:i:s"));
$enddate= str_replace(",","",$enddate[1]);
$curdate = str_replace(",","",$curdate[1]);
$startdate = explode(" ",$stdate);
$strdate = str_replace(","," ",$startdate[1]);
$curtime = $enddate - $curdate;
$totaltime = ($enddate - $strdate);
$nowremail = $curdate - $strdate; ?>
<input type="hidden" value="<?php echo $nowremail ; ?>" name="sellsqlinfo1" id="sellsqlinfo1"/>
<input type="hidden" value="<?php echo ($enddate - $strdate) ; ?>" name="noofcoupon1" id="noofcoupon1"/>
<?php } else { ?>
<input type="hidden" value="<?php echo $sellsqlinfo; ?>" name="sellsqlinfo1" id="sellsqlinfo1"/>
<input type="hidden" value="<?php echo $no_of_coupon; ?>" name="noofcoupon1" id="noofcoupon1"/>
<?php } ?></li>
</ul>
<?php if(get_post_meta($post->ID,'enddate',true) == '0' && get_option('ptttheme_view_opt') != 'Grid View' && (get_post_meta($post->ID,'status',true) == '1' || get_post_meta($post->ID,'status',true) == '2') ) {
?>
<?php if(get_post_meta($post->ID,'coupon_type',true) == 1) {?>
<?php _e(BUY_NOW,'templatic');?>
<?php } else { ?>
<?php _e(BUY_NOW,'templatic');?>
<?php }
}?>
<!-- Rate Summery EOF -->
<div id="content" class="text_content" ><?php echo "".$post->post_excerpt.""; ?>
<?php _e(get_option('ptthemes_content_excerpt_readmore'));?> </div>
</div>
<!-- Social Network Button Like: twitter,facebook,google + one BOF -->
<div class="share_div index_share_spacer">
<div class="twitt_like"><?php templ_show_twitter_button(); ?></div>
<div class="googleplus">
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<script type="text/javascript">
gapi.plusone.render(gcontent,"href": "<?php the_permalink(); ?>", "state": "on");
gapi.plusone.go("gcontent");
</script>
<div id="gcontent">
<g:plusone href="<?php the_permalink(); ?>" size="medium"></g:plusone>
</div>
</div>
<?php templ_show_facebook_button(); ?>
<?php _e(MAIL_TO_FRIEND,'templatic');?>
</div>
<!-- Social Network Button Like: twitter,facebook,google + one EOF -->
<?php } else { ?>
<div class="content_left">
<h3><?php echo _e(NO_RECENT_DEAL,'templatic'); ?></h3>
</div>
<?php }
} // foreach loop BOF
} // 1st IF Condition EOF
/* Home Page Deal Display EOF */ ?>
</div>
</div>
<!-- main post #end -->
<div class="clear">
<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('home_below')) { } else { }?>
</div>
<?php include_once (TEMPLATEPATH . '/monetize/send_to_friend/popup_frms.php');?>
<?php get_footer(); ?>
Your divide by zero is inside the include from line 61. Post that code if you still cant find the problem.
So let's be very careful in our codes having numerical divisions because any number divided by zero is undefined. Try it in any device - your phone, your calculator, etc.
This ternary condition could help, but don't force 0 (zero) to be the value of $percentsave when $current_price equals 0. This will ruin the semantic logic of your application.
$percentsave = ($current_price != 0) ? $percent/$current_price : 'undefined';
However, regarding your query -- why its showing in line 63, perhaps you have a code wrapping with your IDE (php specific codes) and that part of the code can be seen in line 63.

Categories