whats wrong with this code?

Discussion in 'PHP' started by buju, Sep 21, 2007.

  1. #1
    <?
    include './config.php';

    $city = $_GET['CITY'];
    $city = str_replace('-', ' ', $city);
    $state = $_GET['STATE'];





    echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>' . $city . ' Strip Clubs | ' . $rool_url . '</title>
    <link rel="stylesheet" type="text/css" href="' . $rool_url . '/main.css" />
    </head>
    <body>
    <div id="wrapper">

    <div id="header">
    <img src="' . $rool_url . '/logo.gif" border=0 align=left></a><br><br><center><h2>' . $city . ' Strip Clubs</h2></center>
    </div>
    <div id="navbar">';
    include("navbar.php");



    echo '</div>';
    echo '<div id="leftcolumn">';

    include("leftbar.php");

    echo '</div>';



    //MAIN PART OF THE SITE

    echo '<div id="centercolumn">
    <!-- Style 2 CityDelve.com City Search -->
    <table cellspacing=1 bgcolor=#cccccc cellpadding=3><tr><td bgcolor=#ffffff><form method="post" action="http://www.citydelve.com/search.php">
    <img src="http://www.citydelve.com/search_logo.gif"><input type="text" name="search" size=25 maxlength=25>
    <input type="image" name="Submit" value="Submit" src="http://www.citydelve.com/search.jpg">
    </form><font face=verdana size=1>Enter a CITY or ZIP to get started - <a href="http://www.citydelve.com">City information by City Delve</a></form></font></td></tr></table><!-- End CityDelve.com City Search --><br>';

    echo '<h1>';
    echo $city;
    echo ' Strip Clubs ';
    echo '</h1>';


    //SHOW COFFEE SHOPS
    echo '<div id=coffee_head><h2>' . $city . ' Strip Clubs, Adult Comedy Clubs, and Dancers</h2></div>';
    echo '<div id=coffee>';
    echo '<img src="' . $root_url . '/doink.jpg" align=left>';
    $sql = mysql_query('SELECT * FROM strip_clubs WHERE City = "' . $city . '" and State = "' . $state . '" LIMIT 10');
    while($row = mysql_fetch_assoc($sql))

    {
    preg_match('/([a-z0-9\040]*)/', strtolower($row['Name']), $matches2);
    $filename = $matches2[0];
    $filename = str_replace(' ', '-', $filename);
    preg_match('/([a-z0-9\040]*)/', strtolower($row['City']), $matches2);
    $cityre = $matches2[0];
    $cityre = str_replace(' ', '-', $cityre);
    preg_match('/([a-z0-9\040]*)/', strtolower($row['State']), $matches2);
    $statere = $matches2[0];
    $statere = str_replace(' ', '-', $statere);

    $bar = $row['Name'];
    $bar = ucwords($bar);
    $bar = ucwords(strtolower($bar));
    echo '<a href="' . $root_url . '/strip_clubs/' . $row['ID'] . '/' . $statere . '/' . $cityre . '/' . $filename . '" title="' . $row['Name'] . '" target="_blank">' . $bar . '</a>';
    echo ', ';
    echo $row['Address'];
    echo ', ';
    echo $row['Telephone'];
    echo '<br><br>';

    }

    echo '<h3>More Adult Entertainment in ' . $state . '</h3><br>';

    $sql = mysql_query('SELECT * FROM strip_clubs WHERE State = "' . $state . '" ORDER BY City DESC LIMIT 10');
    while($row = mysql_fetch_assoc($sql))

    {
    preg_match('/([a-z0-9\040]*)/', strtolower($row['Name']), $matches2);
    $filename = $matches2[0];
    $filename = str_replace(' ', '-', $filename);
    preg_match('/([a-z0-9\040]*)/', strtolower($row['City']), $matches2);
    $cityre = $matches2[0];
    $cityre = str_replace(' ', '-', $cityre);
    preg_match('/([a-z0-9\040]*)/', strtolower($row['State']), $matches2);
    $statere = $matches2[0];
    $statere = str_replace(' ', '-', $statere);

    $bar = $row['Name'];
    $bar = ucwords($bar);
    $bar = ucwords(strtolower($bar));
    echo '<a href="' . $root_url . '/strip_clubs/' . $row['ID'] . '/' . $statere . '/' . $cityre . '/' . $filename . '" title="' . $row['Name'] . '" target="_blank">' . $bar . '</a>';
    echo ', ';
    echo $row['Address'];
    echo ', ';
    echo $row['Telephone'];
    echo '<br><br>';
    }

    preg_match('/([a-z0-9\040]*)/', strtolower($city), $matches2);
    $cityre1 = $matches2[0];
    $cityre1 = str_replace(' ', '-', $cityre1);
    preg_match('/([a-z0-9\040]*)/', strtolower($state), $matches2);
    $statere1 = $matches2[0];
    $statere1 = str_replace(' ', '-', $statere1);

    $bar1 = $city;
    $bar1 = ucwords($bar1);
    $bar1 = ucwords(strtolower($bar1));
    echo '&raquo; <b><a href="' . $root_url . '/strip_clubs_all/All/' . $statere1 . '/' . $cityre1 . '/list_all" title="All strip clubs in ' . $bar1 . '" target="_blank">All Adult entertainment in ' . $state . '</a></b>';

    echo '</div>';





    //END OF THE SITE BYE BYE
    echo '</div>';
    echo '<div id="rightcolumn">';

    include("rightside.php");

    echo '</div>';
    echo '<div id="footer"><center>&copy ' . $sitename . ' - <a href="' . $root_url . '" title="' . $sitename . '">' . $sitename . '</a> 2006. All rights reserved.</center></div>

    </div>

    </body>
    </html>';

    ?>
     
    buju, Sep 21, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Err.... no, lol.


    What error do you get?


    And please use
     wrappers when posting PHP code.
    PHP:
     
    nico_swd, Sep 21, 2007 IP
  3. tarponkeith

    tarponkeith Well-Known Member

    Messages:
    4,758
    Likes Received:
    279
    Best Answers:
    0
    Trophy Points:
    180
    #3
    if you post the error you get, include the line number so we can track down the problem...

    also, off-topic, but for long blocks of HTML, I close then re-open the PHP tags instead of a huge echo... I wonder which is better?

    
    // long echo
    echo 'blah  blah
    blah
    blah';
    
    PHP:
    
    // close then reopen tags
    ?>
    blah blah
    blah
    blah
    <?
    
    
    PHP:
     
    tarponkeith, Sep 21, 2007 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    Depends on the case, but usually I'd suggest using the second method, as it's faster and easier to read.
     
    nico_swd, Sep 21, 2007 IP
    tarponkeith likes this.
  5. buju

    buju Peon

    Messages:
    45
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The requested URL /strip_clubs_all.php.php was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
     
    buju, Sep 21, 2007 IP
  6. tarponkeith

    tarponkeith Well-Known Member

    Messages:
    4,758
    Likes Received:
    279
    Best Answers:
    0
    Trophy Points:
    180
    #6
    Why are you typing in ".php.php"? is that the correct filename?
     
    tarponkeith, Sep 21, 2007 IP
  7. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #7
    EDIT: ^^ Beat me to it, and that's probably the error.

    I'm glad I asked for the error before checking the code. :D


    There's (probably) nothing wrong with your code. The error is telling you that this file was not found on the server. Which means, either you didn't upload it, or the path it wrong, or the case is wrong. (If you're on an apache server.)
     
    nico_swd, Sep 21, 2007 IP
  8. tarponkeith

    tarponkeith Well-Known Member

    Messages:
    4,758
    Likes Received:
    279
    Best Answers:
    0
    Trophy Points:
    180
    #8
    I'm happy you asked for it too! I would have racked my brain looking for a missing semi-colon or something, haha!
     
    tarponkeith, Sep 21, 2007 IP
  9. buju

    buju Peon

    Messages:
    45
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Im not here is the site www.localstripclubfinder.com thanks for the help
     
    buju, Sep 21, 2007 IP
  10. tarponkeith

    tarponkeith Well-Known Member

    Messages:
    4,758
    Likes Received:
    279
    Best Answers:
    0
    Trophy Points:
    180
    #10
    I would check to see if you have a mod-rewrite messing up your site somewhere...
     
    tarponkeith, Sep 21, 2007 IP
  11. buju

    buju Peon

    Messages:
    45
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    RewriteEngine on
    RewriteBase /
    RewriteRule (.*)/(.*)\.htm results.php?STATE=$1&CITY=$2

    RewriteRule ([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+) $1.php?ID=$2&STATE=$3&CITY=$4&NAME=$5 [T=application/x-httpd-cgi]

    what does using capitols have to do with apache?
     
    buju, Sep 21, 2007 IP