Fatal error: Uncaught Error: Cannot access private property srms::$query in /home/vol6_5/epizy.com/epiz_31102412/1 Stack trace: #0 {main}
thrown in
/home/vol6_5/epizy.com/epiz_31102412/ on line 272
Getting this error please helpme
Fatal error: Uncaught Error: Cannot access private property srms::$query in /home/vol6_5/epizy.com/epiz_31102412/1 Stack trace: #0 {main}
thrown in
/home/vol6_5/epizy.com/epiz_31102412/ on line 272
Getting this error please helpme
Please provide more info. What is the url?
Thanks sir for responding
Url is
https://testresults.pkjchemistry.rf.gd
Can you show the code for it? (Hide the password)
Seems quite clear to me. There is a class srms
in your code that has the variable $query
defined on it, with the private
visibility. This means the variable $query
is only accessible from code within that class. If you try to access it from elsewhere, you’ll get this error.
To fix this error, you can either:
$query
variable is not being accessed from outside the class.$query
variable, without exposing the variable itself.$query
variable protected
or public
instead of private
so it can be accessed from other parts of the code.thanks admin sir can you see my code to check it out ?
<link rel="shortcut icon" href="https://i.ibb.co/Z1GsJ42/logo.png" type="image/x-icon">
<link rel = "icon" href =
"https://i.ibb.co/Z1GsJ42/logo.png"
type = "image/x-icon">
<script type="text/javascript">
window.history.forward(); function noBack() { window.history.forward(); }
function burstCache() {
if (!navigator.onLine) {
window.location = "SessionExpire.php";
}
}
history.go(1); /* undo user navigation (ex: IE Back Button) */
</script>
</head>
<body>
<SCRIPT>
window.onload=burstCache();
</SCRIPT>
<link rel="shortcut icon" href="https://i.ibb.co/Z1GsJ42/logo.png" type="image/x-icon">
<script src="https://www.cssscript.com/demo/disable-right-click/disableMouseRightClick.js"></script>
<script type='text/javascript'>
var msg = "-PKJ CHEMISTRY BOKARO-EXAMINATION RESULTS 2023-24 ONLINE ";
msg = " " + msg; pos = 0;
function scrollTitle() {
document.title = msg.substring(pos, msg.length) + msg.substring(0, pos); pos++;
if (pos > msg.length) pos = 0
window.setTimeout("scrollTitle()", 200);
}
scrollTitle();
</script>
<!--<script>
// Runing Title bar
var rev = "fwd";
function titlebar(val) {
var msg = " ";
var res = " ";
var speed = 100;
var pos = val;
msg = msg;
var le = msg.length;
if (rev == "fwd") {
if (pos < le) {
pos = pos + 1;
scroll = msg.substr(0, pos);
document.title = scroll;
timer = window.setTimeout("titlebar(" + pos + ")", speed);
}
else {
rev = "bwd";
timer = window.setTimeout("titlebar(" + pos + ")", speed);
}
}
else {
if (pos > 0) {
pos = pos - 1;
var ale = le - pos;
scrol = msg.substr(ale, le);
document.title = scrol;
timer = window.setTimeout("titlebar(" + pos + ")", speed);
}
else {
rev = "fwd";
timer = window.setTimeout("titlebar(" + pos + ")", speed);
}
}
}
titlebar(0);
</script>-->
<div class="loader"><center>
<img src="https://pkjchemisty.xyz/img/loader.gif" alt="Loading..." class="img-responsive" style="border-radius:20px;" />
<BR>
<H3 align="center" style="font-family: 'Abel', sans-serif;">LOADING RESULT SEARCH INTERFACE....</H3></center>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Abel&display=swap" rel="stylesheet">
</div>
<style>
.loader {
position: fixed;
z-index: 99;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: white;
display: flex;
justify-content: center;
align-items: center;
}
.loader.hidden {
animation: fadeOut 5s;
animation-fill-mode: forwards;
}
@keyframes fadeOut {
100% {
opacity: 0;
visibility: hidden;
}
}
</style>
<script>
window.addEventListener("load", function () {
const loader = document.querySelector(".loader");
loader.className += " hidden"; // class "loader hidden"
});
</script>
<meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head id="Head1"><meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta http-equiv="content-type" content="text/html; charset=utf-8" /><meta name="author" />
<!-- Document Title -->
<link rel="stylesheet" href="css_1/vendor/bootstrap.css" /><link rel="stylesheet" href="css_1/style.css" /><link rel="stylesheet" href="css_1/main.css" />
<style type="text/css">
.form-controlddl
{
display: block;
width: 85%;
height: 41px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
}
.modalBackground
{
background-color: Black;
filter: alpha(opacity=60);
opacity: 0.6;
}
.modalPopup
{
background-color: #FFFFFF;
width: 450px;
border: 3px solid #0DA9D0;
padding: 0;
}
.modalPopup .header
{
background-color: #2FBDF1;
height: 30px;
color: White;
line-height: 30px;
text-align: center;
font-weight: bold;
font-size: 18px;
}
.modalPopup .body
{
min-height: 50px;
line-height: 30px;
text-align: center;
font-weight: bold;
margin-bottom: 5px;
color: black;
}
.btn-success
{
color: #fff;
background-color: #5cb85c;
border-color: #4cae4c;
width: 120px;
}
.btn-primary
{
color: #fff;
background-color: #ec971f;
border-color: #d58512;
width: 120px;
height: 34px;
}
.btn-danger
{
color: #fff;
background-color: #d9534f;
border-color: #d43f3a;
width: 70px;
height: 34px;
}
.btn
{
display: inline-block;
padding: 6px 12px;
margin-bottom: 0;
font-size: 14px;
font-weight: 400;
line-height: 1.42857143;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
</style>
<style type="text/css">
</style>
</head>
<body id="home" oncontextmenu="return false">
<div>
</div>
<!-- Wrapper -->
<div class="wrapper">
<!-- Header -->
<header id="header" class="main-header sticky-1" STYLE="background-image: url('https://codemyui.com/wp-content/uploads/2019/06/Shooting-Star-Background-in-Pure-CSS-1.gif');">
<div class="container">
<!-- logo -->
<div class="logo-holder">
<strong><a href="#"><img src="images_1/PKJ CHEMISTRY BOKARO_free-file.png" alt="logo"></a></strong>
</div>
<div style="width: 13%; float: right; padding-top: 9px;">
<strong><a href="#"><img src="images_1/lg.png" alt="logo"></a></strong>
</div>
<!-- logo -->
<!-- Navigation -->
<!-- Navigation -->
</div>
</header>
<!-- Header -->
<!-- Banner & Enquiry Form -->
<!-- item -->
<div class=" container-fluid" style="background-image: url('https://codemyui.com/wp-content/uploads/2019/06/Shooting-Star-Background-in-Pure-CSS-1.gif');">
<div class="container">
<div class=" col-md-12" style="margin-top: 90px;">
<div class=" col-md-5 " style="margin-top: 35px;">
<h3 style="color: #f00; text-align: center; font-size: 68px; width: 85%;">
<img src="images_1/72984913-exam-results-rubber-stamp-grunge-design-with-dust-scratches-effects-can-be-easily-removed-for-a-clea-removebg-preview (2).png" /></h3>
</div>
<div class=" col-md-7">
<div>
<div id="contact-form" class="form-container" data-form-container>
<span class="book-bg">
<img src="images_1/reg-bg.png" class="img-responsive" alt="" /></span> <span class="cp-bg">
<img src="images_1/cp-rg.png" class="img-responsive " alt="" /></span>
<div class="row" style="margin-bottom: 0px;">
<div class="form-title">
<span>Login to Know your Test Result</span>
</div>
</div>
<?php
//index.php
include('admin/srms.php');
$object = new srms();
$object->query = "
SELECT * FROM exam_srms
WHERE exam_result_published = 'Yes'
AND exam_status = 'Enable'
";
$result = $object->get_result();
?>
</form>
<form method="post" action="result.php">
<div class="input-container">
<div class="row formrow">
<div class="col-md-4 text-right ">
<span class="leble-r">Select Exam </span>
</div>
<div class="col-md-8">
<span class="req-input"><span class="input-status" data-toggle="tooltip" data-placement="top"
title="Please Select Exam."></span>
<select name="exam_name" class="form-controlddl required" onkeyup="enableSubmit()" REQUIRED>
<option value=""> --Select Exam--</option>
<?php
foreach($result as $row)
{
echo '<option value="'.$row["exam_id"].'">'.$row["exam_name"].'</option>';
}
?>
</select>
</span>
</div>
</div><br>
<div class="row formrow">
<div class="col-md-4 text-right ">
<span class="leble-r">Registration No. </span>
</div>
<div class="col-md-8">
<span class="req-input"><span class="input-status" data-toggle="tooltip" data-placement="top"
title="Please Input Your Registration Number."></span>
<input name="student_roll_no" type="text" placeholder="Enter Your Registration Number"REQUIRED / class="required" onkeyup="enableSubmit()">
<script>function enableSubmit(){let inputs = document.getElementsByClassName('required');
let btn = document.querySelector('input[type="submit"]');let isValid = true;for (var i = 0; i < inputs.length; i++){let changedInput = inputs[i];if (changedInput.value.trim() === "" || changedInput.value === null){isValid = false;break;}}btn.disabled = !isValid;}</script>
</span>
</div>
</div><div class="row formrow">
<div class="col-md-4 text-right ">
<div id="cp_div"><p id="captcha" style="text-decoration: line-through;"></p></div></div>
<div class="col-md-8">
<span class="req-input"><span class="input-status" data-toggle="tooltip" data-placement="top"
title="Please Input Your Registration Number."></span><input type="text" name="cpatchaTextBox" id="cpatchaTextBox" placeholder="Enter Security Pin (case sensitive)" class="required" onkeyup="enableSubmit()">
<div id="captcha_error"></div>
</div></div>
<div class="row formrow">
<div class="col-md-4 text-right">
<span class="leble-r hidden-sm"> </span>
</div>
<div class="col-md-8 btnregi">
<input id="cp_btn" type="button" value="Submit" class="btn btn-block submit submit-form" disabled >
<input type="RESET" name="btn_reset" value="Reset" id="btn_reset" class="btn btn-block submit-form2" />
<input type="submit" name="submit" class="btn btn-primary" value="Search" id="submit" / style="display:none;">
<br> <center> <a href="" onclick="createCaptcha()" title="Regenerate Security Pin." STYLE="cursor: pointer; color:blue;" >Regenerate Security Pin</a></center>
</div>
</div>
<div class="row formrow">
<div id="divMessage" class="col-md-12" style="color: Red; font-weight: bold;
font-size: 14px;">
</div>
</div>
<a id="fitpro"></a>
</div>
<div class="col-md-2">
</div>
</div>
<div class="clearfix">
</div>
</div>
</div>
<div class=" clearfix">
</div>
<div class="col-md-12">
<p style="text-align: justify; font-family: calibri; color: WHITE; margin-top: -6px;
font-weight: 500; font-size: 16px; margin-bottom: 11px;">
<strong style="color: #f00; font-size: 20px; text-shadow: 0px 0px 0px #000;">Important
Instruction</strong> : Before proceeding to see the result, please keep your
Registration No/Enrolment Number & PKJC Student ID (PKJCID) handy. Please also ensure that you dedicate at
least 10 minutes to study the report for viewing more analytics, OMR Script(in case of omr exam),Online EXAM Anylytics and other details clck on option provided for viewing these. This is essential for you to really understand
the provided analysis of your performance. These 10 minutes of concentrated study
of the report followed by a one to one personalized preliminary Goal Setting at
PKJ CHEMSITRY Study Centre/Distance Programs will possibly turn out to be a life defining experience for
you, where you can have a detailed customized plan for your own studies & intermediary
milestone. Wish you all the best.</p>
</div>
</div>
</div>
</div>
<!-- item -->
<!-- item -->
<!-- Banner & Enquiry Form -->
<!-- Main Content -->
<!-- <main class="main-content">
<div class="container">
<div class="col-md-12">
<div class="col-md-2"></div>
<div class="clearfix" style="height:5px;"></div>
<div class="container">
<div class="col-md-12">
<div class="col-md-1"></div>
<div class="col-md-1"></div>
</div>
</div>--->
<!-- <div class="clearfix" style="height:5px;"></div>
</main>
<!-- Main Content -->
<!-- Footer -->
<footer id="footer" class="footer overlay-dark">
<div class="container">
<!-- Footer Logo Section -->
<!-- Footer Columns -->
<div class="row">
<div class="footer-columns">
<!-- Footer Column -->
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-6 r-full-width">
<div class="footer-column">
<h4>About PKJ CHEMISTRY :</h4>
<p class="c" style=" font-size: 12px;">PKJ CHEMISTRY was createdRepeted request of students & friends made the founder of PKJC (Who is a Very Popular Teacher of Ofline mode touching the acedmic life of across 1000 students) to Step into the very new world of Distance Education....</p>
</div>
</div>
<!-- Footer Column -->
<!-- Footer Column -->
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-6 r-full-width" style="margin-left:95px;">
<div class="footer-column">
<h4>Contact Details :</h4>
<ul class="contact-details school-timing">
<li><i class="fa fa-home"></i> SECTOR 4G QUARTER NO 3211,<br />
BOKARO STEEL CITY JHARKHAND , <br /> 827004,91-9801209024,8789274451</li>
<li><i class="fa fa-link"></i> <a href="https://pkjchemisty.xyz" target="_blank"> https://www.pkjchemisty.xyz
</a></li>
<li><i class="fa fa-envelope"></i> <a href="mailto:[email protected]">[email protected]</a></li>
</ul>
</div>
</div>
<!-- Footer Column -->
<!-- Footer Column --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="col-lg-3 col-md-3 col-sm-6 col-xs-6 r-full-width">
<div class="footer-column">
<h4>Follow Us :</h4>
<ul class="social-icons">
<li><a href="http://www.facebook.com/pkjchemistrybokaro" target="_blank"><i class="fa fa-facebook"></i></a></li>
<li><a href="https://twitter.com/intent/follow?source=followbutton&variant=1.0&screen_name=" target="_blank"><i class="fa fa-twitter"></i></a></li>
</ul>
</div>
</div>
<!-- Footer Column -->
<script>
function enableSubmit(){let inputs = document.getElementsByClassName('required');
let btn = document.querySelector('input[id="cp_btn"]');let isValid = true;for (var i = 0; i < inputs.length; i++){let changedInput = inputs[i];if (changedInput.value.trim() === "" || changedInput.value === null){isValid = false;break;}}
btn.disabled = !isValid;}</script>
</div>
</div>
<!-- Footer Columns -->
<!-- Copy Rights -->
<div class="copy-rights" ALIGN="CENTER">
<CENTER><p><FONT COLOR="WHITE"><B>All Rights Reserved. PKJ CHEMISTRY CLASSES ,BOKARO STEEL CITY JHARKHAND Designed by : K. HARSHVARDHAN </p></CENTER></FONT>
<center> <?php
echo 'User IP - '.$_SERVER['REMOTE_ADDR'];
?></center>
</div>
<!-- Copy Rights -->
</div>
</footer>
<!-- Footer -->
</div>
<!-- Wrapper -->
<!-- back To Button -->
</form>
</body> <script type="text/javascript">!function(t,e){t.artibotApi={l:[],t:[],on:function(){this.l.push(arguments)},trigger:function(){this.t.push(arguments)}};var a=!1,i=e.createElement("script");i.async=!0,i.type="text/javascript",i.src="https://app.artibot.ai/loader.js",e.getElementsByTagName("head").item(0).appendChild(i),i.onreadystatechange=i.onload=function(){if(!(a||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState)){new window.ArtiBot({i:"6b524afa-f394-4e92-a24f-8354e53541a5"});a=!0}}}(window,document);</script>
</body>
<style type="text/css">
#false{
color: red;
font-size: 15px;
text-align: center;
margin-top: -20px;
}
#true{
color: green;
font-size: 15px;
text-align: center;
margin-top: -20px;
}
#cpform{
margin-top: 10% !important;
background-color: aliceblue;
width: 30%;
margin: auto;
border: 2px solid #db0573;
}
#cp_btn{
margin-bottom: 5px;
}
#cp_div{
border: 1px solid #ced4da;
height: 45px;
background: url("https://codingnepalweb.com/demos/custom-captcha-in-javascript/captcha-bg.png");
margin-bottom: 10px;
text-decoration: line-through;
}
</style>
<body onload="createCaptcha()">
<script type = "text/javascript" >
function preventBack() { window.history.forward(); }
setTimeout("preventBack()", 0);
window.onunload = function () { null };
</script>
</form>
<script type="text/javascript">
var code;
function createCaptcha() {
document.getElementById("captcha").innerHTML = "";
// var charsArray ="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@!#$%^&*";
var charsArray ="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var captcha = [];
for (var i = 0; i < 6; i++){
var index = Math.floor(Math.random() * charsArray.length + 1);
if(captcha.indexOf(charsArray[index]) == -1)
captcha.push(charsArray[index]);
else i--;
}
var canv = document.createElement("canvas");
canv.id = "captcha";
canv.width = 100;
canv.height = 50;
var ctx = canv.getContext("2d");
ctx.font = "25px Georgia";
ctx.strokeText(captcha.join(""), 0, 30);
code = captcha.join("");
document.getElementById("captcha").appendChild(canv);
}
document.getElementById('cp_btn').onclick = function(){
if(document.getElementById('cpatchaTextBox').value == code){
document.getElementById('captcha_error').innerHTML = '<p id="true"> <img src="https://media.tenor.com/On7kvXhzml4AAAAj/loading-gif.gif" height="20" wdth="20"> Security Pin Valid...Searching Your Result...</p>';
document.getElementById('cpatchaTextBox').style.borderColor="green";
var pagebutton= document.getElementById("submit");
pagebutton.click();
createCaptcha();
} else {
document.getElementById('captcha_error').innerHTML = '<p id="false">Invalid Security Pin. Try Again..</p>';
document.getElementById('cpatchaTextBox').style.borderColor="red";
createCaptcha();
}
}
</script>
</body>
</html>
There is no PHP code in the snippet that you have provided. Please show the one which is responsible for communicating with the database.
No, it is not.
It only shows the database query.
Nothing is known about how you made the database connection.
The error could stem from connection or anywhere
What you need sir then
Code was working fine from last 5 months what happened now
I need to see the content of admin/srms.php
Ok
It’s like I said before: the $query
variable in the srms
class is set to private
, which means it’s only accessible from within the code of that class. Setting it from the index.php file should not work.
I’m more surprised that this worked before, because private
variables should not be accessible like this. That should have been the case with PHP 7.4 and 8.2.
And the solution is also what I said before:
What changes should I make in code
I am impressed how those private methods could be called publicly according to what you mentioned.
Anyways change private
keywords to public
.
Warning : Undefined variable $count in /home/vol6_5/epizy.com/epiz_31102412/testresults.pkjchemistry.rf.gd/htdocs/result.php on line 839
Warning : Undefined variable $student_data in /home/vol6_5/epizy.com/epiz_31102412/testresults.pkjchemistry.rf.gd/htdocs/result.php on line 839
Warning : Trying to access array offset on value of type null in /home/vol6_5/epizy.com/epiz_31102412/testresults.pkjchemistry.rf.gd/htdocs/result.php on line 839
Warning : Undefined variable $count in /home/vol6_5/epizy.com/epiz_31102412/testresults.pkjchemistry.rf.gd/htdocs/result.php on line 839
Warning : Undefined variable $student_data in /home/vol6_5/epizy.com/epiz_31102412/testresults.pkjchemistry.rf.gd/htdocs/result.php on line 839
Warning : Trying to access array offset on value of type null in /home/vol6_5/epizy.com/epiz_31102412/testresults.pkjchemistry.rf.gd/htdocs/result.php on line 839
Hi harshvardan,
Would you please paste the full content of /result.php
here so we can take a look?
Please format your code and use the functon when pasting a reply. Remember to remove all credentials, usernames, hostnames, API tokens, etc with ****
before posting.
Cheers!
Problem solved thanks to all