Miss code g-recaptcha in php - php

well i have change this php to work with google recaptcha and i tank so i miss something here in the code can some one help me to solve that please.
I Have Implement My Self But I Miss Something In Integration Can Some One Help To Solve That
the code is:
<!DOCTYPE html>
<html>
<head>
<title><?php echo $settings["title"]?></title>
<link rel="stylesheet" href="style/css/bootstrap.min.css" media="screen">
<link rel="stylesheet" href="style/css/bootstrap.css" media="screen">
<link rel="stylesheet" href="style/css/myCssClass.css" media="screen">
<style>
.color-title{
color:<?php echo $settings["title_color"];?>;
}
.color-subtitle{
color:<?php echo $settings["subtitle_color"];?>;
}
.color-background-body{
<?php if($settings["background_image_selected"]=="true") {?>
background-image: url(<?php echo $settings["background_image"];?>);
<?php } else{ ?>
background-color:<?php echo $settings["background_color"];
}?>;
}
</style>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body class="color-background-body">
<div class ="container-fluid">
<h1 class="text-center color-title"><?php echo $settings["title"];?></h1>
<h3 class="text-center color-subtitle"><?php echo $settings["subtitle"];?></h3>
<div class="row">
<div class="col-sm-3 col-md-2 hidden-xs">
<!-- Insert your left vertical google ad Code below this comment-->
<?php echo $settings["left_vertical_ad"];?>
</div>
<div class="col-sm-6 col-md-8 text-center">
<div class="top-banner">
<!-- Insert your top horizontal google ad Code below this comment (Recommended size 728x90)-->
<?php echo $settings["top_horizontal_ad"];?>
</div>
<div><strong><p class="alert alert-info">Your possible rewards <?php echo $rewards["reward_list_html"]; ?></p></strong></div>
<div>
<strong><p>Earning bitcoins is simple:</p></strong>
</div>
<?php echo $view['main']['result_html']; ?>
<?php echo $view['main']['ref_link']; ?>
<!-- Insert your second horizontal google ad Code below this comment (Recommended size 320x100)-->
<?php echo $settings["middle_horizontal_ad"]; ?>
<form method="Post">
<div >
<div><label>Insert your email:</label>
<center><center><input name="username" id="username" class="form-control text-center" type="text" style="width: 450px; placeholder="Enter your email"></div>
</div><br>
<div></center>
<center>
<div class="g-recaptcha" data-sitekey="6Ld_7RwTAAAAAB3OYJE8jJtqcbg-PQ3STA-VU8G7"></div>
<br/>
<input type="submit" value="submit" />
</form>
</div>
</body>
<br>
<!-- Insert your rectangle google ad Code below this comment (Recommended size 300x250)-->
<?php echo $settings["bottom_horizontal_ad"];?>
<div id="description">
<strong><p><?php echo $settings["main_content"];?></p></strong>
</div>
</div>
<div class="col-sm-3 col-md-2 hidden-xs zeta">
<!-- Insert your right vertical google ad Code below this comment-->
<?php echo $settings["right_vertical_ad"];?>
</div>
</div>
<footer><strong><p class="text-center">Copyright © 2016 <?php echo $settings["title"];?> <a href=<?php echo $settings["contact_mail"];?>>Contact us</a></p></strong></footer>
</div>
</body>
</html>

Related

Receiving blank view with status code 200 in vagrant

