Page 1 of 1

Little Problems In My Website! PLEASE HELP!

Posted: Tue Feb 22, 2011 11:03 pm
by carloszamudio
Okay hi, im new in this so please help me, il promise to put tutorials and help you guys in the future. 8)

My website right now is Floggero.com i have my domain in GoDaddy.com
and my hosting is x10hosting.com and im experience some kind of problem, if you guys know please help me.

My frist problem is this

Code: Select all

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/floggero/public_html/index.php:2) in /home/floggero/public_html/index.php on line 3
My index.php is this

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php
session_start();
include('configs.php');
include('tflog.php');

//Funcion los mas visitados
function mas_visitados($tabla_visitas, $tabla_fotos, $s){
		$query_ranking = mysql_query ("SELECT * FROM $tabla_visitas ORDER BY visitas DESC LIMIT $s,1") or die (print(mysql_error()));
		while($dp = mysql_fetch_array($query_ranking)){
			$id_user_ranking = $dp['ID_user'];
			$visitas = $dp['visitas'];
		$query_thumbs_user_ranking = mysql_query ("SELECT * FROM $tabla_fotos WHERE ID_user='$id_user_ranking' ORDER BY ID DESC LIMIT 0,1");
		while($dp = mysql_fetch_array($query_thumbs_user_ranking)){
			$thumb_user_ranking = $dp['thumb'];
			$usuario_ranking = $dp['usuario'];
		echo "<a href='$usuario_ranking'><img src=\"$thumb_user_ranking\" border=0</a><br><b><a href='$usuario_ranking'>$usuario_ranking</a></b><br><br>";
		}
		}
}
//Funcion ultimas fotos
function ultimas_fotos($tabla_fotos, $s){
		$query_thumbs = mysql_query ("SELECT * FROM $tabla_fotos ORDER BY ID DESC LIMIT $s,1") or die (print(mysql_error()));
		while($dp = mysql_fetch_array($query_thumbs)){
			$id_foto = $dp['ID'];
			$thumbs = $dp['thumb'];
			$fecha = $dp['fecha'];
			$id_user = $dp['ID_user'];
			$t_user = $dp['usuario'];
			       echo "<a href='$t_user/$id_foto'><img src=\"$thumbs\" border=0</a><br><b><a href='$t_user/$id_foto'>$t_user</a></b><br><br>"; 
		}	
}
//Funcion ultimos registrados
function ultimos_registrados($tabla_usuarios, $tabla_fotos, $s){
		$query_tflogs = mysql_query ("SELECT * FROM $tabla_usuarios ORDER BY date DESC LIMIT $s,1") or die (print(mysql_error()));
		while($dp = mysql_fetch_array($query_tflogs)){
			$id_u_tflogs = $dp['ID'];
			$u_tflogs = $dp['usuario'];
		$query_thumbs_tflogs = mysql_query ("SELECT * FROM $tabla_fotos WHERE ID_user='$id_u_tflogs' ORDER BY ID DESC LIMIT 0,1");
		while($dp = mysql_fetch_array($query_thumbs_tflogs)){
			$thumb_user_tflog = $dp['thumb'];
		}
		if($thumb_user_tflog == ""){
			$thumb_user_tflog = "archivos/imagenes/sin_fotos.jpg";
		}
			echo "<a href='$u_tflogs'><img src=\"$thumb_user_tflog\" border=0</a><br><b><a href='$u_tflogs'>$u_tflogs</a></b><br><br>";
		}
}

?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<?php include('head.php'); ?>
<body background="archivos/imagenes/bg.jpg" link="#C3D6E6" vlink="#C3D6E6" alink="#D0E4F5" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="font-family: <?php echo $fuente; ?>; font-size: 13px;">

<table style="font-size: 13px;" id="Tabla_01" align="center" width="1000" height="1000" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td colspan="5">
			<img src="archivos/imagenes/banner.jpg" width="1000" height="200" alt=""></td>
  </tr>
	<tr>
		<td colspan="5" background="archivos/imagenes/index_02.png" width="1000" height="50" alt="">
		<?php
		if (isset($_SESSION["usuario"])){
		echo "<div align=center>
		<a href=$usuario_l>$usuario_l</a> | 
		<a href=subir_foto.php>Subir foto</a> | 
		<a href=configuraciones.php>Configuraci&oacute;nes</a> | 
		<a href=mps.php>$c_mps</a> | 
		<a href=amigos.php?u=$usuario_l>Amigos</a> | 
		<a href=faq.php>Puntos</a> |
		<a href=logout.php>Salir</a>
		</div><p></p>";
		} else {
		?>
<div align="center">
<form method="post" action="login2.php" name="login" style="color: #FFF">
  <p>Usuario:
  <input maxlength="24" name="usuario" value="" size="10"> 
    Contrase&ntilde;a:  
    <input maxlength="20" name="contrasena" value="" size="10" type="password" autocomplete="off"> 
  <input name="ingresar" value="Ingresar" type="submit">
  <a href="recuperar_pass.php">&iquest;Olvidaste tu contrase&ntilde;a?</a></p>
</form>
</div>
		<?php } ?>
		</td>
	</tr>
	<tr>
		<td colspan="5">
			<img src="archivos/imagenes/index_03.png" width="1000" height="23" alt=""></td>
	</tr>
	<tr>
		<td rowspan="2">
			<img src="archivos/imagenes/index_04.png" width="50" height="700" alt=""></td>
		<td rowspan="2" background="archivos/imagenes/index_05.png" width="500" height="700" alt=""><div align="center">
