Little php help please

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sk3tch
    Registered User
    • Dec 2006
    • 15

    #1

    Little php help please

    PHP Code:
    if ($_COOKIE['usertype']=="chatusers" ){
    
                    echo '<td align="center" valign="middle"><a href="liveshow.php?model='.$username.'"><img src="models/'.$username.'/thumbnail.jpg" width="140" height="105" border="0"></a></td>';
    
                    }else{
    
                    echo '<td align="center" valign="middle"><img src="models/'.$username.'/thumbnail.jpg" width="140" height="105" border="0"></td>';
    
                    } 
    
    Does anyone see anything wrong with this code????
    When a model goes online there thumbnail will show up on the main page and when a user of the site clicks on the thumbnail it will take them to that models room, the problem is that sometimes the thumbnail is clickable and sometimes its not.. i been working on this problem since lastnight and half the day today an i still can't get it to work.
  • sk3tch
    Registered User
    • Dec 2006
    • 15

    #2
    This is the complete code

    PHP Code:
    <?
    include("dbase.php");
    include("settings.php");
    ?>
    <table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
    
      <tr>
    
        <td height="24" align="center" class="form_definitions">There are
    
            <? 
    
              $nTime=time(); 
    
              
    
              //we set the status to offline to models that have not changed theyr status for 30 seconds
    
              mysql_query("UPDATE chatmodels SET status='offline' WHERE $nTime-lastupdate>30 AND status!='rejected' AND status!='blocked' AND status!='pending'");
    
              
    
              if (!isset($_GET['category']))
    
                {
    
                $select="SELECT * FROM chatmodels WHERE status='online'";//100hours
    
                } else{
    
                $select="SELECT * FROM chatmodels WHERE category='$_GET[category]' AND status='online'";
    
                }
    
                  $result = mysql_query($select);
    
                $nOnline=mysql_num_rows($result);
    
                mysql_free_result($result);
    
                
    
                if (!isset($_GET['category']))
    
                {
    
                $select="SELECT * FROM chatmodels WHERE status!='pending' AND status!='rejected'";
    
                } else{
    
                $select="SELECT * FROM chatmodels WHERE category='$_GET[category]' AND  status!='pending' AND status!='rejected'";
    
                }
    
                $result = mysql_query($select);
    
                $nTotal=mysql_num_rows($result);
    
                mysql_free_result($result);
    
                
    
              echo $nOnline;
    
              ?>
    
        models online from <? echo $nTotal;?> models in this category </td>
    
      </tr>
    
      <tr>
    
        <td align="center">&nbsp;</td>
    
      </tr>
    
    </table>
    
    <br>
    
    <table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
    
      <tr>
    
        <td><img src="images/online_models.gif" width="202" height="32"></td>
    
      </tr>
    
    </table>
    
    <table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
    
      <tr>
    
        <td align="center" valign="top"><?php echo '<table width="720" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#eeeeee">';
    
    
    
                $count=0;
    
                $nTime=time();
    
                
    
                
    
                if (!isset($_GET['category']))
    
                {
    
                $select="SELECT * FROM chatmodels WHERE status='online'";//100hours
    
                } else{
    
                $select="SELECT * FROM chatmodels WHERE category='$_GET[category]' AND status='online'";
    
                }
    
                            
    
                
    
                $result = mysql_query($select);
    
                while($row = mysql_fetch_array($result)) 
    
                    {            
    
                    
    
                    $tBirthD=$row[birthDate];
    
                    $nYears=date('Y',time()-$tBirthD)-1970;
    
                        
    
                    $username=$row[user];
    
                    $tempMessage=$row[message];
    
                    $tempCity=$row[city];
    
                    $tempPlace=$row[broadcastplace];
    
                    $tempL1=$row[language1];
    
                    $tempL2=$row[language2];    
    
                    $tempL3=$row[language3];    
    
                    $tempL4=$row[language4];    
    
    
    
                        
    
                    $languagestring=$tempL1;
    
                    if (strtolower($tempL2)!="none"){
    
                    $languagestring.= ", ".$tempL2;
    
                    }
    
                    if (strtolower($tempL3)!="none"){
    
                    $languagestring.= ", ".$tempL3;
    
                    }
    
                    if (strtolower($tempL4)!="none"){
    
                    $languagestring.= ", ".$tempL4;
    
                    }
    
                
    
                    $count++;
    
                    if ($count==1) {echo' <tr bgcolor="#FFFFFF">';}
    
                    echo '<td width="180" height="180" align="center" valign="middle">';
    
                      echo '<table width="180" height="180" border="0" cellpadding="2" cellspacing="1">';
    
                     echo '<tr>';
    
                     if ($_COOKIE['usertype']=="chatusers" ){
    
                    echo '<td align="center" valign="middle"><a href="liveshow.php?model='.$username.'"><img src="models/'.$username.'/thumbnail.jpg" width="140" height="105" border="0"></a></td>';
    
                    }else{
    
                    echo '<td align="center" valign="middle"><img src="models/'.$username.'/thumbnail.jpg" width="140" height="105" border="0"></td>';
    
                    }
    
                    
    
                    echo '</tr><tr bgcolor="#330000">';
    
                      echo '<td align="left" valign="top">';
    
                     echo '<span class="model_title">'.$username.'</span>';
    
                    echo '<span class="model_title_small">, '.$nYears.' years ';
    
                    if ($tempPlace!=""){
    
                        echo 'from ' . $tempPlace . ', ';
    
                    } 
    
                    echo 'speaks: '.$languagestring.'</span><br>';
    
                    echo '<span class="model_message">'.$tempMessage.'</span></td>';
    
                    echo '</tr></table>';
    
                    echo '  </td>';
    
                    if ($count==4){ echo"</tr>"; $count=0;}
    
                    }
    
                
    
    
    
                if ($count==1){
    
                echo'<td width="240"  height="120" align="center" valign="middle">&nbsp</td>';
    
                echo'<td width="240"  height="120" align="center" valign="middle">&nbsp</td>';
    
                echo'<td width="240"  height="120" align="center" valign="middle">&nbsp</td>';
    
                echo'</tr>';
    
                } else if ($count==2){
    
                echo'<td width="240"  height="120" align="center" valign="middle">&nbsp</td>';
    
                echo'<td width="240"  height="120" align="center" valign="middle">&nbsp</td>';
    
                echo'</tr>';
    
                } else if ($count==3){
    
                echo'<td width="240"  height="120" align="center" valign="middle">&nbsp</td>';
    
                echo'</tr>';
    
                }
    
                
    
                mysql_free_result($result);
    
                echo'</table>';
    
                 ?>
    
        </td>
    
      </tr>
    
    </table>
    
    <br>
    
    <table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
    
      <tr>
    
      </tr>
    
    </table>
    
    <table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
    
      <tr>
    
        <td align="center" valign="top">
    
        <?php echo '<table width="720" border="0" align="center" cellpadding="0" cellspacing="1">';
    
                $count=0;
    
                $nTime=time();
    
                if (!isset($_GET['category']))
    
                {
    
                $select="SELECT * FROM chatmodels WHERE status='offline'";
    
                } else{
    
                $select="SELECT * FROM chatmodels WHERE category='$_GET[category]' AND status='offline'";
    
                }
    
    
    
                $result = mysql_query($select);
    
                while($row = mysql_fetch_array($result)) 
    
                    {            
    
                    $tBirthD=$row['birthDate'];
    
                    $nYears=date('Y',time()-$tBirthD)-1970;
    
                        
    
                    $tempMessage=$row['message'];
    
                    $username=$row['user'];
    
                    $tempCity=$row['city'];
    
                    $tempPlace=$row['broadcastplace'];
    
                    $tempL1=$row['language1'];
    
                    $tempL2=$row['language2'];    
    
                    $tempL3=$row['language3'];    
    
                    $tempL4=$row['language4'];    
    
                            
    
                    $languagestring=$tempL1;
    
                    if (strtolower($tempL2)!="none"){
    
                    $languagestring.= ", ".$tempL2;
    
                    }
    
                    if (strtolower($tempL3)!="none"){
    
                    $languagestring.= ", ".$tempL3;
    
                    }
    
                    if (strtolower($tempL4)!="none"){
    
                    $languagestring.= ", ".$tempL4;
    
                    }
    
                    $count++;
    
                    if ($count==1) {echo' <tr>';}
    
                    echo '<td width="180" height="180" align="center" valign="middle" background="images/modelbox.gif">';
    
                      echo '<table width="180" height="180" border="0" cellpadding="2" cellspacing="1">';
                    
                     echo '<tr>';
    
                         echo '<td height=10 align="left" valign="top"><span class="modelbox_title">&nbsp&nbsp&nbsp&nbsp&nbsp'.$username .' ('.$nYears.')</span></td>';
    
                    echo '</tr><tr>';
    
                     echo '<tr>';
    
                         echo '<td height=80 align="center" valign="middle"><img src="models/'.$username.'/thumbnail.jpg" width="140" height="105" border="0"></td>';
    
                    echo '</tr><tr>';
    
                          echo '<td height=26 align="left" valign="top">';
    
                        echo '<span class="model_title_small">';
    
                    echo '&nbsp&nbsp&nbsp&nbspSpeaks: '.$languagestring.'</span><br>';
    
                        echo '<span class="model_message">&nbsp&nbsp&nbsp&nbsp&nbsp'.$tempMessage.'</span></td>';
    
                    echo '</tr></table>';
    
                    echo '  </td>';
    
                    if ($count==4){ echo"</tr>"; $count=0;}
    
                    }
    
                
    
    
    
                if ($count==1){
    
                echo'<td width="240"  height="120" align="center" valign="middle">&nbsp</td>';
    
                echo'<td width="240"  height="120" align="center" valign="middle">&nbsp</td>';
    
                echo'<td width="240"  height="120" align="center" valign="middle">&nbsp</td>';
    
                echo'</tr>';
    
                } else if ($count==2){
    
                echo'<td width="240"  height="120" align="center" valign="middle">&nbsp</td>';
    
                echo'<td width="240"  height="120" align="center" valign="middle">&nbsp</td>';
    
                echo'</tr>';
    
                } else if ($count==3){
    
                echo'<td width="240"  height="120" align="center" valign="middle">&nbsp</td>';
    
                echo'</tr>';
    
                }
    
                
    
                mysql_free_result($result);
    
                echo'</table>';
    
                 ?></td>
    
      </tr>
    
    </table>
    
    <br>
    
    <table width="720" border="0" align="center" cellpadding="0" cellspacing="0">
    
      <tr>
    
        <td width="400">&nbsp;</td>
    
        <td width="320" rowspan="2" align="right"><? if (isset($_COOKIE["usertype"])){
    
        
    
        echo '<a href="cp/'.$_COOKIE["usertype"].'/index.php"><img src="images/member_area.gif" border="0" ></a>';
    
        
    
        
    
        echo '<a href="logout.php"><img src="images/logout.gif" border="0" ></a>';
    
        } else {
    
        echo '<a href="login.php"><img src="images/header_6.gif" border="0"></a>';
    
        }?></td>
    
      </tr>
    
      <tr>
    
        <td>&nbsp;</td>
    
      </tr>
    
    </table>
    
    <br>

    Comment

    • sk3tch
      Registered User
      • Dec 2006
      • 15

      #3
      Never mind i figured it out

      Comment

      Working...