I am very new to Laravel and I have been given a very old project and asked to use vagrant/homestead. The project uses php7.2 and doesn't have php artisan. It also doesn't have public folder. The problem is that the I am getting a blank view with status code 200. My homestead.yaml is:
folders:
- map: C:\Users\Desktop\school_erp_lms
to: /home/vagrant/school_lms
sites:
- map: school-lms.test
to: /home/vagrant/school_lms
php: "7.2"
databases:
- u789138695_schoolerp
route.php is:
Route::get('/login','LoginController#index');
LoginController is:
<?php
namespace App\Http\Controllers;
use View;
class LoginController extends Controller
{
public $data = array();
public function __construct()
{
$this->panelInit = new \DashboardInit();
$this->data['panelInit'] = $this->panelInit;
}
public function index()
{
return View::make('login', $this->data);
}
}
.env is:
DB_NAME=u789138695
DB_USERNAME=user
DB_PASSWORD=""
DEBUG=true
login.blade.php is:
<!DOCTYPE html>
<html lang="en" <?php if($panelInit->isRTL == 1){ ?>dir="rtl"<?php } ?> style="background:none;">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<!-- Favicon icon -->
<?php if($panelInit->settingsArray['favicon'] == "e"){ ?>
<link rel="icon" type="image/png" sizes="16x16" href="{{URL::asset('assets/images/favicon.png')}}">
<?php } ?>
<title><?php echo $panelInit->settingsArray['siteTitle'] . " | " . $panelInit->language['signIn']; ?></title>
<!-- Bootstrap Core CSS -->
<link href="{{URL::asset('assets/plugins/bootstrap/css/bootstrap.min.css')}}" rel="stylesheet">
<!-- Custom CSS -->
<?php if($panelInit->isRTL == 1){ ?>
<link href="{{URL::asset('assets/css/style-rtl.css')}}" rel="stylesheet">
<link href="{{URL::asset('assets/plugins/bootstrap-rtl-master/dist/css/custom-bootstrap-rtl.css')}}" rel="stylesheet" type="text/css" />
<?php }else{ ?>
<link href="{{URL::asset('assets/css/style.css')}}" rel="stylesheet">
<?php } ?>
<link href="{{URL::asset('assets/css/custom.css')}}" id="theme" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<?php
$bgStyling = "";
if($panelInit->settingsArray['authPageImage'] == "1"){
$bgStyling .= "background-image:url('".URL::asset('assets/images/login-register.jpg')."'); ";
}
if($panelInit->settingsArray['authPageColor'] != ""){
$bgStyling .= "background-color:".$panelInit->settingsArray['authPageColor'].";";
}
?>
<body class="loginMark" style="<?php echo $bgStyling; ?>;background-attachment:fixed; background-repeat: repeat-y;background-size: cover;" >
<!-- ============================================================== -->
<!-- Preloader - style you can find in spinners.css -->
<!-- ============================================================== -->
<div class="preloader">
<svg class="circular" viewBox="25 25 50 50">
<circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10" /> </svg>
</div>
<!-- ============================================================== -->
<!-- Main wrapper - style you can find in pages.scss -->
<!-- ============================================================== -->
<section id="wrapper" <?php if($panelInit->settingsArray['loginPageStyle'] == "r"){ echo 'class="login-register login-sidebar" style="'.$bgStyling.'"'; } ?>>
<div <?php if($panelInit->settingsArray['loginPageStyle'] == "r"){ echo 'class="login-box card"'; }else{ echo 'class="login-register" '; } ?> >
<?php if($panelInit->settingsArray['loginPageStyle'] == "c"){ ?><div class="login-box card"><?php } ?>
<div class="card-block">
<form class="form-horizontal form-material" id="loginform" action="{{URL::to('/login')}}" method="post">
<a href="javascript:void(0)" class="text-center db logo-text-login">
<?php
if($panelInit->settingsArray['siteLogo'] == "siteName"){
echo $panelInit->settingsArray['siteTitle'];
}elseif($panelInit->settingsArray['siteLogo'] == "text"){
echo $panelInit->settingsArray['siteLogoAdditional'];
}elseif($panelInit->settingsArray['siteLogo'] == "image"){
?><img src="<?php echo URL::asset('assets/images/logo-light.png'); ?>" /><?php
}
?>
</a>
<h3 class="box-title m-b-20"><?php echo $panelInit->language['signIn']; ?></h3>
#if($errors->any())
<span style='color:red;'>{{$errors->first()}}</span><br/><br/>
#endif
<div class="form-group ">
<div class="col-xs-12">
<input class="form-control" type="text" name="email" required="" placeholder="<?php echo $panelInit->language['userNameOrEmail']; ?>">
</div>
</div>
<div class="form-group">
<div class="col-xs-12">
<input class="form-control" type="password" name="password" required="" placeholder="<?php echo $panelInit->language['password']; ?>">
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<div class="checkbox checkbox-primary pull-left p-t-0">
<input id="checkbox-signup" name="remember_me" type="checkbox">
<label for="checkbox-signup"> <?php echo $panelInit->language['rememberMe']; ?> </label>
</div> <i class="fa fa-lock m-r-5"></i> <?php echo $panelInit->language['restorePwd']; ?> </div>
</div>
<div class="form-group text-center m-t-20">
<div class="col-xs-12">
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
<button class="btn btn-info btn-lg btn-block text-uppercase waves-effect waves-light" type="submit"><?php echo $panelInit->language['signIn']; ?></button>
</div>
</div>
<?php if(isset($panelInit->settingsArray['allowPublicReg']) AND $panelInit->settingsArray['allowPublicReg'] == "1"){ ?>
<div class="form-group m-b-0">
<div class="col-sm-12 text-center">
<p><b><?php echo $panelInit->language['registerNewAccount']; ?></b></p>
</div>
</div>
<?php } ?>
<div class="form-group m-b-0">
<div class="col-sm-12 text-center">
<p><b><?php echo $panelInit->language['schoolTerms']; ?></b></p>
</div>
</div>
</form>
</div>
<?php if($panelInit->settingsArray['loginPageStyle'] == "c"){ ?></div><?php }?>
</div>
</section>
<script src="{{URL::asset('assets/plugins/jquery/jQuery-2.1.4.min.js')}}"></script>
<!-- Bootstrap tether Core JavaScript -->
<script src="{{URL::asset('assets/plugins/bootstrap/js/tether.min.js')}}"></script>
<script src="{{URL::asset('assets/plugins/bootstrap/js/bootstrap.min.js')}}"></script>
<!-- slimscrollbar scrollbar JavaScript -->
<script src="{{URL::asset('assets/js/jquery.slimscroll.js')}}"></script>
<!--Wave Effects -->
<script src="{{URL::asset('assets/js/waves.js')}}"></script>
<!--stickey kit -->
<script src="{{URL::asset('assets/plugins/sticky-kit-master/dist/sticky-kit.min.js')}}"></script>
<!--Custom JavaScript -->
<script src="{{URL::asset('assets/js/custom.min.js')}}"></script>
<?php if( isset($panelInit->settingsArray['gTrackId']) AND $panelInit->settingsArray['gTrackId'] != "" ): ?>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '<?php echo $panelInit->settingsArray['gTrackId']; ?>', 'auto');
ga('send', 'pageview');
</script>
<?php endif; ?>
</body>
</html>
The "login.blade.php" file exists under resources/views. The response I am getting is a blank screen with status code 200. I have tried other blades also inplace of login and still got the same response. But when I provided an invalid blade name, I got an error saying blade doesn't exist. Any help is appreciated.
What the problem is
Hmmm... To be honest - I'm not sure. I can't really find any bad part of what you're posted.
Maybe it's a caching error.
Solution suggestions
You say that you don't have php artisan working. Hmm... How do you clear the cache then? The command: php artisan cache:clear
None the less... The first command that comes to mind is to try and clear the cache and generates composer-files, with this command:
php artisan cache:clear && composer dump-autoload
But if you can't do php artisan, then maybe just do: composer dump-autoload
Further debugging
If it was me, then I would start at the routes, changing this:
Route::get('/login','LoginController#index');
to this:
dd('hey');
Route::get('/login','LoginController#index');
And then reloading the page. You should then see it say 'Hey' on the screen.
... If that works, then change it to this:
Route::get('/login','LoginController#index');
dd('hey');
Then it _SHOULDN'T say 'Hey' on the screen.
... Then I would work my way through the controller as well.
And afterwards through the view.
To find the place where it deviates what you expect should happen and what really happens.
Fun fact:
I have tried once, where I did this - and moved the dd-statement aaaaaall the way through my code. And in the end, when I simply removed the dd-statement then the unexpected behaviour was gone. It must have been some caching or something.

