runnerjp Posted June 2, 2008 Share Posted June 2, 2008 hey guys this is i wierd one... ok so i have my profile page <link rel="stylesheet" type="text/css" href="http://www.runningprofiles.com/css/login.css"><?php session_start(); require_once '../settings.php'; checkLogin ('1 2'); $id = $_SESSION['user_id']; $username= get_username($_SESSION['user_id']); $query = "SELECT * FROM users WHERE Username = '$username' LIMIT 1"; if ($result = mysql_query($query)){ if (mysql_num_rows($result)) { $array = mysql_fetch_assoc($result); $pemail = $array['Email']; $puser = $array['Username']; $pid = $array['ID']; $pfirst_name = $array['first_name']; $plast_name = $array['last_name']; $pabout_me = $array['about_me']; $pevents = $array['events']; $pgender = $array['gender']; $pdob = $array['dob']; $pimage = $array['image']; $pclub = $array['club']; ?> <table width="100%" cellpadding="0" cellspacing="0" bordercolor="#E2E2E2"> <tr> <td style="padding-top:1px; padding-left:1px; padding-right:1px;" height="49" colspan="4" align="center" valign="top"><table class="loggedin" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center">Welcome to <strong> <?php $fontcolor = ($pgender == "Male") ? "0000FF" : "FF77AA"; echo '<font color="#' . $fontcolor .'">' . $puser . '</font>';?> </strong>'s profile</td> </tr> </table> </td> </tr> <tr> <td width="21%" rowspan="8" align="center" valign="top"><img src='http://www.runningprofiles.com/members/images/thumbs/<?php echo $pimage;?>' border="1" > </td> <td width="4%" valign="middle" bgcolor="#E2E2E2">Name:</td> <td width="18%" valign="middle" bgcolor="#E2E2E2"><?php echo $pfirst_name; ?> <?php echo $plast_name; ?></td> <td width="57%" rowspan="4" valign="middle"> </td> </tr> <tr> <td width="4%" valign="middle" bgcolor="#E2E2E2">Sex: </td> <td valign="middle" bgcolor="#E2E2E2"><?php $fontcolor = ($pgender == "Male") ? "0000FF" : "FF77AA"; echo '<font color="#' . $fontcolor .'">' . $pgender . '</font>';?></td> </tr> <tr> <td width="4%" valign="middle" bgcolor="#E2E2E2">DOB:</td> <td valign="middle" bgcolor="#E2E2E2"><?php echo $pdob ; ?></td> </tr> <tr> <td width="4%" valign="middle" bgcolor="#E2E2E2">Club:</td> <td valign="middle" bgcolor="#E2E2E2"><?php echo $pclub;?></td> </tr> <tr> <td height="107" colspan="2" valign="top"><?php echo "<a href='friendrequest.php?user=$username'>Add as Friend</a>"; ?> </td> <td valign="top"></td> </tr> <tr> <td height="172" colspan="2" valign="top"><?php include 'myfriends.php';?></td> <td valign="top"> </td> </tr> <tr> <td height="216" colspan="2" valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td height="160" colspan="3" valign="top"><?php include 'shoutbox/index.php';?></td> </tr> </table> <?php } else { echo "<center>Sorry no users with that name can be found within our database </center><br />"; } } else { echo "Query failed<br />$sql<br />" . mysql_error(); } ?> works great... but then i try and insert my "followuser" script <?php $timestamp = time(); $timeout = $timestamp - 180; function selfURL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; } function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); } $filename = (selfURL()); //Insert User $insert = mysql_query("REPLACE INTO `useronline` SET `timestamp`='$timestamp', `ip`='".$_SERVER['REMOTE_ADDR']."', `file`='$filename',`user`='$username',`user_id`='".$_SESSION['user_id']."'") or die(mysql_error()); ?> and then it wont display any of this <?php <td height="172" colspan="2" valign="top"><?php include 'myfriends.php';?></td> <td valign="top"> </td> </tr> <tr> <td height="216" colspan="2" valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td height="160" colspan="3" valign="top"><?php include 'shoutbox/index.php';?></td> </tr> </table> <?php } else { echo "<center>Sorry no users with that name can be found within our database </center><br />"; } } else { echo "Query failed<br />$sql<br />" . mysql_error(); } ?> Link to comment https://forums.phpfreaks.com/topic/108368-solved-wierd-problem-with-inserting-data-to-existing-script/ Share on other sites More sharing options...
haku Posted June 2, 2008 Share Posted June 2, 2008 Where exactly are you inserting your followuser into the profile page? If you don't show us that, we can't tell you why it's not working. Link to comment https://forums.phpfreaks.com/topic/108368-solved-wierd-problem-with-inserting-data-to-existing-script/#findComment-555575 Share on other sites More sharing options...
runnerjp Posted June 2, 2008 Author Share Posted June 2, 2008 just under require_once '../settings.php'; checkLogin ('1 2'); exactly like its posted Link to comment https://forums.phpfreaks.com/topic/108368-solved-wierd-problem-with-inserting-data-to-existing-script/#findComment-555577 Share on other sites More sharing options...
haku Posted June 2, 2008 Share Posted June 2, 2008 exactly like its posted Exactly like it's posted where? Because you didn't post that in this thread. Link to comment https://forums.phpfreaks.com/topic/108368-solved-wierd-problem-with-inserting-data-to-existing-script/#findComment-555588 Share on other sites More sharing options...
runnerjp Posted June 2, 2008 Author Share Posted June 2, 2008 sorry lkike this <link rel="stylesheet" type="text/css" href="http://www.runningprofiles.com/css/login.css"><?php session_start(); require_once '../settings.php'; checkLogin ('1 2'); $timestamp = time(); $timeout = $timestamp - 180; function selfURL() { $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : ""; $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s; $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]); return $protocol."://".$_SERVER['SERVER_NAME'].$port.$_SERVER['REQUEST_URI']; } function strleft($s1, $s2) { return substr($s1, 0, strpos($s1, $s2)); } $filename = (selfURL()); //Insert User $insert = mysql_query("REPLACE INTO `useronline` SET `timestamp`='$timestamp', `ip`='".$_SERVER['REMOTE_ADDR']."', `file`='$filename',`user`='$username',`user_id`='".$_SESSION['user_id']."'") or die(mysql_error()); $username=$_GET['username']; $id = $_SESSION['user_id']; $query = "SELECT * FROM users WHERE Username = '$username' LIMIT 1"; if ($result = mysql_query($query)){ if (mysql_num_rows($result)) { $array = mysql_fetch_assoc($result); $pemail = $array['Email']; $puser = $array['Username']; $pid = $array['ID']; $pfirst_name = $array['first_name']; $plast_name = $array['last_name']; $pabout_me = $array['about_me']; $pevents = $array['events']; $pgender = $array['gender']; $pdob = $array['dob']; $pimage = $array['image']; $pclub = $array['club']; ?> <table width="100%" cellpadding="0" cellspacing="0" bordercolor="#E2E2E2"> <tr> <td style="padding-top:1px; padding-left:1px; padding-right:1px;" height="49" colspan="4" align="center" valign="top"><table class="loggedin" width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center">Welcome to <strong> <?php $fontcolor = ($pgender == "Male") ? "0000FF" : "FF77AA"; echo '<font color="#' . $fontcolor .'">' . $puser . '</font>';?> </strong>'s profile</td> </tr> </table> </td> </tr> <tr> <td width="21%" rowspan="8" align="center" valign="top"><img src='http://www.runningprofiles.com/members/images/thumbs/<?php echo $pimage;?>' border="1" > </td> <td width="4%" valign="middle" bgcolor="#E2E2E2">Name:</td> <td width="18%" valign="middle" bgcolor="#E2E2E2"><?php echo $pfirst_name; ?> <?php echo $plast_name; ?></td> <td width="57%" rowspan="4" valign="middle"><?php $result = mysql_query("SELECT * FROM useronline WHERE(user='$puser')"); while($row = mysql_fetch_array( $result )) { $last_active = time() - $row['timestamp']; } if($last_active < 300) { echo "Online"; } else { echo "Offline"; }?></td> </tr> <tr> <td width="4%" valign="middle" bgcolor="#E2E2E2">Sex: </td> <td valign="middle" bgcolor="#E2E2E2"><?php $fontcolor = ($pgender == "Male") ? "0000FF" : "FF77AA"; echo '<font color="#' . $fontcolor .'">' . $pgender . '</font>';?></td> </tr> <tr> <td width="4%" valign="middle" bgcolor="#E2E2E2">DOB:</td> <td valign="middle" bgcolor="#E2E2E2"><?php echo $pdob ; ?></td> </tr> <tr> <td width="4%" valign="middle" bgcolor="#E2E2E2">Club:</td> <td valign="middle" bgcolor="#E2E2E2"><?php echo $pclub;?></td> </tr> <tr> <td height="107" colspan="2" valign="top"><?php echo "<a href='friendrequest.php?user=$username'>Add as Friend</a>"; ?> </td> <td valign="top"></td> </tr> <tr> <td height="172" colspan="2" valign="top"><?php include 'myfriends.php';?></td> <td valign="top"> </td> </tr> <tr> <td height="216" colspan="2" valign="top"> </td> <td valign="top"> </td> </tr> <tr> <td height="160" colspan="3" valign="top"><?php include 'shoutbox/index.php';?></td> </tr> </table> <?php } else { echo "<center>Sorry no users with that name can be found within our database </center><br />"; } } else { echo "Query failed<br />$sql<br />" . mysql_error(); } ?> Link to comment https://forums.phpfreaks.com/topic/108368-solved-wierd-problem-with-inserting-data-to-existing-script/#findComment-555592 Share on other sites More sharing options...
runnerjp Posted June 3, 2008 Author Share Posted June 3, 2008 hey sorry i know i get 3 posts on the go but its just these lttle things thats buggin me lol Link to comment https://forums.phpfreaks.com/topic/108368-solved-wierd-problem-with-inserting-data-to-existing-script/#findComment-556398 Share on other sites More sharing options...
haku Posted June 3, 2008 Share Posted June 3, 2008 So to get that straight, you insert that script and it cuts off at that <td > tag right in the middle? Link to comment https://forums.phpfreaks.com/topic/108368-solved-wierd-problem-with-inserting-data-to-existing-script/#findComment-556535 Share on other sites More sharing options...
runnerjp Posted June 3, 2008 Author Share Posted June 3, 2008 yes thats correct... so nothin under is posted Link to comment https://forums.phpfreaks.com/topic/108368-solved-wierd-problem-with-inserting-data-to-existing-script/#findComment-556739 Share on other sites More sharing options...
haku Posted June 4, 2008 Share Posted June 4, 2008 I gotta admit, I have no clue. That piece of code you posted that you say isn't appearing is pure html, preceded by pure html, and followed by pure html. So the PHP shouldn't really affect it. Either all the HTML should appear, or none of it should appear. Go back and check your first post and make sure the third set of code you posted (the section you said isn't appearing) is in fact correct. I can see one thing that is a little off: <?php <td height="172" colspan="2" valign="top"><?php include 'myfriends.php';?></td>[/cope] In the first piece of code you posted, the '<?php' didn't exist, but it did when you reposted that code int eh third piece of code you posted. Was this a typo? Link to comment https://forums.phpfreaks.com/topic/108368-solved-wierd-problem-with-inserting-data-to-existing-script/#findComment-557122 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.