2007-09-15, 07:21 PM
I want to add the loginbox with the lastest posts in my web by means of an include, but it gives me a error.
The source code is: link
cheers!
The source code is: link
<?php
$rel = "foro/";
chdir($rel);
require $rel."global.php";
?>
<html>
<head>
<title>Pasionwe - Gadget</title>
<script>
function submitted()
{
setTimeout("refresh()",6000);
}
function refresh()
{
var sURL = unescape(window.location.pathname);
window.location.href = sURL;
}
</script>
<style type="text/css">
.contenedor {
background-color: #FBFFFF;
border-style: solid;
border-width: 1px;
font-family: Verdana, Arial, Sans-Serif;
font-size: 8pt;
margin: 0;
padding: 4px;
}
body {
background-color: #FBFBFB;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div class="contenedor">
<?php
if($mybb->user["uid"])
{
?>
• <a href="<?php echo $rel; ?>private.php">Ver Msjs Privados</a><br />
• <a href="<?php echo $rel; ?>usercp.php">User CP</a><br /><br /><br />
<?php
$host = "fdb1.awardspace.com"; // Your database host
$user = "pasionwe_foro"; // Your database username
$pass = "pasala"; // Your database password
$data = "pasionwe_foro"; // The name of your database
$prfx = "mybb_"; // The table prefix of your database
$col1 = "#FFFFFF"; // The color of the first row--alternating row colours
$col2 = "#FCFCFC"; // The color of the second row
// NOTE: I didn't include ./global.php because I wasn't sure what the variables look like.
$num = 6; // The number of recent posts to show
$author = TRUE; // Should we display the post author? (TRUE or FALSE)
$conn = mysql_connect($host,$user,$pass) or die("<b>Error:</b> Fallo la conexion con la BD");
$sel = mysql_select_db($data,$conn) or die("<b>Error:</b> Fallo la conecion con la BD");
if($author == TRUE)
{
?>
<table>
<?php
}
$i = 0;
$q = mysql_query("SELECT * FROM ".$prfx."posts ORDER BY dateline DESC LIMIT ".$num);
while($row = mysql_fetch_array($q))
{
if($i % 2 == 0)
{
$bgcolor = $col1;
}
else
{
$bgcolor = $col2;
}
$i++;
$q2 = mysql_query("SELECT * FROM ".$prfx."forums WHERE fid = '".$row["fid"]."';");
$row = mysql_fetch_array($q2);
?>
<tr>
<td width="50%" bgcolor="<?php echo $bgcolor; ?>">
<a title="In forum: <?php echo $row["name"]; ?>" href="<?php echo $rel; ?>showthread.php?tid=<?php echo $row["tid"]; ?>&action=lastpost">
<b><?php echo $row["subject"]; ?></b></a></p></td>
<?php
if($author == TRUE)
{
?>
<td width="50%" bgcolor="<?php echo $bgcolor; ?>">by
<b><a title="<?php echo $row["username"]; ?>'s Profile" href="<?php echo $rel; ?>member.php?action=profile&uid=<?php echo $row["uid"]; ?>">
<?php echo $row["username"]; ?></b></a></td>
<?php
}
?>
</tr>
<?php
}
?>
</table>
<?php
}
else
{
?>
<table>
<form method="POST" action="<?php echo $rel; ?>member.php" onsubmit="return submitted();">
<input type="hidden" name="action" value="do_login">
<input type="hidden" name="url" value="">
<tr>
<td>Nombre de usuario</td>
<td><input type="text" name="username" size="15"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="password" size="15"></td>
</tr>
<tr>
<td colspan="2"><center><input type="submit" value="Ingresar" name="submit"></center></td>
</tr>
</form>
</table>
<?php
}
?>
</div>
cheers!