mercredi 9 décembre 2015

Check if file name contains string

I have a function which I would like to activate only when the url starts in a particular format, but with variable endings.

    $actual_link =  "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; 

    if ($actual_link == "http://localhost:1234/WebDevelopment/Bathrooms/index.php") {
        select_imagex("SELECT * FROM page_image WHERE pageID = 1"); 
    }
    else if ($actual_link == "http://localhost:1234/WebDevelopment/Bathrooms/") {
        select_imagex("SELECT * FROM page_image WHERE pageID = 1"); 
    }

    /* section which I have issues with */
    /* x = changing variable */
    else if ($actual_link == "http://localhost:1234/WebDevelopment/Bathrooms/news.php/id=x") {
        echo "bob";
    } else {
        select_image("SELECT * FROM page_image WHERE pageID = ?"); 
    }

Aucun commentaire:

Enregistrer un commentaire