Link to home
Start Free TrialLog in
Avatar of altariamx2003
altariamx2003Flag for Mexico

asked on

same facebook comment in dynamic php pages

Im trying to use the facebook comment plugin in several php dynamic pages

I use the same page (vacio.php) to show the content, if the previous page is from facebook the page shows his own format but if the previous page came from our webpages (the administration site or the public site) show another format.

This is the code of vacio.php
<?php require_once('database.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$colname_rs_dbnotes = "-1";
if (isset($_GET['rpl'])) {
    $temp=split(":",$_GET['rpl']);
  $origen = $temp[1];	
  $colname_rs_dbnotes = $temp[0];
}
mysql_select_db($database_dbnotes, $dbnotes);
$query_rs_dbnotes = sprintf("SELECT * FROM videos WHERE clave = %s", GetSQLValueString($colname_rs_dbnotes, "text"));
$rs_dbnotes = mysql_query($query_rs_dbnotes, $dbnotes) or die(mysql_error());
$row_rs_dbnotes = mysql_fetch_assoc($rs_dbnotes);
$totalRows_rs_dbnotes = mysql_num_rows($rs_dbnotes);
?>
<html>
<head>
<meta http-equiv="Content-Language" content="es-mx">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>VIDEO DE GRUPO SSC</title>
<div id="fb-root"></div>
<LINK id=mail href="http://www.grupossc.com/contenidos/mail.css" type=text/css rel=stylesheet>
<LINK id=estilos href="http://www.grupossc.com/contenidos/estilos.css" type=text/css rel=stylesheet>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/es_MX/all.js#xfbml=1&appId=xxxxxxxxxxx";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>


</head>

<body>
<?php if ($origen == 0) { // Viene de facebook ?>
<div align="center">
							<table border="0" width="684" cellspacing="0" cellpadding="0">
								<tr>
									<td width="684">
										<img border="0" src="http://www.grupossc.com/imagenes/ctrans.gif" width="1" height="5"></td>
								</tr>
								

								<tr>
									<td width="684" bgcolor="#F2F2F2" align="right">
										<font class="mapa">&nbsp;
                                        <?php
                                        if ($row_rs_dbnotes['album'] == "1")
											{ echo '<a style="color: 000080; text-decoration: underline" href="https://www.grupossc.com/facebook/videos/index.php?rpl=1">GRUPO SSC</a>';}
											else if ($row_rs_dbnotes['album'] == "2")
											{ echo '<a style="color: 000080; text-decoration: underline" href="https://www.grupossc.com/facebook/videos/index.php?rpl=2">NUESTROS CLIENTES</a>';}
                                            
                                          ?>  
                                            &nbsp;&nbsp; &gt;&nbsp;&nbsp;<font color="#C0C0C0"><?php echo $row_rs_dbnotes['titulo']; ?></font></font></td>
								</tr>
								<tr>
									<td width="684">
									<img width="1" height="5" border="0" src="http://www.grupossc.com/imagenes/ctrans.gif"></td>
								</tr>
							</table>
<table border="0" width="684" cellspacing="0" cellpadding="0" height="560">
	<tr>
		<td width="684" height="560" align="center"><?php echo $row_rs_dbnotes['liga']; ?></td>
		
	</tr>
	<tr>
		<td width="684" align="left"><font class="cuerpo_central1"><b><?php echo $row_rs_dbnotes['titulo']; ?></b></font></td>
		
	</tr>
    	<tr>
		<td width="684" align="left"><font class="cuerpo_central1"><?php echo $row_rs_dbnotes['resumen']; ?></font></td>
		
	</tr>
			  <tr><td width="684" valign="top" align="center"><img border="0" src="http://www.grupossc.com/imagenes/ctrans.gif" width="1" height="4" style="display:block;"></td></tr>
			  	  
		  <tr><td width="684" valign="top" align="center"><img border="0" src="http://www.grupossc.com/imagenes/linea2.jpg" width="686" height="1"></td></tr>
		  
				  <tr><td width="684" valign="top" align="center"><img border="0" src="http://www.grupossc.com/imagenes/ctrans.gif" width="1" height="1" style="display:block;"></td></tr>
	<tr>
		<td width="684" align="center"><?PHP    
$url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
echo "<div class='fb-comments' data-href='$url' data-num-posts='10' data-width='684'></div>";
?>
</td>
		
	</tr>    
</table></td>
	</tr>
</table>
</div>
 <?php } // Viene de facebook ?>
 
 <?php if ($origen == 1) { // No viene de facebook ?>
<table border="0" width="1024" cellspacing="0" cellpadding="0" height="560">

	<tr>
		<td width="684" height="560" rowspan="2" align="center"><?php echo $row_rs_dbnotes['liga']; ?></td>
		<td width="340" height="322" valign="top" bgcolor="#FFFFFF"><font class="cuerpo_central1"><b><?php echo $row_rs_dbnotes['titulo']; ?></b></font><br><font class="cuerpo_central1"><?php echo $row_rs_dbnotes['resumen']; ?></font></td>
	</tr>
	<tr>
		<td width="340" height="238" valign="top" align="center" bgcolor="#FFFFFF">        <div style="padding: 0; margin: 0; overflow: auto; height: 238px; width: auto; border: none;">

<?PHP    
$url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
echo "<div class='fb-comments' data-href='$url' data-num-posts='10' data-width='300'></div>";
?>
</td>
	</tr>

</table></td>
	</tr>
</table>
 <?php } // No viene de facebook ?>
 
</body>
</html>
<?php
mysql_free_result($rs_dbnotes);
?>

Open in new window


This is the problem:
If you try to enter to the same php dynamic page from facebook or our websites the comments that you enter in facebook doesnt show in our websites and viceversa

for example if you enter from facebook this is the link: http://www.grupossc.com/2012/vacio.php?rpl=181121546:0

and this is the link if you access from our websites: http://www.grupossc.com/2012/vacio.php?rpl=181121546:1

The diference is the number at the end of the link, it means wich is the previous page

If you access from facebook, shows no comments
User generated image
if you access from our websites, it shows comments
User generated image
I would like to know what I need to do that if I add a comment to one of this dynamic pages, this comment stays if I access to the same page from facebook of viceversa
ASKER CERTIFIED SOLUTION
Avatar of altariamx2003
altariamx2003
Flag of Mexico image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial