WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Remove URL Parameter Substr Strstr
Categories : PHP, URLs, Strings Click here to Update Your Picture
Ulysses Ludwig
Date : Mar 06th 2000
Grade : 1 of 5 (graded 3 times)
Viewed : 14128
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Ulysses Ludwig
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?php

/*
Name: RemoveUrlParam.php3
AUTHOR: Ulysses J Ludwig
AUTHOR URL: www.ujludwig.com
DATE CREATED: 1.24.00
LAST MODIFIED: 3.06.00 (6:30 PM)
INCLUDED BY: Lib.inc
CALLED BY: Anywhere
PREREQUISITES: None
COMMENTS: The script removes a url parameter from a url string. Please
note: I am sure there is a way to shorten this script, but then no one
would be able to read it but me. Ergo it is longer for a reason. Also,
if the url passed in is already encoded, then the parameter should also
be encoded first
EXAMPLE: Fn_remove_url_param("$Url&ParamVariable","param_name");
*/
/////////////////////////////////////////////////////////////////////////////////////////
////////////        (REMOVE URL PARAMETER) CALLED FROM ANYWHERE /////////////////////////////
function Fn_remove_url_param($In_url, $In_param_name)
{
                trim($In_url);
                $qm = chr(63);                                                         //
Creates a question mark
                $L_qm_pos = strpos($In_url, $qm) + 1;         // Creates a variable that holds the
position of the question mark (it may be 0 if there is no question mark)
                // When searching for the parameter, make sure that it is
                // proceeded by an & or ? and followed by an = sign
                $L_search_string = ("?" . $In_param_name . "=");
                $L_param_pos = strpos($In_url,$L_search_string);
                if (!empty($L_param_pos))
                {
                        // Parameter is led by ?... preserve the question mark
                        $L_param_pos++;
                }
                else
                {
                        $L_search_string = ("&" . $In_param_name . "=");
                        $L_param_pos = strpos($In_url, $L_search_string);        
                }

                if (!empty($L_param_pos))
                {
                        // The parameter exists in the param string so remove it
                        // Find the end of the param name value pair
                        for ($i = $L_param_pos + 1; $i <= strlen($In_url); $i++)
                        {
                                $L_character = (substr($In_url, $i, 1));
                                if ($L_character == " " or $L_character == "&")
                                {
                                        $i ++;
                                        break;
                                }
                        }
                                
                        $In_url = substr($In_url, 0,$L_param_pos) .
                                substr($In_url, $i - 1, strlen($In_url));
                }
        return Fn_repair_url($In_url); // Return the page
}

////////////////////////////////////////////////////////////////////////////////////
//////////// Repair URL ////////////////////////////////////////////////////////
function Fn_repair_url($In_url)
{

        $L_pos = strpos($In_url, "?&");
        if (!empty($L_pos))
        {
                // Remvove the &
                $In_url = substr($In_url, 0,$L_pos + 1) .
                        substr($In_url, $L_pos + 2, strlen($In_url));        
        }
        
        $L_pos = strpos($In_url, "&&");
        if (!empty($L_pos))
        {
                // Remove one of the &s
                $In_url = substr($In_url, 0,$L_pos + 1) .
                        substr($In_url, $L_pos + 2, strlen($In_url));        
        }
        
        if (strpos($In_url, "?") > 0 and (strpos($In_url, "?") == strlen($L_url)))
        {
                // Then the question mark that is trailing has no parameters, remove it
                $In_url = substr($In_url, 0, strlen($L_url - 1));
        }
        
        return $In_url;
}
?>



pick up an array of variables from a query string such as: http://www.archipro.com/test.php?state=AB&state=BC
Categories : PHP, Strings, URLs, Global Variables
PHP5 URL Object
Categories : PHP, PHP Classes, URLs, Strings
rawurldecode -- Decode URL-encoded strings
Categories : PHP, PHP Functions, URLs
The Porter Word Stemming Algorithm in PHP Reduces words to their base stem for search engines and indexing
Categories : Algorithms, PHP, Strings
a file explorer for the web, filesystem php php3 files dirs directories pictures files windows linux system list ls scripts
Categories : PHP, URLs, Directories, Filesystem
Query2Report : Generating Html, Pdf and Csv Reports from SQL Query
Categories : PHP, PHP, HTML, PDF, Excel
WWW interface to Unix Manual(phpMan)
Categories : Program Execution, Strings, Arrays, PHP
Get TemplateMonster data
Categories : Arrays, Ecommerce, PHP, Strings
How to find the name of the current file?
Categories : PHP, Filesystem, Strings
Printer friendly pages from anywhere on a website.
Categories : PHP, Strings, Content Management
AddSlashes -- Quote string with slashes
Categories : PHP, PHP Functions, Strings
Can the word DO be used in arrays?
Categories : Arrays, PHP, Strings
Grab images from one or more URLs and save them to a specified local directory.
Categories : PHP, Filesystem, Strings, Arrays
valid link!
Categories : HTTP, URLs, PHP
Customizable encoding and decoding strings with security.
Categories : PHP, Strings, HTML and PHP
 Patrick Mueller wrote :270
wouldn`t it be easier to just use a ereg_replace-function ???