Jump to content

Puzzled on how to do this for my table in php


Iosys

Recommended Posts

Hello I'm a noob when it comes to writing code so please understand.

My site is pvpstreams.com It's in development and the goal is to make it into a portal of different games that are being streamed on the web.

So gamers can find streams with stats for certain games easy.

 

Now my problem is that I'm trying to make a new column for my table which will display an image for when a user's stream is online, like a lightbulb.

When stream is offline it will not show the row for the user.

 

The main stream sites I'm creating the table for are xfire.com and livestream.com

 

Here is my table.php file.

<script language="javascript">

imageX1='plus';
imageX2='plus';
imageX3='plus';

function toggleDisplay(e){
imgX="imagePM"+e;
tableX="table"+e;
imageX="imageX"+e;
tableLink="tableHref"+e;
imageXval=eval("imageX"+e);
element = document.getElementById(tableX).style;
if (element.display=='none') {element.display='block';}
else {element.display='none';}
if (imageXval=='plus') {document.getElementById(imgX).src='http://www.pvpstreams.com/icons/wowicon.png';eval("imageX"+e+"='minus';");document.getElementById(tableLink).title='Hide WoW';}
else {document.getElementById(imgX).src='http://www.pvpstreams.com/icons/wowicon.png';eval("imageX"+e+"='plus';");document.getElementById(tableLink).title='Show WoW';}
}
</script>

<?php
$username="myusername";
$password="mypassword";
$tmp="myserver";

mysql_connect(localhost,$username,$password);
@mysql_select_db($tmp) or die( "Unable to select database");
$query="SELECT * FROM users";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();
?>
<table class="sortable" id="wow" border="1" cellpadding="0" cellspacing="0" style="margin-left:auto;margin-right:auto;text-align:left">
<tr>
<th><font face="Arial, Helvetica, sans-serif">Character</font></th>
<th><font face="Arial, Helvetica, sans-serif">Xfire</font></th>
<th><font face="Arial, Helvetica, sans-serif">Livestream</font></th>
<th><font face="Arial, Helvetica, sans-serif">Team Members</font></th>
<th><font face="Arial, Helvetica, sans-serif">Realm</font></th>
</tr>

<?php
$i=0;
while ($i < $num) {

$f1=mysql_result($result,$i,"wowcharacter");
$f2=mysql_result($result,$i,"username");
$f3=mysql_result($result,$i,"livestream");
$f4=mysql_result($result,$i,"wowserver");

$f5=mysql_result($result,$i,"wowplayer1");
$f6=mysql_result($result,$i,"wowplayer2");
$f9=mysql_result($result,$i,"wowplayer3");

$f7=mysql_result($result,$i,"wowrealm");
$f8=mysql_result($result,$i,"xfire");
?>

<tr>
<td><font face="Arial, Helvetica, sans-serif"><?php Echo "<a class=blue href=http://$f9.battle.net/wow/en/character/$f7/$f1/simple>$f1</a>"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php Echo "<a class=blue href=http://www.pvpstreams.com/xfire.php?user=$f2>$f8</a>"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo "<a class=blue href=http://www.pvpstreams.com/livestream.php?user=$f2>$f3</a>"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo "<img src=wclassicons/$f5.png><img src=wclassicons/$f6.png><img src=wclassicons/$f9.png>" ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><?php echo $f7; ?></font></td>
</tr>


<?php
$i++;
}
?>
</table>

 

I'm thinking that I have to somehow request xfire or livestream's server if it's streaming for the user.

From browsing the web I think this can be done with php and curl but I'm not sure how and I'm a beginner in coding.

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

I'm sad that I'm not getting replies,  :(

I really am just seeking advice for where to go, to read up on how to do what I'm trying to do.

 

Anyone have any good books or tutorials for what I'm trying to do?

Link to comment
Share on other sites

My question is more of how do i use php to check a different server (livestream or xfire's site) that isn't mine and find out if the user is streaming or not.

 

Like this user as example:

http://www.xfire.com/live_video/boxxyilu/

 

he is offline and I'm wondering how i would retrieve that information using php/curl?

then with that information hide my row in table

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.