Jump to content

strip special characters from $_SESSION var


nine72

Recommended Posts

ok, so I have this form(s)...saving the input to the session. I need to take what is saved in the session strip special characters and then have it return back the var that I state it equals.

 

exp.

 

$_SESSION['agentId'] = $agentId - need to strip special characters at this point

 

then enter the stripped var into a new string

 

$xmlString .= "<agent>" . $agentId . "</agent>";

 

I need to do this some 400+ times...

 

Thanks in advance....

Link to comment
Share on other sites

thanks for the susguestions they are both intresting possiblities...

 

would it work if I did something along this line...

 

$_SESSION['agentId'] = $agentId

$agentId = preg_replace("/[^a-zA-Z0-9s]/", "", $agentId);

 

or somthing like

 

if (!isset($_SESSION['agentId']), ereg("[0-9!@#$%^&*()]", $agentId)) {

$xmlString .= "<agent>" . $agnetId . "</agent>";

}

 

or am I just WAYYY off....

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.