help --- 403 You don't have permission

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oneski
    New Member
    • Feb 2008
    • 1

    help --- 403 You don't have permission

    help --- 403 You don't have permission
    Im trying to get a basic search to work on my website, but i keep getting a forbidden error come up. Im using WAMP5 server on a vista machine. The error file from the apache side says:

    (20024)The given path misformatted or contained invalid characters: Cannot map POST /test/%3C?=$PHP_SELF? %3E HTTP/1.1 to file, referer: http://localhost/test/searchscript.ph p

    and this is the code im using.


    _______________ _______________ _______________ _____ _______________ _

    [PHP]<?php
    session_start() ;
    include("header .php");?>


    <form name="search" method="post" action="<?=$PHP _SELF?>">
    Seach for: <input type="text" name="find" /> in
    <Select NAME="field">
    <Option VALUE="name">Na me</option>
    <Option VALUE="descript ion">Descriptio n</option>
    </Select>
    <input type="hidden" name="searching " value="yes" />
    <input type="submit" name="search" value="Search" />
    </form>


    <?
    //This is only displayed if they have submitted the form
    if ($searching =="yes")
    {
    echo "<h2>Result s</h2><p>";
    //If they did not enter a search term we give them an error
    if ($find == "")
    {
    echo "<p>You forgot to enter a search term";
    exit;
    }
    $con = makeConn();


    // We preform a bit of filtering
    $find = strtoupper($fin d);
    $find = strip_tags($fin d);
    $find = trim ($find);

    //Now we search for our search term, in the field the user specified
    $data = mysql_query("SE LECT * FROM stock WHERE upper($field) LIKE'%$find%'") ;

    //And we display the results
    while($result = mysql_fetch_arr ay( $data ))
    {
    echo $result['name'];
    echo " ";
    echo $result['description'];
    echo "<br>";
    echo "<br>";
    }

    //This counts the number or results - and if there wasn't any it gives them a little message explaining that
    $anymatches=mys ql_num_rows($da ta);
    if ($anymatches == 0)
    {
    echo "Sorry, but we can not find an entry to match your query<br><br>";
    }

    //And we remind them what they searched for
    echo "<b>Searche d For:</b> " .$find;
    }
    ?>

    <?php include("footer .php");?>
    [/PHP]

    _______________ _______________ _______________ _____ _______________ _

    the output on the webpage :

    Seach fortheres a text box here) in (pull down box)(submit button)
    Results

    "; //If they did not enter a search term we give them an error if ($find == "") { echo "

    You forgot to enter a search term"; exit; } $con = makeConn(); // We preform a bit of filtering $find = strtoupper($fin d); $find = strip_tags($fin d); $find = trim ($find); //Now we search for our search term, in the field the user specified $data = mysql_query("SE LECT * FROM stock WHERE upper($field) LIKE'%$find%'") ; //And we display the results while($result = mysql_fetch_arr ay( $data )) { echo $result['name']; echo " "; echo $result['description']; echo "
    "; echo "
    "; } //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches=mys ql_num_rows($da ta); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query

    "; } //And we remind them what they searched for echo "Searched For: " .$find; } ?>





    I cant seem to fix it, any help will be greatly appreciated.
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    Line 6:[php]<form name="search" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">[/php]

    Comment

    Working...