sombrero.php
Código PHP:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_general = "***********";
$database_general = "***************";
$username_general = "**********";
$password_general = "*******************";
$general = mysql_pconnect($hostname_general, $username_general, $password_general) or trigger_error(mysql_error(),E_USER_ERROR);
?><?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "/logeo.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE usuarios SET casa=%s WHERE usuario=%s",
GetSQLValueString($_POST['seis'], "text"),
GetSQLValueString($_SESSION['MM_Username'], "text"));
mysql_select_db($database_general, $general);
$Result1 = mysql_query($updateSQL, $general) or die(mysql_error());
$updateGoTo = "/sombrero2.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_Recordset1 = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_Recordset1 = $_SESSION['MM_Username'];
}
mysql_select_db($database_general, $general);
$query_Recordset1 = sprintf("SELECT * FROM usuarios WHERE usuario = %s", GetSQLValueString($colname_Recordset1, "text"));
$Recordset1 = mysql_query($query_Recordset1, $general) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- DW6 -->
<head>
<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<title>Entertainment - Text</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="mm_entertainment.css" type="text/css" />
</head>
<body bgcolor="#14285f">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="02021e">
<td width="400" colspan="2" rowspan="2" nowrap="nowrap"><img src="mm_entertainment_image.jpg" alt="Header image" width="400" height="140" border="0" /></td>
<td width="360" height="58" nowrap="nowrap" colspan="2" id="logo" valign="bottom">Expresso Hogwarts</td>
<td width="100%"> </td>
</tr>
<tr bgcolor="02021E">
<td height="57" nowrap="nowrap" colspan="2" id="tagline" valign="top">Él no te morderá.. capaz..<br /> </td>
<td width="100%"> </td>
</tr>
<tr>
<td colspan="5" bgcolor="#cc3300"><img src="mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
</tr>
<tr>
<td colspan="5"><img src="mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
</tr>
<tr>
<td colspan="5" bgcolor="#cc3300"><img src="mm_spacer.gif" alt="" width="1" height="1" border="0" /></td>
</tr>
<tr>
<td colspan="5" id="dateformat"> <br />
<a href="/index.php">Home</a> -<a href="clases.php"> Clases</a> - <a href="/diagon/index.php">Diagon</a><br /> </td>
</tr>
<tr>
<td width="156" valign="top"> </td>
<td colspan="2" valign="top"><br />
<table border="0" cellspacing="0" cellpadding="2" width="504">
<tr>
<td class="subHeader">Sombrero Seleccionador</td>
</tr>
<tr>
<td class="bodyText"><p align="center"> </p>
<p>¿Qué es el sombrero seleccionador? Es un objeto, que selecciona la casa a la cual sos apto para ir..</p>
<p>Se dice que a Gryffindor, de color rojo y dorado, van los valientes... que a Hufflepuff, negra y amarilla, los leales y que a Slytherin , los viles ... No nos olvidemos de Ravenclaw, donde los astutos tienen su lugar..</p>
<p>¿Así qué? ¿A cuál irás?</p>
<p align="center"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/Blason_Gryffondor.svg/545px-Blason_Gryffondor.svg.png" alt="Gryffindor" width="105" height="119" /><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Blason_Poufsouffle.svg/200px-Blason_Poufsouffle.svg.png" alt="Gryffindor" width="105" height="119" /><img src="/imagenes/545px-Blason_Serdaigle.svg.png" alt="Gryffindor" width="105" height="119" /><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/97/Blason_Serpentard.svg/200px-Blason_Serpentard.svg.png" alt="Gryffindor"