Type = "hidden" in html is changed from f12 and break. how can i prevent this . I showed the place below. i don't know php, please help. I searched but couldn't find anything. I did a few tries but didn't work . Do my query with if?
type="hidden" f12 "devtools" everyone can edit type="email" or similar and change the input value. then you can fill in something else and send
<?php
// Include configuration file
require_once 'config.php';
// Include User library file
require_once 'User.class.php';
if (isset($_POST['part'])) {
$data = $sql->fetch_assoc();
exit(createCommentRow($data));
}
if(isset($_GET['code'])){
$gClient->authenticate($_GET['code']);
$_SESSION['token'] = $gClient->getAccessToken();
header('Location: ' . filter_var(GOOGLE_REDIRECT_URL, FILTER_SANITIZE_URL));
}
if(isset($_SESSION['token'])){
$gClient->setAccessToken($_SESSION['token']);
}
if($gClient->getAccessToken()){
// Get user profile data from google
$gpUserProfile = $google_oauthV2->userinfo->get();
// Initialize User class
$user = new User();
// Getting user profile info
$gpUserData = array();
$gpUserData['oauth_uid'] = !empty($gpUserProfile['id'])?$gpUserProfile['id']:'';
$gpUserData['first_name'] = !empty($gpUserProfile['given_name'])?$gpUserProfile['given_name']:'';
$gpUserData['last_name'] = !empty($gpUserProfile['family_name'])?$gpUserProfile['family_name']:'';
$gpUserData['email'] = !empty($gpUserProfile['email'])?$gpUserProfile['email']:'';
$gpUserData['gender'] = !empty($gpUserProfile['gender'])?$gpUserProfile['gender']:'';
$gpUserData['locale'] = !empty($gpUserProfile['locale'])?$gpUserProfile['locale']:'';
$gpUserData['picture'] = !empty($gpUserProfile['picture'])?$gpUserProfile['picture']:'';
// Insert or update user data to the database
$gpUserData['oauth_provider'] = 'google';
$userData = $user->checkUser($gpUserData);
// Storing user data in the session
$_SESSION['userData'] = $userData;
// Render user profile data
if (!empty($userData)) {
$output = '<div class="user-card">';
$output .= '<img class="userimg" src="'.$userData['picture'].'">';
$output .= '<div class="userinfo">';
$output .= '<div class="username">'.$userData['first_name'].' '.$userData['last_name'].'</div>';
$output .= '<div style="padding-bottom: 10px;"><a class="usera">'.$userData['email'].'</a></div>';
$output .= '<a class="logout usera" href="logout.php">Logout</a>';
$output .= '</div></div>';
}else{
$output = '<h3 style="color:red">Some problem occurred, please try again.</h3>';
}
}else{
// Get login url
$authUrl = $gClient->createAuthUrl();
// Render google login button
$output = '
<a href="'.filter_var($authUrl, FILTER_SANITIZE_URL).'">
<div id="googleButton">
<span class="icon"></span>
<span class="text">Log In With Google</span>
</div>
</a>
';
}
?>
<head>
<link rel="stylesheet" type="text/css" href="css/gwuser.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
</head>
<div class="container">
<form action="gwenter.php" method="POST">
<div class="form-group">
<?php
if (!empty($userData)) {
echo( '<input type="hidden" id="email" name="email" value="'.$userData['email'].'">');
} else {}
?>
</div>
<div class="form-group">
<?php
// Kullanıcı giriş buton
if (!empty($userData)) {
echo( '<button class="btn btn-success" id="part" type="submit">Join</button>');
} else {
echo( '<a class="btn btn-success alertsignin">Join</a>');
}
?>
</div>
</form>
</div>
<div class="container">
<!-- Display login button / Google profile information -->
<?php echo $output; ?>
</div>
<!-- partial -->
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js'></script><script src="./js/alertjs.js"></script>
Here in this place, input place type="hidden" please help me
<?php
if (!empty($userData)) {
echo( '<input type="hidden" id="email" name="email" value="'.$userData['email'].'">');
} else {}
?>