CI Session Not Wokoring After Change Email Codeigniter/Tank Auth - codeigniter

Hi I have my session set to true in codeigniter I use tank auth but when I go use my change email form. after re activating new email got to success page but loads up errors but when I view my database users table email has changed.
The errors that I am showing are.
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 /home/cws01/public_html/tank/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 /home/cws01/public_html/tank/system/core/Exceptions.php:185)
Filename: helpers/url_helper.php
Line Number: 542
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;

Most likely it is due to the sess_destroy() initiated by a logout in Tank_auth
Following code in logout function within the Tank_auth library worked for me.
function logout()
{
$this->tank_auth->logout(); // Destroys session
$this->ci->session->sess_create();
redirect('/auth/login');
}
See: Post on ellislab-forum; and this forum..

Related

Laravel 5.6: sending email to BCC without adding email in TO()

How to send email to only bcc() without to().
When I tried, I got error
Error Information.
URL: http://example.com Parameters: [] Request Name: Request Method:
GET Line Number: 309 File:
/var/www/html/project_name/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php
Client IP: 127.0.0.1 HTTP Referer: Is Secure: Is Ajax: userAgent:
Symfony content: Error Message: Whoops! There was an error.
ErrorException (E_WARNING) Illegal string offset 'address'
ErrorException thrown with message "Illegal string offset 'address'"
Stacktrace: #38 ErrorException in
/var/www/html/project_name/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php:309
#37 Illuminate\Foundation\Bootstrap\HandleExceptions:handleError in /var/www/html/project_name/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php:309
Sending email to all bcc without using to

Socialite in Laravel 5.1

I'm trying Socialite with laravel 5.1 and I always got this error during call back route
InvalidStateException in AbstractProvider.php line 200:
and this is my code for callback route
public function handleProviderCallback($provider) {
$user = Socialite::driver($provider)->user();
}
additional information about issue
I saw this error happened when I authenticated from facebook only , when I disable this code in AbstractProvider.php line 200
throw new InvalidStateException;
Show new error
cURL error 7: Failed to connect to graph.facebook.com port 443

Codeigniter cant send email on IIS

i have a simple config email for send an email.
$this->load->library('email');
$config['smtp_crypto'] = 'tls';
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.gmail.com';
$config['smtp_port'] = 587;
$config['smtp_timeout'] = '5';
$config['smtp_user'] = 'hi*****y#gmail.com';
$config['smtp_pass'] = '*****';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['mailtype'] = 'html'; // or html
// $config['validation'] = TRUE; // bool whether to validate email or not
$this->email->initialize($config);
$message = "content";
$this->email->from("hikmatfauzy#gmail.com", "judul");
$this->email->to("hikmatfauzy7#gmail.com");
$this->email->subject("judul");
$this->email->message($message);
$this->email->send();
echo $this->email->print_debugger();
I get this error message below. how can i do?
i tried on my xampp server but running well. but on IIS i got this error.
A PHP Error was encountered
Severity: Warning
Message: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Filename: libraries/Email.php
Line Number: 1703
NOTE:
I changed $config['smtp_port'] from 465/587/25 (still got the
error).
I changed my php.ini openssl extension (still got the
error).

Error while sending an email with CodeIgniter

