useroo Posted July 20, 2018 Share Posted July 20, 2018 I have 2 PHP issues to solve and so far no answer to either. The first one: In an old directory script i have some script section that populates the URL form submission field with the http:// - unfortunately this interfers with the new common https:// that can not be added as it ends up doing http://https:// So i would like to stop the auto population of http:// in either or both of 2 below script segments .. but i am just not sure how i do this correctly, can anyone in this forum clear this up for me?? function ParseURL($url) { $url = trim($url); //if (strpos($url, '.')<1) { return false; } // check if empty $len = strlen($url); if ($len<3) { return false; } if (strcmp("http://", substr($url, 0, 7)) !== 0) { $url = "http://" . $url; } $url_stuff = parse_url($url); if (!isset($url_stuff["path"])) { $url = $url . "/"; } return $url; } GetHTML" as if (strpos($nueva,“http://”)=== FALSE) { $nueva = “http://” . $urlc . $nueva; } and a bit further down in “function GetAllHTML” The other question i am not as to how far it is actually a PHP issue. After installing a SSL certificate on one of my older websites all static HTML pages display just fine in all browsers - but all the PHP generated pages dispaly crooked. My host said i need to refresh ALL pages of the site .. but did not feel it's his job to tell me how i can do that, so, how to "refresh" all PHP generated files?? Quote Link to comment Share on other sites More sharing options...
requinix Posted July 20, 2018 Share Posted July 20, 2018 How is this a different question from your other thread? Quote Link to comment Share on other sites More sharing options...
glenelkins1984 Posted July 24, 2018 Share Posted July 24, 2018 I suppose the easiest way would to be completely strip off the http:// or https:// and then add it back again, something like this: if (strpos($nueva,“http://”)=== FALSE) { $nueva = “http://” . $urlc . $nueva; } REPLACE THAT CODE ABOVE WITH THE FOLLOWING: $nueva = 'https://'.preg_replace('/http[s]*:\/\/.*/','',$nueva); So it now doesn't matter if http or https is present they will be stripped out completely and then you can add whatever you want at the beginning (in this case i added https) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.