Tema: phpMyAgenda
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/02/2011, 16:08
Avatar de ryor310575
ryor310575
 
Fecha de Ingreso: febrero-2011
Mensajes: 54
Antigüedad: 13 años, 2 meses
Puntos: 2
phpMyAgenda

Buen dia tengo por acá una aplicación de agenda que parece practica ademas la baje de la sourceforge sin embargo no logro instalarla. Por el momento es solo una forma que al llenarse ejecuta un Script de PHP. La cosa es que sin importar lo que haga siempre muestra la forma nunca ejecuta el Script. El if de control es "if(!isset($filled))" y no se si esa variable filled es algo de PHP. Puesto que el NAME en el IMPUT SUBMIT no tiene esa variable. Acá coloco el código aunque el código es largo la estructura me parece que es la siguiente.

Espero obtener algo de ayuda asi como espero que esta ayuda también colabore con el foro. Sigo investigando por mi cuenta.

================================================== ==
<html>
<head>
<title>phpMyAgenda Setup Script</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="style.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000">

<?php
if(!isset($filled)):
?>
<form>
...
...
<input type="submit" name="Submit" value="Generate configuration file and database">
</form>
<?php else :
{
...
...
}
endif;
?>
</body>
</html>

================================================== ==


================================================== ==
<html>
<head>
<title>phpMyAgenda Setup Script</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="style.css" type="text/css">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<p><font face="Verdana, Arial, Helvetica, sans-serif"><img src="images/logo25.gif" width="85" height="49" align="absmiddle"><font size="5"><b><font color="#336699">phpMyAgenda
</font><font face="Verdana, Arial, Helvetica, sans-serif"><font size="5"><b><font color="#336699">Setup</font></b></font></font></b></font></font></p>

<?php
if(!isset($filled)):
?>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Please fill the
following form to configure phpmyagenda</font></p>