Part of html file inside php file doesnt appear when executing the code in localhost

I'm creating a regitration page which includes php,html and css in bootstrap.Here is my php file.
<?php include "header.php"; ?>
<html>
<head></head>
<body>
<!--content-->
<div class=" container">
<div class=" register">
<h1>Register</h1>
<?php if(isset($_GET[ 'error'])) { echo '<font color="red">'.$_GET[ 'error']. '</font>'; echo '<br><br>'; } if(isset($_GET[ 'ok'])) { echo '<font color="blue">You are successfully Registered..</font>'; echo '<br><br>'; } ?>
<form action="process_register1.php" method="POST">
</div>
<div class="col-md-6 register-bottom-grid">
<h3>Personal infomation</h3>
<div>
<span>Full Name</span>
<input type="text" size="30" maxlength="30" name='fnm'>
</div>
<div>
<span>Username</span>
<input type="text" size="30" maxlength="30" name='unm'>
</div>
<div>
<span>Password</span>
<input type='password' name='pwd' size="30">
</div>
<div>
<span> Confirm password</span>
<input type='password' name='cpwd' size="30">
</div>
<div>
<span> Gender</span>
<input type="radio" value="Female" name="gender" id='f'>Female
<input type="radio" value="Male" name="gender" id='m'>Male
</div>
<div>
<span>E-mail address</span>
<input type='mail' name='mail' size="30">
</div>
<div>
<span> No contact</span>
<input type="text" name='contact' size="30">
</div>
<div>
<span> City</span>
<select style="width: 195px;" name="city">
<option>Tirana</option>
<option>Korca</option>
<option>Vlora</option>
<option>Kavaja</option>
</select>
</div>
<input type="submit" value="submit">
</div>
<div class="clearfix"></div>
</form>
</div>
</div>
</body>
</html>
Here is my header.php file:
<?php session_start(); require( 'config.php'); ?>
<!DOCTYPE html>
<html>
<head>
<title>Online Shopping</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery.min.js"></script>
<!-- Custom Theme files -->
<!--theme-style-->
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<!--//theme-style-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="New Store Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
<script type="application/x-javascript">
addEventListener("load", function() {
setTimeout(hideURLbar, 0);
}, false);
function hideURLbar() {
window.scrollTo(0, 1);
}
</script>
<!--fonts-->
<link href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900' rel='stylesheet' type='text/css'>
<!--//fonts-->
<!-- start menu -->
<link href="css/memenu.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="js/memenu.js"></script>
<script>
$(document).ready(function() {
$(".memenu").memenu();
});
</script>
<script src="js/simpleCart.min.js">
</script>
</head>
<body>
<!--header-->
<div class="header">
<div class="header-top">
<div class="container">
<div class="search">
<form>
<input type="text" value="Search " onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Search';}">
<input type="submit" value="Go">
</form>
</div>
<div class="header-left">
<?php if(isset($_SESSION[ 'status'])) { echo '<ul><li>Logout</li></ul>'; } else { echo '<ul>
<li ><a href="login1.php" >Login</a></li>
<li><a href="register.php" >Register</a></li>
</ul>'; } ?>
<div class="cart box_1">
<a href="checkout.html">
<h3> <div class="total">
<span class="simpleCart_total"></span> (<span id="simpleCart_quantity" class="simpleCart_quantity"></span> items)</div>
<img src="images/cart.png" alt=""/></h3>
</a>
<p>Empty Cart
</p>
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
</div>
</div>
<div class="container">
<div class="head-top">
<div class="logo">
<a href="index.html">
<img src="images/logo.png" alt="">
</a>
</div>
<div>
<h1 class="title">Welcome
<?php
if(isset($_SESSION['status']))
{
echo $_SESSION['unm'];
}
else
{
echo 'Book Store';
}
?>
</div>
<div class=" h_menu4">
<ul class="memenu skyblue">
<li class="active grid"><a class="color8" href="index1.php">Home</a></li>
<li><a class="color1" href="#">Categories</a>
<div class="mepanel">
<div class="row">
<?php
$query="select * from category ";
$res=mysqli_query($conn,$query);
while($row=mysqli_fetch_assoc($res))
{
echo' <div class="col1">
<div class="h_nav">
<ul>';
echo '<li>
<a href="subcat.php?cat='.$row['cat_id'].'&catnm='.$row["cat_nm"].'">'.$row["cat_nm"].'
</a>
</li>';
}
echo' </ul>
</div>
</div>';
mysqli_close($conn);
?>
<li><a class="color6" href="contact.html">Contact Us</a></li>
</ul>
</div>
<div class="clearfix"> </div>
</div>
</div>
</div>
The problem is when I try to open the files from localhost only the header of the page appears so this is the result:
How is it possible that the form doesnt appear?
I assume, that your header.php begins a proper html page with doctype, <html> etc... but after
<?php include "header.php"; ?>
you start your html file again:
<html>
<head></head>
<body>
Make sure your markup is valid!
So it looks like your header file isn't a header, it's a complete HTML document. It opens the document (<html>) and then closes it (</html>). So it makes sense that any HTML you put after including the header won't get rendered - the browser will render the header and assume the document is complete.
Instead you header file should end where the markup for the header ends. Usually this is the opening tag for the container of your content.
Then when you include the header file, it will contain all the markup up to where your content begins, and in your form's file you can put the code for the form and it'll get rendered next.
In your case, try removing the </body> and </html> tags from the header file. That will likely work, though your markup will likely need to be updated to make the design coherent. Also, since those are being created by your header, remove the <html>, <head></head>, and <body> tags from your form's file.
You can also create a footer file that you can include after your form content, and it will close the container and the body and html tags.
Edit
May have scrolled to the end of the first code block when I saw the </body></html>, so you can probably disregard the advice to remove them from the header file - they appear to be there only in my imagination. Removing the opening <html>, <body>, and <head> tags from the from file should do the trick however.

HTTP Error 500 PHP

I am getting an HTTP Error 500 on my website. The PHP code checker doesn't see anything suspicious.
I think it's caused by PDO but I'm not sure because when I remove all the PHP code it still gives me the same error.
Here's my code:
Index.php:
<?php
include_once('includes/db_connect.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable="no>
<!-- Custom CSS -->
<link rel="stylesheet" href="css/custom.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css" />
<!-- Optional theme (flatly) -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootswatch/latest/flatly/bootstrap.min.css" />
<!-- Font awesome -->
<link href="//maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" rel="stylesheet" />
<link rel="stylesheet" href="css/contact.css" rel="stylesheet">
<!-- jQuery -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="js/contact.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="//netdna.bootstrapcdn.com/bootstrap/latest/js/bootstrap.min.js"></script>
<title><?php
foreach($dbh->query('SELECT * FROM page_info') as $row) {
echo $row['title'];
}
?></title>
</head>
<body>
<div class="banner">
<div class="name"><?php
foreach ($dbh->query('SELECT * FROM page_info') as $row) {
echo $row[“name”];
}
?></div>
</div>
<div class="about">
<div class="about-container">
<div class="about-main-text">
<h1>About me:</h1>
<?php
foreach ($dbh->query('SELECT * FROM about') as $row) {
echo '
<span>'.$row["text"].'</span>
';
}
?>
</div>
</div>
</div>
<div class="projects">
<div class="projects-container">
<div class="projects-main-text">
<h1>My projects:</h1>
</div>
<div class="row">
<?php
foreach($dbh->query('SELECT * FROM projects') as $row) {
echo '
<div class="col-md-4 nopadding">
<div class="project-box">
<img src="data:image/jpeg;base64,'.base64_encode( $row['image'] ).'" alt="Project Image">
<h1>'.$row["name"].'</h1>
<p>'.$row["desc"].'</p>
</div>
</div>
';
}
?>
</div>
</div>
</div>
<div class="contact">
<div class="contact-container">
<div class="contact-main-text">
<h1>Contact me:</h1>
</div>
<div class="row">
<form action="contact/send.php" method="post" style="float: left;">
<div class="field name-box">
<input type="text" id="name" name="name" placeholder="Who Are You?"/>
<label for="name">Name</label>
<span class="ss-icon">check</span>
</div>
<div class="field email-box">
<input type="text" id="email" name="email" placeholder="name#email.com"/>
<label for="email">Email</label>
<span class="ss-icon">check</span>
</div>
<div class="field msg-box">
<textarea id="msg" rows="4" placeholder="Your message goes here..."/></textarea>
<label for="msg">Msg</label>
<span class="ss-icon">check</span>
</div>
<input class="button" type="submit" value="Send" />
</form>
</div>
</div>
</div>
<div class="footer">
<span class="copyright">
© <?php
foreach ($dbh->query('SELECT * FROM page_info') as $row) {
echo $row['copyright'];
}
echo ' ' . date("Y");
?> - All rights reserved
</span>
</div>
</body>
</html>
And here is db_connect.php:
<?php
$uname = ‘rik_root’;
$upass = ‘*********’;
$dbh = new PDO('mysql:host=localhost;dbname=nijdeken’, $uname, $upass);
?>
I hope someone can help me. Thanks in advance!
Don't use a word processor to edit your code:
$uname = ‘rik_root’;
^--------^
those are not valid php quote characters, and are probably killing your code with a fatal parse error:
$dbh = new PDO('mysql:host=localhost;dbname=nijdeken’, $uname, $upass);
^--start of string ^--NOT an end-of-string

solvemedia error wrong captcha

hi have this code its from a faucet and it s give me all the time wrong captcha what its wrong with this code?
What i can change this error please.
well i liked to know what i can change in the code for solve the error because it give all the time the same error wrong captcha
My Code Is:
<!DOCTYPE html>
<html>
<head>
<title><?php echo $settings["title"]?></title>
<link rel="stylesheet" href="style/css/bootstrap.min.css" media="screen">
<link rel="stylesheet" href="style/css/bootstrap.css" media="screen">
<link rel="stylesheet" href="style/css/myCssClass.css" media="screen">
<style>
.color-title{
color:<?php echo $settings["title_color"];?>;
}
.color-subtitle{
color:<?php echo $settings["subtitle_color"];?>;
}
.color-background-body{
<?php if($settings["background_image_selected"]=="true") {?>
background-image: url(<?php echo $settings["background_image"];?>);
<?php } else{ ?>
background-color:<?php echo $settings["background_color"];
}?>;
}
</style>
</head>
<body class="color-background-body">
<div class ="container-fluid">
<h1 class="text-center color-title"><?php echo $settings["title"];?></h1>
<h3 class="text-center color-subtitle"><?php echo $settings["subtitle"];?></h3>
<div class="row">
<div class="col-sm-3 col-md-2 hidden-xs">
<!-- Insert your left vertical google ad Code below this comment-->
<?php echo $settings["left_vertical_ad"];?>
</div>
<div class="col-sm-6 col-md-8 text-center">
<div class="top-banner">
<!-- Insert your top horizontal google ad Code below this comment (Recommended size 728x90)-->
<?php echo $settings["top_horizontal_ad"];?>
</div>
<div><strong><p class="alert alert-info">Your possible rewards <?php echo $rewards["reward_list_html"]; ?></p></strong></div>
<div>
<strong><p>Earning bitcoins is simple:</p></strong>
</div>
<?php echo $view['main']['result_html']; ?>
<?php echo $view['main']['ref_link']; ?>
<!-- Insert your second horizontal google ad Code below this comment (Recommended size 320x100)-->
<?php echo $settings["middle_horizontal_ad"]; ?>
<form method="Post">
<div >
<div><label>Insert your email:</label>
<center><input name="username" id="username" class="form-control text-center" type="text" style="width: 450px; placeholder="Enter your email"></div>
</div><br>
<div></center>
<div class="form-group"><label>Solve the captcha:</label>
<center class="captcha"><script type="text/javascript" src="http://api.solvemedia.com/papi/challenge.script?k=<?php echo $settings['solvemedia_challenge_key']?>"></script></center></div>
</div>
<div>
<div>
<button class="btn btn-<?php echo $settings["button_background"]; ?>" type="submit"><?php echo $settings["submit_button_text"]; ?></button>
</div>
</div>
</form>
<br>
<!-- Insert your rectangle google ad Code below this comment (Recommended size 300x250)-->
<?php echo $settings["bottom_horizontal_ad"];?>
<div id="description">
<strong><p><?php echo $settings["main_content"];?></p></strong>
</div>
</div>
<div class="col-sm-3 col-md-2 hidden-xs zeta">
<!-- Insert your right vertical google ad Code below this comment-->
<?php echo $settings["right_vertical_ad"];?>
</div>
</div>
<footer><strong><p class="text-center">Copyright © 2016 <?php echo $settings["title"];?> <a href=<?php echo $settings["contact_mail"];?>>Contact us</a></p></strong></footer>
</div>
</body>
</html>

Is it possible to get 'Session User" to display

Hi there I'm trying to get a user who comments and is logged in to their account for their 'Login Name' to display when they comment currenlty when a user wants to comment it asks for their name and their comment. Is it possible to display their name getting it from the session to display it? Thanks!
http://puu.sh/cByNU/697e58cdf6.jpg http://puu.sh/cByNU/697e58cdf6.jpg
On the image I'm logged in as 'Testing' is it possible to remove the field 'Name' and when they post a comment it will get their name where the search box is (testing).
Thanks!
My CODE:
<?php
session_start();
include "../includes/config.php";
include "function.php";
include ('../includes/header.php');
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Honda</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href='http://fonts.googleapis.com/css?family=Julius+Sans+One' rel='stylesheet' type='text/css'>
<link href="../css/style.css" rel="stylesheet" type="text/css" media="all" />
<!--start lightbox -->
<link rel="stylesheet" type="text/css" href="../css/jquery.lightbox.css">
<script src="../js/jquery.min.js"></script>
<script src="../js/jquery.lightbox.js"></script>
<script>
// Initiate Lightbox
$(function() {
$('.gallery1 a').lightbox();
});
</script>
</head>
<body>
<!--start header-->
<div class="h_bg">
<div class="wrap">
<div class="wrapper">
<div class="header">
<div class="logo">
<img src="../images/logo.png">
</div>
<div class="cssmenu">
<ul>
<li><span>Home</span></li>
<li><span>About</span></li>
<li class="active" class="has-sub"><span>Gallery</span>
</li>
<li class="last"><span>Contact</span></li>
<div class="clear"></div>
<form action="search.php" method="GET">
<div class="search">
<h2>search</h2>
<form>
<input type="text" name="query" placeholder="Enter Your search..." />
<input type="submit" value="">
</form>
</div>
</form>
<div class="search1">
<form action="" method="POST">
<br>
<h2>Welcome, <?=$_SESSION['sess_user'];?>!</h2><br><br>
<div class="pw">
<h3>Change details</h3>
</div>
<br><br>
<h2>Logout</h2>
</form>
</div>
</div>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!-- start content -->
<div class="content_bg">
<div class="wrap">
<div class="wrapper">
<div class="main">
<div class="ser-main">
<h2 class="style">Gallery of honda</h2>
<div class="ser-grid-list img_style">
<div class="gallery1">
<img src="../images/ser_pic1.jpg" alt="">
</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<img src="../images/ser_pic2.jpg" alt="">
</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<img src="../images/ser_pic3.jpg" alt="">
</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<img src="../images/ser_pic4.jpg" alt="">
</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="footer_bg">
<div class="wrap">
<div class="wrapper">
<div class="footer">
<div class="search69">
<?php
if(isset($_POST['submit'])
&& !empty($_POST['name'])
&& !empty($_POST['comment']) ){
$name=$_POST['name'];
$comment=$_POST['comment'];
$submit=$_POST['submit'];
$insert=mysql_query("INSERT INTO comment (name,comment) VALUES ('$name','$comment') ");
echo "<meta HTTP-EQUIV='REFRESH' content='0; url=service.php'>";
}
else
{
echo "";
}
?>
<form class="comments" action="service.php" method="POST">
<h2>Name: </h2><br><input type="text" name="name" required/><br><br>
<h2>Comment:</h2><textarea name="comment" rows="10" cols="50" required></textarea><br><br><br>
<input type="submit" name="submit" value="Comment">
</form>
<?php
$getquery=mysql_query("SELECT * FROM comment ORDER BY id DESC");
while($rows=mysql_fetch_assoc($getquery))
{
$id=$rows['id'];
$date=$rows['date'];
$name=$rows['name'];
$comment=$rows['comment'];
echo '<h2><hr size="1"/><br><font color="green">' . $name . '</font><h2><br/>' . '<br/>' . $comment . '<br/><br><font color="red">' . $date. '</font><br/>' . '<hr size="1"/>'
;}
?>
</div>
<div class="copy">
<p class="w3-link">2014 </p>
Privacy & Policy
</div>
<div class="f_nav">
<ul>
<li>Skype</li>
<li>Linked in</li>
<li>Twitter</li>
<li>Facebook</li>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</body>
</html>
(ALL MY CODE ON THAT PAGE)
UPDATE:
The guys here will kill me, because now i am just edited your code, and not rewrite to mysqli or PDO, but as i saw, you stuck, so i've just updated, bacause i do not want to confuse with that too. I do some modifications, check my comments about that. (Moved the block of insertion to the top of file, add an error message, remove unnecesarry variables, rename the rows variable to row, etc...)
<?php
session_start();
include "../includes/config.php";
include "function.php";
include ('../includes/header.php');
//Set an empty errorMsg because later we will check it.
$errorMsg = '';
//If everything is set, or the SESSION["sess_user"] not empty.
//I moved this whole thing here, because if there are no output, we can
//redirect user from PHP, and do not need to use META REFREHS...
if (isset($_POST['submit']) && !empty($_POST['comment']) && (!empty($_POST["name"]) || !empty($_SESSION["sess_user"]))) {
if (!empty($_SESSION["sess_user"])) {
$name = $_SESSION["sess_user"];
} else {
$name = $_POST["name"];
}
//$comment = $_POST['comment']; //Use $_POST["comment"] directly
//$submit = $_POST['submit']; //Do not use it anywhere
$insert = mysql_query("INSERT INTO comment (name,comment) VALUES ('" . mysql_real_escape_string($name) . "','" . mysql_real_escape_string($_POST["comment"]) . "')");
Header("Location: service.php");
} else {
$errorMsg = "You need to fill all the fields.";
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Honda</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href='http://fonts.googleapis.com/css?family=Julius+Sans+One' rel='stylesheet' type='text/css'>
<link href="../css/style.css" rel="stylesheet" type="text/css" media="all" />
<!--start lightbox -->
<link rel="stylesheet" type="text/css" href="../css/jquery.lightbox.css">
<script src="../js/jquery.min.js"></script>
<script src="../js/jquery.lightbox.js"></script>
<script>
// Initiate Lightbox
$(function() {
$('.gallery1 a').lightbox();
});
</script>
</head>
<body>
<!--start header-->
<div class="h_bg">
<div class="wrap">
<div class="wrapper">
<div class="header">
<div class="logo">
<img src="../images/logo.png">
</div>
<div class="cssmenu">
<ul>
<li><span>Home</span></li>
<li><span>About</span></li>
<li class="active" class="has-sub"><span>Gallery</span>
</li>
<li class="last"><span>Contact</span></li>
<div class="clear"></div>
<form action="search.php" method="GET">
<div class="search">
<h2>search</h2>
<form>
<input type="text" name="query" placeholder="Enter Your search..." />
<input type="submit" value="">
</form>
</div>
</form>
<div class="search1">
<form action="" method="POST">
<br>
<h2>Welcome, <?= $_SESSION['sess_user']; ?>!</h2><br><br>
<div class="pw">
<h3>Change details</h3>
</div>
<br><br>
<h2>Logout</h2>
</form>
</div>
</div>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!-- start content -->
<div class="content_bg">
<div class="wrap">
<div class="wrapper">
<div class="main">
<div class="ser-main">
<h2 class="style">Gallery of honda</h2>
<div class="ser-grid-list img_style">
<div class="gallery1">
<img src="../images/ser_pic1.jpg" alt="">
</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<img src="../images/ser_pic2.jpg" alt="">
</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<img src="../images/ser_pic3.jpg" alt="">
</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<img src="../images/ser_pic4.jpg" alt="">
</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="footer_bg">
<div class="wrap">
<div class="wrapper">
<div class="footer">
<div class="search69">
<?php
//Added here the errorMsg
if (!empty($errorMsg)) {
?>
<div class="error"><?php echo $errorMsg; ?></div>
<?php
}
?>
<form class="comments" action="service.php" method="POST">
<?php
if (!empty($_SESSION['sess_user'])) {
//If user logged in, use the name of it
?>
<h2>Name: </h2><br><?php echo $_SESSION['sess_user']; ?>
<br><br>
<?php
} else {
//Else, ask it
?>
<h2>Name: </h2><br><input type="text" name="name" required/><br><br>
<?php
}
?>
<h2>Comment:</h2><textarea name="comment" rows="10" cols="50" required></textarea><br><br><br>
<input type="submit" name="submit" value="Comment">
</form>
<?php
$getquery = mysql_query("SELECT * FROM comment ORDER BY id DESC");
//This is one row, not rows
while ($row = mysql_fetch_assoc($getquery)) {
/*
* These are not necessary
$id = $rows['id'];
$date = $rows['date'];
$name = $rows['name'];
$comment = $rows['comment'];
*/
echo '<h2><hr size="1"/><br><font color="green">' . $row['name'] . '</font><h2><br/>' . '<br/>' . $row['comment'] . '<br/><br><font color="red">' . $row['date'] . '</font><br/>' . '<hr size="1"/>'
;
}
?>
</div>
<div class="copy">
<p class="w3-link">2014 </p>
Privacy & Policy
</div>
<div class="f_nav">
<ul>
<li>Skype</li>
<li>Linked in</li>
<li>Twitter</li>
<li>Facebook</li>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</body>
</html>
NOTE: Do not use mysql functions since they are deprecated. use mysqli or PDO functions instead.
Acoid for sql injections, so escape your data!
If i got it well, you want the form to automatically gets the name of a logged user. You should:
<?php $username = isset($_SESSION['sess_user']) ? $_SESSION['sess_user'] : "";?>
To store the username or "" into $username, depending on whether user is authentified or not. Then in your input line within the form:
<h2>Name: </h2><br><input type="text" name="name" value="<?php echo $username; ?>" required/><br><br>

Categories