While sending an email, I'm receiving a bunch of such errors:
A PHP Error was encountered
Severity: Notice
Message: fwrite(): send of 12 bytes failed with errno=32 Broken pipe
Filename: libraries/Email.php
Line Number: 1846
A PHP Error was encountered
Severity: Notice
Message: fwrite(): send of 39 bytes failed with errno=32 Broken pipe
Filename: libraries/Email.php
Line Number: 1846
A PHP Error was encountered
Severity: Notice
Message: fwrite(): send of 31 bytes failed with errno=32 Broken pipe
Filename: libraries/Email.php
Line Number: 1846
I have followed the CodeIgniter user guide to configure an SMTP:
$config['protocol']='smtp';
$config['smtp_host']='ssl0.ovh.net';
$config['smtp_port']='465';
$config['smtp_timeout']='10';
$config['smtp_user']='postmaster%example.com';
$config['smtp_pass']='password';
$config['mailtype'] = 'html';
$config['charset'] = 'utf-8';
$config['newline'] = "\r\n";
$config['useragent'] = 'Project';
It seems like the configuration file is just fine, and correct (I've checked the OVH's email configuration files).
Any solution for that?
I too was in the same situation. Was getting:
Message: fwrite(): SSL: Broken pipe</p><p>Filename: libraries/Email.php</p><p>Line Number:
2250&
the change that really made a difference was the 'smtp_crypto' config option set to 'ssl'
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'ssl://example.com';
$config['smtp_crypto'] = 'ssl';
$config['smtp_port'] = '465';
$config['smtp_user'] = 'user#example.com';
$config['smtp_pass'] = 'password';
$config['mailtype'] = 'html';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = 'TRUE';
I found this solution at https://www.codeigniter.com/user_guide/libraries/email.html by searching for SSL option.
This is the answer that worked for me
http://biostall.com/resolving-error-with-sending-emails-via-smtp-using-codeigniter/
Be sure to use "\r\n" and not '\r\n'
Also you can set this in a config file:
$config['newline'] = "\r\n";
$config['crlf'] = "\r\n";
If you are using cpanel for your website smtp restrictions are problem and cause this error.
SMTP Restrictions
This feature prevents users from bypassing the mail server to send
mail, a common practice used by spammers. It will allow only the MTA,
mailman, and root to connect to remote SMTP servers.
This control is also adjustable in Tweak Settings.
This setting has been updated.
The SMTP restriction is disabled.
I had a similar problem and had to disable SMTP Restrictions.
After that all was ok.
As far as CI is concerned, there are so many issues with your email config array that could cause this error.
If you are on local development enviroment, Try changing capitalization for "smtp" to "SMTP" with capital letters.
If you are on a live server, try changing them to small caps.
All in all playing with $config['protocol'] = 'smtp' capitalization some times helps.
Same problem here... but what worked for me was these set of configuration:
$config['protocol'] = 'smtp';
$config['smtp_host'] = XXX;
$config['smtp_user'] = XXX;
$config['smtp_port'] = 25; // was 465
$config['smtp_pass'] = XXX;
$config['newline'] = "\r\n";
And the message stopped. :D
use smpt_port:25, it's worked for me
I try this and it's work for me
$config['protocol'] = 'smtp';
$config['smtp_crypto'] = 'tls';
$config['smtp_host'] = 'smtp.gmail.com';
$config['smtp_port'] = '587';

Google PHP API Offline Access Issue

I am trying to use Google PHP API to sream contents from Google plus. I was able to get the refresh token. But when I tried to get access token using that refresh token, its returning the following error.
Fatal error: Uncaught exception 'apiAuthException' with message 'Error refreshing the OAuth2 token, message: '{ "error" : "invalid_grant" }'' in /var/www/social-media-test/google-api-php-client/src/auth/apiOAuth2.php:242 Stack trace: #0 /var/www/social-media-test/google-api-php-client/src/apiClient.php(281): apiOAuth2->refreshToken('MY-REFRESH-TOKEN-HERE') #1 /var/www/social-media-test/google-api-php-client/examples/plus/p.php(19): apiClient->refreshToken('MY-REFRESH-TOKEN-HERE') #2 {main} thrown in /var/www/social-media-test/google-api-php-client/src/auth/apiOAuth2.php on line 242
MY code is as shown below.
$client = new apiClient();
$client->setApplicationName('Google+ PHP Starter Application');
$client->setClientId('client-id');
$client->setClientSecret('secret-key');
$client->setRedirectUri('http://localhost/index.php/main');
$client->setDeveloperKey('dev-key');
$plus = new apiPlusService($client);
$client->refreshToken('MY-REFRESH-TOKEN');
Any Ideas?
you forgot this:
$client->setScopes(array(
'https://www.googleapis.com/auth/blogger'
));
ref: https://developers.google.com/gdata/docs/auth/oauth#Scope

Resources