Use of Undefined Constant Notice on CodeIgniter - php

I checked whole site but couldn't find any answers about it, so I decided to post a question.
I'm developing a website with CodeIgniter 3.0 and oftenly getting this notice below:
Severity: Notice
Message: Use of undefined constant - assumed ' '
Filename: yonetim/master.php
Line Number: 149
Backtrace:
File: /home/address/public_html/application/views/yonetim/master.php
Line: 149
Function: _error_handler
File: /home/address/public_html/application/controllers/yonetim/Anasayfa.php
Line: 9
Function: view
File: /home/address/public_html/index.php
Line: 292
Function: require_once
Line 149 on master.php is below:
<li <?php if($this->uri->segment(3) == 'bayiler') { ?>class="active"<?php } ?>>
I know, I can disable notification alert on index.php but I don't want to make it with this way. Do you know right solution?
Thanks in advance.

Related

"Use of undefined constant" error while trying to display image in codeigniter

I'm new to codeigniter and I'm facing a problem when trying to display an image.
Here's my code:
<img src="<?php echo base_url(images/sty2.png);?>" alt="">
This is the error message:
A PHP Error was encountered Severity: Notice Message: Use of undefined
constant sty2 - assumed 'sty2' Filename: views/index.php Line Number:
195 Backtrace: File:
C:\xampp\htdocs\SAMSON\application\views\index.php Line: 195 Function:
_error_handler File: C:\xampp\htdocs\SAMSON\application\controllers\Home.php Line: 31
Function: view File: C:\xampp\htdocs\SAMSON\index.php Line: 315
Function: require_once
How do I fix this?
I don't use codeigniter, but according to https://www.codeigniter.com/user_guide/helpers/url_helper.html your syntax seems correct with the exception of the missing quotes.
echo base_url("images/sty2.png");
Did you load the helper?
Something like: $this->load->helper('url');

CCAvenue Payment Module Giving Error in the Order Cart Page, Prestashop 1.6.1.7

The CC Avenue module is giving the following error on the Order cart page, though the module as such is working and there is nothing wrong in it, but how do I remove this error?
Notice: Undefined index: ccavenue_error_message in /home/desigssq/public_html/tools/smarty/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 38
Notice: Trying to get property of non-object in /home/desigssq/public_html/tools/smarty/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 38
This error means that the variable $ccavenue_error_message is in one of the .tpl files of the module, but is not defined in the .php file that calls it.
In the .tpl file, add a condition to the part of the code containing $ccavenue_error_message.
For example if you have:
<div class="error">{$ccavenue_error_message.text}</div>
replace it by:
{if isset($ccavenue_error_message)}<div class="error">{$ccavenue_error_message.text}</div>{/if}
Feel free to add the code of your tpl file so I can give you exactly the part to modify.
You should also ask the developer of the module to correct this bug.

Message: Trying to get property of non-object

I have huge delays on my project... I try to understand what is wrong and I can not find a solution. I get on my page these messages
A PHP Error was encountered Severity: Notice Message: Trying to get
property of non-object Filename: controllers/help.php Line Number: 243
A PHP Error was encountered Severity: Notice Message: Trying to get
property of non-object Filename: controllers/help.php Line Number: 244
A PHP Error was encountered Severity: Notice Message: Trying to get
property of non-object Filename: controllers/help.php Line Number: 245
The lines 243, 244, 245 are as follows on my Controllers
I have created a space between the lines 243, 244, 245 for the image posted here
$this->template->write('meta_title',$school_details->title.'-'.$data['site_setting']['site_name'].' School-'.$meta['title'], TRUE);
$this->template->write('meta_description', $school_details->title.'-'.$data['site_setting']['site_name'].' School-'.$meta['meta_description'], TRUE);
$this->template->write('meta_keyword', $school_details->title.'-'.$data['site_setting']['site_name'].' School-'.$meta['meta_keyword'], TRUE);
on my URL further down I get
also another error which is
A PHP Error was encountered
Severity: Notice Message: Trying to get property of non-object
Filename: default/school_detail.php Line Number: 11
A PHP Error was encountered Severity: Notice Message: Trying to get
property of non-object Filename: default/school_detail.php Line
Number: 14
Now pages 11 to 18 are as follows on my views
<div class="faq_list_div">
<h3 class="faq_heading_title"><?php echo $school_details->title; ?></h3>
<div style="padding-top:13px;">
<?php $content=$school_details->description;
$content=str_replace('KSYDOU','"',$content);
$content=str_replace('KSYSING',"'",$content);
echo $content; ?>
</div>
What is happening? The parameters work well (in English) when i use Greek Language
is another story although is on UTF8
Are you sure $school_details is an object? If it is not set, or not an object, this error will occur.

