Mayhem
Mayhem

Reputation: 53

PHP Backslash Issue

I'm trying to pass a username with domain in PHP, and am having issues with backslashes either being completely stripped or "doubled up". I've tried a ton of different fixes, and nothing is working.

$domain = "domain";
$username = "username";
$adfs = stripslashes($domain.'\\'.$username);
$dynamicsClient = new dynamicsClient($adfs, $password, $URL, 1);

What I want as the end result is domain\username.

Seems simple enough, but because of escaping, I can't get this to work. I'm new to PHP, so there must be a fix.

Please help.

Upvotes: 0

Views: 94

Answers (2)

Rizier123
Rizier123

Reputation: 59681

This should work for you:

$domain = "domain";
$username = "username";
$adfs = $domain.'\\'.$username;

Upvotes: 2

blearn
blearn

Reputation: 1208

You are stripping the slash that you've properly escaped. Change:

 $adfs = stripslashes($domain.'\\'.$username);

To:

 $adfs = $domain.'\\'.$username;

Upvotes: 1

Related Questions