Having trouble setting php-ews password from POST - exchange-server

for some reason, if I manually set the password (ie $password = "myPassword") everything works fine.
However if the password is set from a post (ie $password = $_POST['password']) I get this error:
Uncaught exception 'EWS_Exception' with message 'SOAP client returned status of 401
I cannot for the life of me figure out why this is. The funny thing is that I have the username set the same way (ie $username = $_POST['username']) and it works with no problem. It just doesnt work for password. I bet is a simple mistake on my end, but I just cant figure it out. Any ideas?

This is embarrassing, but if anyone runs into this issue. Try adding a trim around the post, ie trim($_POST['pwd'])

Related

Could not get session during GET method

Using Laravel 8 and axios.
During POST method, there's no problem accessing the session.
But when I switch to the GET method in between, the session is blank.
POST = session is ok
GET = session is blank
POST again = session is still there
It just happened all of a sudden. I'm pretty sure I did not do any major changes.
Any idea? Thanks a lot!

XAMPP Invalid authentication method set in configuration: ‘cookie’

I have read all the possible fixes for the above issue when trying to get XAMPP working. Nothing has worked and I need to find an answer to get it working for a college course.
I am running a Mac OS X 10.11.6 and downloaded the XAMPP version 5.6.40. Then I open http://localhost/phpmyadmin/ go to user accounts and change the root password on for local host.
Then I go to the file config.inc.php and change 'config' to 'cookie' and also change the password. Then I restart the servers try to log back in but it gives the above error message and doesn't let me enter credentials. Some students in my class have done it the exact same way and it has worked for them.
I have looked at and tried many possible fixes as I can but with no success.
If you are using
$cfg['Servers'][$i]['auth_type'] = 'cookie';
Then you can set the user and password to blank, as using cookie makes phpMyAdmin throw a login page where you are expected to enter the userid and password in the login dialog.
$cfg['Servers'][$i]['user'] = '';
$cfg['Servers'][$i]['password'] = '';
It would also be worth refreshing your browser cache after making this change.
Thats CRTL+F5
Dont forget to restart Apache after making this change

how to implement the code below in laravel for a password

i am following along a video course from tutsplus -getting started with laravel- and managed up to vid 19 securing the admin panel. My problem as follows. i cannot login to the system because i don't have a valid email-password. in the db there are dummy user emails and hashed pw's but i cannot use because already hashed and i don't know the pw's.
i found this post
How to create a laravel hashed password
however artisan tinker doesn't work because REPL not supported.Falling back to simple shell.
$password = 'JohnDoe';
$hashedPassword = Hash::make($password);
echo $hashedPassword; // $2y$10$jSAr/RwmjhwioDlJErOk9OQEO7huLz9O6Iuf/udyGbHPiTNuB3Iuy
makes sense - to create a new user with known pw but i don't know where and how to implement the code so it spits out the hash in the browser. I tried making a file in the model as well as route and stuck in the code.. to no avail. or maybe easier way?
Can someone help thx.
Place this in your routes.php
Route::get('hash/{password}', function($password){
echo Hash::make($password);
});
And then open your-project.dev/hash/JohnDoe in your browser.

cron job on codeigniter password protected site

Hey guys hope you could help me out
I am trying to get a cron job to work with a codeigniter application but its just not happening. I have cpanel and ftp access.
The site is password protected. I have been googling for a long time with no luck.
I dont really know linux, and although I do intend to atleast learn the basics of linux commands later, but for now I just want a simple cron job to work.
basically to test the cron job, I have a method
public function update_cronjob2() {
$to = "my_email#domain.com";
$subject = "asdf!";
$message="cronjob";
mail($to,$subject,$message);
}
when I enter the url directly,i.e
http://www.site.com/my_directory/index.php/home/update_cronjob2
I get the email. but not with cron jobs.
This is what I have tried so far. Note that I have pasted everything as-is and only replaced the text for username, password and site. no symbols, etc added
wget --user='user123'--password='pass123' http://www.site.com/my_directory/index.php/home/update_cronjob2
AND
wget http://www.site.com/my_directory/index.php/home/update_cronjob2
and
$ cd /my_directory/project;$ php index.php home update_cronjob2
Is it possible for you to place the cron outside the admin/user part of the site? It sounds like you need to be logged in to access given page. That's why your browser can handle it, but not the cron.
That, or you could do add this in your login part:
if ( ! in_array($this->uri->segment(1), array('cron'))) {
// Login prompt
}
Or maybe you have some other issue?

PHP session login different for url with www and without www?

I am debugging on session login, when i am login to www.domainname.com the session will be only set for with www.
When i am going to url domain.com, session login is ignored, and i will be prompted to login form again.
I have set session cookie_domain also, but not working.
Any one can help me? why?
I know this question is as old as "Who came first? The egg or the chicken?"
I had a lot of trouble about this issue.
But... if you're using php I've found a solution:
In your login script insert in the first line
<?php
session_set_cookie_params(0, '/', 'www.yourdomain.com');
session_start()
?>
or you can try yoursubdomain.yourdomain.com instead www.yourdomain.com.
It works for me. Hope it help other users too.
I highly recommend redirecting users to the canonical version of the site (probably the www.example.com domain). Look around, you'll notice that most sites do exactly this for consistency (including SO; see what happens when you go to www.stackoverflow.com).
Have you tried setting the session domain to ".example.com"?:
$lifetime = 0;
$path = '/';
$domain = '.yourdomain.com';
session_set_cookie_params($lifetime, $path, $domain);
Note the dot in the beginning of the $domain string variable.
Check the reference of the function here.

Resources