Después de varias pruebas no lo consigo.
Me voy a explayar un poco a ver, tengo una pagina que se llama intcoment.php que es un simple formulario para actualizar el foro y poco mas todo hecho con el dreamweaver (igual es ese el problema?), la cual es:
Código PHP:
<?php require_once('Connections/comentarios.php'); ?>
<?php
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 = "nopass.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
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO comments (FIRST_NAME, SUBMIT_DATE, TIME, COMMENTS) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['FIRST_NAME'], "text"),
GetSQLValueString($_POST['SUBMIT_DATE'], "date"),
GetSQLValueString($_POST['TIME'], "text"),
GetSQLValueString($_POST['COMMENTS'], "text"));
mysql_select_db($database_comentarios, $comentarios);
$Result1 = mysql_query($insertSQL, $comentarios) or die(mysql_error());
$insertGoTo = "incomentok.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_comentarios, $comentarios);
$query_Recordset1 = "SELECT FIRST_NAME, SUBMIT_DATE, COMMENTS, `TIME` FROM comments ORDER BY COMMENT_ID DESC";
$Recordset1 = mysql_query($query_Recordset1, $comentarios) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Introducir comentarios</title>
</head>
<body>
<table width="1025" height="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="133" colspan="3" valign="top"><img src="imagenes/logomerino.png" width="280" height="133"></td>
<td colspan="2" valign="top" bgcolor="#BBD6E9"><img src="imagenes/165.jpg" width="744" height="133"></td>
</tr>
<tr>
<td height="10" colspan="5" valign="top"><img src="imagenes/3dazul.gif" width="1024" height="10"></td>
</tr>
<tr>
<td width="131" height="479" valign="top" bgcolor="#ADB2D0"><div align="center">
<p> </p>
<td width="10" height="100%" valign="top"><img src="imagenes/barra%20vertical.png" width="120%" height="100%"></td>
<td colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#ADB2D0">
<!--DWLayoutTable-->
<tr>
<td width="204" height="2"></td>
<td width="482"></td>
<td width="184"></td>
<td width="3"></td>
</tr>
<tr>
<td height="101" colspan="3" valign="top" bgcolor="#ADB2D0"><h2 align="center"><br>
Escribe tu comentario.</h2>
<p align="center">Esto no es un foro público asi que no hay reglas. Pero no sus paseis mucho que nos conocemos... </p></td>
<td></td>
</tr>
<tr>
<td height="100%" rowspan="2" valign="top"><!--DWLayoutEmptyCell--> </td>
<td height="297" valign="top">
<p> </p> <form action="<?php echo $editFormAction; ?>" method="POST" name="form1">
<table align="center">
<tr valign="baseline">
<td nowrap align="right"><strong>Nombre:</strong></td>
<td><input type="text" name="FIRST_NAME" value="Introduce tu nombre o apodo" size="32">
<input type="hidden" name="SUBMIT_DATE" value="<?php echo date('d-m-Y'); ?>" />
<input type="hidden" name="TIME" value="<?php echo gmdate('H:i:s', time()+(7200)); ?>" /></td>
</tr>
<tr valign="baseline">
<td nowrap align="right" valign="top"><strong>Comentario:</strong></td>
<td><textarea name="COMMENTS" cols="50" rows="5">Comenta, comenta...</textarea>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input name="Enviar" type="submit" value="Agregar Comentario"></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form> <p> </p></td>
</div></td>
<td></td>
</tr>
</table></td>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
Como no puedo ponerlo todo he quitado paja al archivo (algua tabla y alguna capa y tal)
Bueno el caso es que si meto lo de
require_once('class.phpmailer.php'); en la parte de arriba como he leido que debo hacer la pagina no carga, tengo que ponerlo después de la parte de restringir acceso a la pagina, hasta ahí bien.
Y no puedo meter ninguna linea de las de
$mail->From= porque tampoco carga la pagina se queda en blanco.
Entonces supongo que lo que tengo que hacer es guardar todo ese cogigo en otro archivo como por ejemplo mailforo.php y que se ejecute desde intcoment.php.
He intentado hacerlo con include y con require y no me funciona, asi que mis preguntas serian: que hago mal? y hay alguna forma de ejecutar o llamar al archivo mailforo.php desde el formulario?
Perdonar mi lenguaje que soy bastante novato seguro que he dicho muchas barbaridades, je je.
Saludos y gracias por adelantado.
ChuChi