php Undefined variable: _session_register issue

There is one php project made in fully core php. Now my work is to change some style issues. So I just downloaded all the files with the database. I just configured all the database name,username,password over my localhost(LAMP). When I browsed the page it is showing the page but there are some errors with it. It is showing error like
Notice: Undefined variable: _session_register in path to the folder/session.php on line 8
Notice: Undefined variable: _session_register in path to the folder/session.php on line 9
Notice: Undefined variable: _session_register in path to the folder/session.php on line 10
Notice: Undefined variable: _session_register in path to the folder/session.php on line 11
Notice: Undefined variable: _session_register in path to the folder/session.php on line 12
Notice: Undefined variable: _session_register in path to the folder/session.php on line 13
The code for the session.php is like this
<?php
$_SESSION['example']="yes";
ini_set("url_rewriter.tags","");
ini_set('session.use_trans_sid', 0);
ini_set("session.cookie_domain", ".localhost");
session_start();
ob_start();
$_session_register["easb2b_username"];
$_session_register["easb2b_userid"];
$_session_register["easb2b_memtype"];
$_session_register["easb2b_adv_id"];
$_session_register["easb2b_adv_email"];
$_session_register["lang"];
?>
So can someone kindly tell me how to solve this issue. The project has around thousand of files. So its really hard to go through all the files and check them. Any help and suggestions will be really appreciable. Thanks....
<?php
// Use of session_register() is deprecated
$new_sessionvar = "Some value.";
session_register("new_sessionvar");
But you can still use
session_start();
$_SESSION['new_sessionvar'] = "Some value"
In order to use it you need to turn on register_global in php.ini
Note that I have the session_start() function right above initialization. In your code you may want to add it at the top of your script to prevent the Headers already sent by PHP message.

Codeigniter Tank Auth activation and logout error [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I've started using Tank Auth in my CodeIgniter App, I have followed some tutorial steps to set it up, and as long as it works, it produces lots of error messages during account activation and logout. Here are the errors:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: session_id
Filename: libraries/Session.php
Line Number: 272
A PHP Error was encountered
Severity: Notice
Message: Undefined index: ip_address
Filename: libraries/Session.php
Line Number: 272
A PHP Error was encountered
Severity: Notice
Message: Undefined index: user_agent
Filename: libraries/Session.php
Line Number: 272
A PHP Error was encountered
Severity: Notice
Message: Undefined index: last_activity
Filename: libraries/Session.php
Line Number: 272
A PHP Error was encountered
Severity: Notice
Message: Undefined index: session_id
Filename: libraries/Session.php
Line Number: 288
A PHP Error was encountered
Severity: Notice
Message: Undefined index: last_activity
Filename: libraries/Session.php
Line Number: 289
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /projekt/system/core/Exceptions.php:185)
Filename: libraries/Session.php
Line Number: 675
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /projekt/system/core/Exceptions.php:185)
Filename: helpers/url_helper.php
Line Number: 542
Here's the code at the reference points:
foreach (array('session_id','ip_address','user_agent','last_activity') as $val)
{
unset($custom_userdata[$val]);
$cookie_userdata[$val] = $this->userdata[$val]; //272 line
}
$this->CI->db->where('session_id', $this->userdata['session_id']); //288 line
$this->CI->db->update($this->sess_table_name, array('last_activity' => //289 line $this->userdata['last_activity'], 'user_data' => $custom_userdata));
setcookie( // 675 line
$this->sess_cookie_name,
$cookie_data,
$expire,
$this->cookie_path,
$this->cookie_domain,
$this->cookie_secure
);
It does not look like these errors are serious ones as they are still only on the notice level of the error hierarchy. I would look at the source code of code-igniter and see what's up. The source is worth understanding how to edit and navigate, as it will save time later. Since I have not used Tank Auth I'm not sure what the exact problem is. I would advise setting up var_dump statements in your source to track what it going on. It does look like some either model or session variables do not exist in the context of your library or what ever other third party tool you are using. You might need to declare an instance of codeigniter in order to work with these third party tools as they exist outside the scope of codeigniter.
$_CI =& get_instance(); // creates a CI instance that can exist outside of the MVC setup
You can check out more at this tutorial under the section: Utilizing CodeIgniter Resources within Your Library
http://ellislab.com/codeigniter/user-guide/general/creating_libraries.html

Categories