<form name="form1" method="post" action="">
<input type="hidden" name="filled" value="0">
<table width="100%" border="0">
<tr>
<td colspan="2" height="2">
<p class="calendar_selday">General Setup</p>
</td>
</tr>
<tr>
<td width="28%" class="tdsingletitle2">WWW root : </td>
<td width="72%" class="normal">
<p>
<input type="text" name="agendaroot" size="40">
<br>
<span class="result_description">This is the root url of the agenda
: http://<b>www.mysite.fr</b>/agenda/install.php3<br>
</span></p>
</td>
</tr>
<tr>
<td width="28%" class="tdsingletitle2" height="40">Agenda installation folder
: </td>
<td width="72%" class="normal" height="40">
<p class="result_description">
<input type="text" name="wwwroot" size="40">
<br>
This is the folder in which you have installed phpmyagenda : http://www.mysite.fr/<b>agenda</b....php3<br>
</p>
</td>
</tr>
<tr>
<td width="28%" class="tdsingletitle2">Default language : </td>
<td width="72%">
<select name="defaultlang">
<option value="1">Fran&ccedil;ais</option>
<option value="2">English</option>
<option value="3">Espanol</option>
<option value="4">German</option>
<option value="5">Slovene</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" height="10">
<p class="calendar_selday">Database Setup</p>
</td>
</tr>
<tr>
<td width="28%" class="tdsingletitle2">Database host : </td>
<td width="72%" class="normal">
<p>
<input type="text" name="dbhost" size="40">
<br>
<span class="result_description">This is the url of your mysql server</span></p>
</td>
</tr>
<tr>
<td width="28%" class="tdsingletitle2">Database name : </td>
<td width="72%" class="normal">
<p>
<input type="text" name="dbname" size="40" value="phpmyagenda">
<br>
<span class="result_description">This is the name of the database that
will be created</span></p>
</td>
</tr>
<tr>
<td width="28%" class="tdsingletitle2">Database user : </td>
<td width="72%" class="normal">
<p>
<input type="text" name="dbuser" size="40">
<br>
<span class="result_description">This is the name you use to connect
to the database</span></p>
</td>
</tr>
<tr>
<td width="28%" class="tdsingletitle2">Database pass : </td>
<td width="72%" class="normal">
<p>
<input type="password" name="dbpass" size="40">
<br>
<span class="result_description">This is the password you use to connect
to the database</span></p>
</td>
</tr>
</table>
<p align="center">
<input type="submit" name="Submit" value="Generate configuration file and database">
</p>
</form>
<?php else :
{
$file_tpl = "application.tpl";
$tpl = fopen($file_tpl , "r");
if($tpl == false)
{
echo "Unable to open file '$file_tpl'. Check that this file is present and re-launch the install script";
die();
}
$file_appli = "application.php3";
$appli = fopen($file_appli , "w+");
if($appli == false)
{
echo "Unable to create file '$file_appli'. Unable to continue the installation.";
die();
}
$content = fread($tpl , filesize($file_tpl));
echo "<span class='normal'>Setting folders...ok</span><br>";
$content = eregi_replace("{WWWROOT}" , $wwwroot , $content);
$content = eregi_replace("{AGENDAROOT}" , $agendaroot , $content);
echo "<span class='normal'>Setting default language...ok</span><br>";
$content = eregi_replace("{DEFAULTLANG}" , $defaultlang , $content);
echo "<span class='normal'>Setting database information...ok</span><br>";
$content = eregi_replace("{DBHOST}" , $dbhost , $content);
$content = eregi_replace("{DBNAME}" , $dbname , $content);
$content = eregi_replace("{DBUSER}" , $dbuser , $content);
$content = eregi_replace("{DBPASS}" , $dbpass , $content);
echo "<span class='normal'>Saving configuration...";
$result = fwrite($appli , $content);
if($result == 0)
{
echo "<br>Unable to write '$file_appli'. Setup aborted. phpMyAgenda is not properly installed.</span><br>";
die();
}
else
echo ("ok</span><br>");
echo "<span class='normal'>Connecting to database...";
if(!$dbh = @mysql_pconnect($dbhost, $dbuser, $dbpass))
{
echo "<b>Can't connect to $dbhost as $dbuser</b>. Setup aborted. phpMyAgenda is not properly installed.</span>";
die();
}
else
echo "ok</span><br>";
echo "<span class='normal'>Creating database $dbname...";
if(!@mysql_query("CREATE DATABASE ".$dbname))
{
if(!@mysql_select_db($dbname))
{
echo "<b>Can't create database $dbname</b>. Setup aborted. phpMyAgenda is not properly installed.</span>";
die();
}
else
echo "ok</span><br>";
}
else
echo "ok</span><br>";
echo "<span class='normal'>Selecting database $dbname...";
if(!@mysql_select_db($dbname))
{
echo "<b>Can't select database $dbname</b>. Setup aborted. phpMyAgenda is not properly installed.</span>";
die();
}
else
echo "ok</span><br>";

echo "<span class='normal'>Creating tables and predefined accounts...";
// read dump from phpmyadmin
/* $Id: db_readdump.php3,v 1.12 1999/11/24 11:20:37 tobias Exp $ */
@set_time_limit(10000);
function split_sql($sql)
{
$sql = trim($sql);
$buffer = array();
$ret = array();
$in_string = false;

for($i=0; $i<strlen($sql); $i++)
{
if($sql[$i] == ";" && !$in_string)
{
$ret[] = substr($sql, 0, $i);
$sql = substr($sql, $i + 1);
$i = 0;
}

if($in_string && ($sql[$i] == $in_string) && $buffer[0] != "\\")
{
$in_string = false;
}
elseif(!$in_string && ($sql[$i] == "\"" || $sql[$i] == "'") && $buffer[0] != "\\")
{
$in_string = $sql[$i];
}
if(isset($buffer[1]))
{
$buffer[0] = $buffer[1];
}
$buffer[1] = $sql[$i];
}

if (!empty($sql))
{
$ret[] = $sql;
}

return($ret);
}

$sql_file = "phpmyagenda.sql";
if(!empty($sql_file) && $sql_file != "none")
{
$sql_query = fread(fopen($sql_file, "r"), filesize($sql_file));
}

$pieces = split_sql($sql_query);

if (count($pieces) == 1)
{
$sql_query = trim($pieces[0]);
include ("sql.php3");
exit;
}

for ($i=0; $i<count($pieces); $i++)
{
$pieces[$i] = stripslashes(trim($pieces[$i]));
$result = mysql_query ($pieces[$i]) or die();
}
}
echo "ok</span><br>";
echo "<span class='normal'>Adding Administrator account : login = <b>admin</b>, pass = <b>pass</b>... ok</span></br>";
echo "<span class='normal'>Adding Write enable account : login = <b>write</b>, pass = <b>write</b>... ok</span></br>";
echo "<span class='normal'>Adding Read only account : login = <b>read</b>, pass = <b>read</b>... ok</span></br>";
echo "<br><span class='tdsingletitle'>Congratulation, setup has completed successfully.<br></span>";
echo "<br><span class='tdsingletitle2'>Click on the following links to start using phpMyAgenda :<br>";
echo "<br><span class='tdsingletitle2'><a href='agenda.php3'>Visitor interface</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='./admin/index.php3'>Administrator interface</a><br>";
endif;
?>


<p>&nbsp; </p>
</body>
</html>

================================================== ====