<table style="text-align: center; font-weight: bold; width: 476px; font-size: 13px;" border="0"
cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top; width: 150px; color: FFF;">
M&aacute;s visitados<br><br>
<?php
mas_visitados($tabla_visitas, $tabla_fotos, "0"); 
?>
</td>
<td style="vertical-align: top; width: 151px; color: FFF;">
&Uacute;ltimas fotos<br><br>
<?php
ultimas_fotos($tabla_fotos, "0");
?>
</td>
<td style="vertical-align: top; width: 151px; color: FFF;">
Usuarios nuevos<br><br>
<?php
ultimos_registrados($tabla_usuarios, $tabla_fotos, "0");
?>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 150px;">
<?php
mas_visitados($tabla_visitas, $tabla_fotos, "1"); 
?>
</td>
<td style="vertical-align: top; width: 151px;">
<?php
ultimas_fotos($tabla_fotos, "1");
?>
</td>
<td style="vertical-align: top; width: 151px;">
<?php
ultimos_registrados($tabla_usuarios, $tabla_fotos, "1");
?>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 150px;">
<?php
mas_visitados($tabla_visitas, $tabla_fotos, "2"); 
?>
</td>
<td style="vertical-align: top; width: 151px;">
<?php
ultimas_fotos($tabla_fotos, "2");
?>
</td>
<td style="vertical-align: top; width: 151px;">
<?php
ultimos_registrados($tabla_usuarios, $tabla_fotos, "2");
?>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 150px;">
<?php
mas_visitados($tabla_visitas, $tabla_fotos, "3"); 
?>
</td>
<td style="vertical-align: top; width: 151px;">
<?php
ultimas_fotos($tabla_fotos, "3");
?>
</td>
<td style="vertical-align: top; width: 151px;">
<?php
ultimos_registrados($tabla_usuarios, $tabla_fotos, "3");
?>
</td>
</tr>
<tr>
<td style="vertical-align: top; width: 150px;">
<?php
mas_visitados($tabla_visitas, $tabla_fotos, "4"); 
?>
</td>
<td style="vertical-align: top; width: 151px;">
<?php
ultimas_fotos($tabla_fotos, "4");
?>
</td>
<td style="vertical-align: top; width: 151px;">
<?php
ultimos_registrados($tabla_usuarios, $tabla_fotos, "4");
?>
</td>
</tr>
</tbody>
</table>			
			</div></td>
		<td><img src="archivos/imagenes/index_06.png" width="50" height="677" alt=""></td>
		<td rowspan="2" background="archivos/imagenes/index_07.png" width="350" height="700" alt="">
			<table style="text-align: top; width: 100%; font-size: 11px;" border="0" cellpadding="2" cellspacing="2">
            
			<?php 
			if (!isset($_SESSION["usuario"])){
			include ('registro.php');
			}
			?>
            <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
			</table>
	  </td>
		<td>
			<img src="archivos/imagenes/index_08.png" width="50" height="677" alt=""></td>
	</tr>
	<tr>
		<td>
			<img src="archivos/imagenes/index_09.png" width="50" height="23" alt=""></td>
		<td>
			<img src="archivos/imagenes/index_10.png" width="50" height="23" alt=""></td>
	</tr>
	<tr>
		<td colspan="5">
			<img src="archivos/imagenes/index_11.png" width="1000" height="27" alt=""></td>
	</tr>
</table>
<br>
<?php include ('footer.php'); ?>
<br>
</body>
</html>
My second problem is that if you look at the USERS they send me to my 404.php site
but i can access to them by going to the link like this:
Floggero.com/usuario.php?u=Sphairo

And i want the users to be like this:
Floggero.com/USERNAME

Can i change something in the Httaccess to give me that or what should i do?


My third problem is that the site is to slow, and doesnt have a lot of things, that all. PLEASE HELP ME :S

Re: Little Problems In My Website! PLEASE HELP!

Posted: Wed Feb 23, 2011 1:13 pm
by McInfo
When you enter an address into your browser, the browser generates an HTTP request and sends it to the appropriate server. The request is a virtual file made up of lines of text. The first lines are called headers, and contain named values that tell the server what the client wants. Here is an example of a request sent to http://localhost/example.php.

Code: Select all

GET /example.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.04 (lucid) Firefox/3.6.13
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
The server analyzes the request, then executes the example.php script. The server responds to the client's request by sending back the output of the script. In this case, the script just outputs 121 bytes of HTML. Like the request, the response begins with headers, which are separated from the body of the response by a blank line.

Code: Select all

HTTP/1.1 200 OK
Date: Wed, 23 Feb 2011 19:00:00 GMT
Server: Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1
X-Powered-By: PHP/5.3.1
Content-Length: 121
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

<html>
    <head>
        <title>Example</title>
    </head>
    <body>
        <p>Hello, World!</p>
    </body>
</html>
The browser reads the response, strips the headers, and converts the HTML into the graphical representation you see in the window.

If a PHP script calls the function session_start(), headers are created that tell the browser to store a cookie, which the browser will use to identify itself in future requests. A response related to a script that calls session_start() might look like this. Note the additional headers.

Code: Select all

HTTP/1.1 200 OK
Date: Wed, 23 Feb 2011 19:00:00 GMT
Server: Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1
X-Powered-By: PHP/5.3.1
Set-Cookie: PHPSESSID=36vempboarf8g3avcmc9iq8v03; path=/
Expires: Thu, 19 Nov 1981 09:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html
The response is written in a linear fashion, and there is no rewind. Once written, the response cannot be unwritten. The head of the request must come before the body. When you tell your script to write the DOCTYPE, it begins writing to the body. Calling session_start() writes to the head. That is why your script complains of "headers already sent".