Welcome Guest, Not a member yet? Register   Sign In
In Codeigniter How to FILTER_SANITIZE_URL before redirect to new url
#1

When I click on my google button it sends me to the google links to verify user.

Code:
http://www.example.com/test/google?code=4/uxiEClMAV86scsrjARV-uMRgbypOu1MjT894sXgkAjc#


Once it has reached the link and user has been approved.

How can I use FILTER_SANITIZE_URL so it removes all illegal URL characters before I redirect to new page.

Currently still redirects to url http://localhost/project/# should be http://localhost/project/


PHP Code:
if ($this->input->get('code')) {

if (
$this->googleplus->getAuthenticate()) {

$redirect_uri 'http://' $_SERVER['HTTP_HOST'] . '/project/';

$test filter_var($redirect_uriFILTER_SANITIZE_URL);

redirect($test);

}

There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply
#2

Use one of php's trim methods like rtrim()
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(06-01-2017, 02:48 AM)wolfgang1983 Wrote: When I click on my google button it sends me to the google links to verify user.

Code:
http://www.example.com/test/google?code=4/uxiEClMAV86scsrjARV-uMRgbypOu1MjT894sXgkAjc#


Once it has reached the link and user has been approved.

How can I use FILTER_SANITIZE_URL so it removes all illegal URL characters before I redirect to new page.

Currently still redirects to url http://localhost/project/# should be http://localhost/project/


PHP Code:
if ($this->input->get('code')) {

if (
$this->googleplus->getAuthenticate()) {

$redirect_uri 'http://' $_SERVER['HTTP_HOST'] . '/project/';

$test filter_var($redirect_uriFILTER_SANITIZE_URL);

redirect($test);

}


Remove the # from http://www.example.com/test/google?code=...894sXgkAjc#


You can not remove the hash. It is not possible with php. If you redirect from url a to url b the browser add the same hash as the url a.

http://www.example.com/test/google?code=...894sXgkAjc#
would be
http://www.example.com/project#

Example Script: https://forum.codeigniter.com/thread-681...#pid343729

Do you understand me now?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB