Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Searching for PHP genius with some time left

  1. #11
    Join Date
    Jan 2005
    Posts
    58
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    ORIGINAL CODES:
    COUNTRY CODE (If you click on a country the fannumber is shown and the members of this country are listed =
    Australia 2 members
    ID Name Email URL
    [067] becky lorraine @ www
    [062] Kassandra @ www )



    Code:
    <?
    <?
    include("config.php");
    include("$header");
    
    $query="SELECT * FROM $table WHERE apr='y' AND country='$id' ORDER BY $countrysort ASC";
    $result=mysql_query($query);
    $num=mysql_numrows($result);
    ?>
    
    <h2>
    <?
        if ($num == "1"){
          echo "$num Member";
       } else {
       echo "$num Members";
       } ?> from <?=$id?></h2>
    
    <p>See also the <a href="members.php?id=all">complete list</a> or <a href="members.php">browse by country</a>.</p>
    <div align="center"><table border="0" cellspacing="0" cellpadding="5">
    <tr>
    
    <td><strong>ID</strong></td>
    <td><strong>Name</strong></td>
    <td><strong>Email</strong></td>
    <td><strong>URL</strong></td>
    
    </tr>
    <?
    $i=0;
    while ($i < $num) {
    $id=mysql_result($result,$i,"id");
    $name=mysql_result($result,$i,"name");
    $email=mysql_result($result,$i,"email");
    $url=mysql_result($result,$i,"url");
    $hide=mysql_result($result,$i,"hideemail");
    $id = sprintf("%03.0f", $id);
    echo   "<td>[$id]</td>
          <td>$name</td>";
    
       if ($hide != "h"){
    $array = explode("@", $email);
    $first = $array[0];
    $last = $array[1];?>
    <td><SCRIPT TYPE="text/javascript">
    emailE=('<?=$first?>' + '@' + '<?=$last?>')
    document.write(
      '<A HREF="mailto:' + emailE + '">'
      + '@' +'</a>'
    )
    </SCRIPT></td>
    <? } else {
       echo "<td><s>@</s></td>"; }
       if ($url == "") {
       echo "<td><s>www</s></td>";
       } elseif ($url !== "") {
       echo "<td><a href=\"$url\" target=\"_blank\">www</a></td>"; }
       { echo "</tr>"; }
    
    ++$i;
    }
    echo "</table></div>";
    include("$footer");
    ?>
    MEMBER CODE (Shows Fannumber per country =
    Australia 3 fans
    Belgium 1 fan

    and

    lists fannames, urls, @ - sorted by =

    ID Name Email URL Country
    [019] Alicia @ www USA
    [036] Ally @ www Canada
    [040] Alyssia @ www Switzerland )


    Code:
    <?
    <?
    include("config.php");
    include("$header");
    
    if ($id == 'all'){
    $query="SELECT * FROM $table WHERE apr='y' ORDER BY $allsort ASC";
    $result=mysql_query($query);
    $num=mysql_numrows($result);
    ?>
    
    <h2><?=$num?> Members</h2>
    <p>The complete list (view <a href="members.php">sorted by country</a>):</p>
    <div align="center"><table border="0" cellspacing="0" cellpadding="5">
    <tr>
    
    <td><strong>ID</strong></td>
    <td><strong>Name</strong></td>
    <td><strong>Email</strong></td>
    <td><strong>URL</strong></td>
    <td><strong>Country</strong></td>
    </tr>
    <?
    $i=0;
    while ($i < $num) {
    $id=mysql_result($result,$i,"id");
    $name=mysql_result($result,$i,"name");
    $email=mysql_result($result,$i,"email");
    $url=mysql_result($result,$i,"url");
    $country=mysql_result($result,$i,"country");
    $hide=mysql_result($result,$i,"hideemail");
    $id = sprintf("%03.0f", $id);
    echo   "<td>[$id]</td>
          <td>$name</td>";
    
       if ($hide != "h"){
    $array = explode("@", $email);
    $first = $array[0];
    $last = $array[1];?>
    <td><SCRIPT TYPE="text/javascript">
    emailE=('<?=$first?>' + '@' + '<?=$last?>')
    document.write(
      '<A HREF="mailto:' + emailE + '">'
      + '@' +'</a>'
    )
    </SCRIPT></td>
    <? } else {
       echo "<td><s>@</s></td>"; }
       if ($url == "") {
       echo "<td><s>www</s></td>";
       } elseif ($url !== "") {
       echo "<td><a href=\"$url\" target=\"_blank\">www</a></td>"; }
       echo   "<td>$country</td>";
       { echo "</tr>"; }
    
    ++$i;
    }
    echo "</table></div>"; ?>
    <div align="center"><p>Powered by <a href="http://nothing-less.net/Nothing/you/script_fanbase.php" target="_blank">PHPFanBase</a> 2.0</p></div>
    
    <? } else {
    $query="SELECT DISTINCT country FROM $table WHERE apr='y' ORDER BY country ASC";
    $result=mysql_query($query);
    $num=mysql_numrows($result);
    ?>
    <h2><?=$num?> Countries</h2>
    <p>Here you can view the members sorted by country (click <a href="members.php?id=all">here</a> to view the whole list). Click on the country name to see the members from that country.</p>
    <div align="center"><table border="0" cellspacing="0" cellpadding="5">
    <tr>
    <td><strong>Country</strong></td>
    <td><strong>Fans</strong></td></tr>
    <?
    $i=0;
    while ($i < $num) {
    $country=mysql_result($result,$i,"country");
    
    $query2="SELECT id FROM $table WHERE apr='y' AND country='$country'";
    $result2=mysql_query($query2);
    $num2=mysql_numrows($result2);
    
    echo "<td><a href=\"country.php?id=$country\">$country</a></td>";
        if ($num2 == "1"){
          echo "<td>$num2 fan</td></tr>";
       } else {
       echo "<td>$num2 fans</td></tr>";
       }
    
    ++$i;
    }
    echo "</table></div>";}
    
    include("$footer");
    ?>
    Please show me what I have to add or to change, if I want:
    => all countries sorted in alphabetical order
    including the total fannumber of the country

    if you click on a country
    => view states and regions of this country including the
    fannumber of those states or regions

    if you click on a state or region
    => view cities of this state or region including the
    fannumber of those cities

    if you click on a city
    => view name, year of birth, m/f, url and @ of the fans in this city!
    Last edited by Peppy; 03-13-2005 at 11:48 AM.

  2. #12
    Join Date
    Jan 2005
    Posts
    58
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hi Mike!

    The code modification is done - with some help of course!

    I hope you did not start working on it already!

    How ever thank you so much for offering your help - there will be a next time I guess!

    Have a nice day!

    Peppy

  3. #13
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Peppy
    I hope you did not start working on it already!
    I did, though it was easier to start from scratch than modify that code. The quality is terrible, as is the schema. The queries are vulnerable to SQL injection attacks, the code isn't portable and wouldn't work at all on my server, parts are simply wrong (but can work under some circumstances). It's not a good excuse, but then again I did say it would take a while to complete based soley on the fact that I'd never seen the code before.

    As I've started the project, I may as well finish it though I can fiddle more now.

    Mike

  4. #14
    Join Date
    Jan 2005
    Posts
    58
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hi Mike!

    I'd appreciate your help with solving the mentioned problems. (PM!)

    THX

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •