Salve aa tutti raga mi servirebbe un po di aiuto
ho scaricato uno script e quanddo lo eseguo mi viene la grafica mista alle veriabili
chi mi può dare una mano a correggerlo?
datemi la mail che ve lo invio![]()
![]()
![]()
Salve aa tutti raga mi servirebbe un po di aiuto
ho scaricato uno script e quanddo lo eseguo mi viene la grafica mista alle veriabili
chi mi può dare una mano a correggerlo?
datemi la mail che ve lo invio![]()
![]()
![]()
Posta qui il codice in questione...
"Le uniche cose che sbagli sono quelle che non provi a fare."
Atipica
<?php
//----------------------CREDITS-------------------------
//
// Sviluppato da Antonio Zambon
// per contattarmi :
// settenanus@hotmail.com
//
// il programma è gratuito per un uso personale
//
//------------------------------------------------------
$db = "calendario";
$link = mysql_connect("localhost","root","root");
if (! mysql_select_db($db)) die("Connessione al database fallita.");
$ad = getdate();
IF ($cam == "elimina") {
$del = "DELETE FROM calendario WHERE id = '$id'";
mysql_query($del,$link);
$valuta="true";
}
IF ($cam == "done") {
$upd = "UPDATE calendario SET evaso = '1' WHERE id = '$id'";
mysql_query($upd,$link);
$valuta="true";
}
IF ($cam == "salva") {
$ora_app = "$ora_init:$min_init:00";
$ora_fine_app = "$ora_fine:$min_fine:00";
$data_prcont = "$year-$mon-$day";
$verifica = "SELECT * FROM calendario WHERE data_app = '$data_prcont'";
$resver = mysql_db_query($db,$verifica,$link);
$rowsver = mysql_num_rows($resver);
IF ($rowsver != 0) {
WHILE ($row = mysql_fetch_array($resver)) {
IF (($ora_app >= $row[ora_app]) && ($ora_app < $row[ora_fine_app])) {
print "<SCRIPT> alert('Orario già occupato.');
window.history.go(-1);
</script>\n";
exit();
}
IF (($ora_fine_app > $row[ora_app]) && ($ora_fine_app < $row[ora_fine_app])) {
print "<SCRIPT> alert('Orario già occupato.');
window.history.go(-1);
</script>\n";
exit();
}
IF (($ora_fine_app < $row[ora_app]) && ($ora_fine_app > $row[ora_fine_app])) {
print "<SCRIPT> alert('Orario già occupato.');
window.history.go(-1);
</script>\n";
exit();
}
}
}
$massimo = "SELECT MAX(id) FROM calendario";
$resmax = mysql_db_query($db,$massimo,$link);
$rowmax = mysql_fetch_array($resmax);
$max = $rowmax[0] + 1;
$ora_app = "$ora_init:$min_init:00";
$ora_fine_app = "$ora_fine:$min_fine:00";
$data_prcont = "$year-$mon-$day";
$calen = "INSERT INTO calendario (id,dove,ora_app,ora_fine_app,data_app,motivo)
VALUES ('$max','$dove','$ora_app','$ora_fine_app','$data_ prcont','$motivo')";
mysql_query($calen,$link);
$valuta="true";
}
IF ($cmd == "salva") {
$query = "SELECT * FROM calendario WHERE id = '$id'";
$res = mysql_db_query($db,$query,$link);
$row = mysql_fetch_array($res);
}
?>
<html>
<head>
<STYLE>
a:link { font-family: Times new roman; font-size: 14px; font-style: normal; color: #FFff00; text-decoration: underline;}
a:visited { font-family: Times new roman; font-size: 14px; font-style: normal; color: #FFff00; text-decoration: underline;}
a:active { font-family: Times new roman; font-size: 14px; font-style: normal; color: #FFff00; text-decoration: underline;}
a:hover { font-family: Times new roman; font-size: 14px; font-style: normal; color: #FFff00; text-decoration: underline;}
.tendina {COLOR: #000000; FONT-FAMILY: Arial;FONT-SIZE: 12px}
</STYLE>
<? IF ($valuta == "true") { ?>
<SCRIPT>
window.setTimeout("self.close()",100);
</SCRIPT>
<? } ?>
<SCRIPT language="JavaScript">
<!--
function checkData() {
if (document.aggiungi.ora_init.value=="")
{
alert("Errore nella compilazione dell'ora di inizio");
document.aggiungi.ora_init.focus();
return false;
}
if (document.aggiungi.min_init.value=="")
{
alert("Errore nella compilazione del minuto di inizio");
document.aggiungi.min_init.focus();
return false;
}
if (document.aggiungi.ora_fine.value=="")
{
alert("Errore nella compilazione dell'ora di inizio");
document.aggiungi.ora_fine.focus();
return false;
}
if (document.aggiungi.min_fine.value=="")
{
alert("Errore nella compilazione del minuto di inizio");
document.aggiungi.min_fine.focus();
return false;
}
if (document.aggiungi.year.value=="")
{
alert("Errore nella compilazione della data");
document.aggiungi.year.focus();
return false;
}
if (document.aggiungi.mon.value=="")
{
alert("Errore nella compilazione della data");
document.aggiungi.mon.focus();
return false;
}
if (document.aggiungi.day.value=="")
{
alert("Errore nella compilazione della data");
document.aggiungi.day.focus();
return false;
}
if (document.aggiungi.dove.value=="")
{
alert("Errore nella compilazione della data");
document.aggiungi.day.focus();
return false;
}
if (document.aggiungi.motivo.value=="")
{
alert("Errore nella compilazione della data");
document.aggiungi.motivo.focus();
return false;
}
return true;
}
//-->
</SCRIPT>
<meta http-equiv="Content-Language" content="it">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Nuova attività</title>
</head>
<body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" <? IF ($valuta == "true") echo "Onload=\"document.aggiungi.submit();\""; ?>>
<div align="left">
<table border="0" cellpadding="0" width="350" cellspacing="0">
<tr>
<td width="350" height="230">
<div align="center">
<center>
<table border="0" cellpadding="2" width="95%" height="225">
<tr>
<td width="100%" style="border: 1 solid #C0C0C0" bgcolor="#808080" height="20">
<p align="center"><font color="#FFFFFF">Inserimento nuova attività</font></td>
</tr>
<tr>
<td width="100%" style="border: 1 solid #C0C0C0" height="100%">
<div align="center">
<table border="0" cellpadding="0" width="95%" height="190">
<? IF ($valuta == "true") { ?>
<FORM method=post name="aggiungi" onSubmit="return checkData()" action="calendario.php" target=_blank>
<? } ELSE { ?>
<FORM method=post name="aggiungi" onSubmit="return checkData()" action="attivita.php">
<? } ?>
<input type=hidden name=cam value="salva">
<input type=hidden name=cmd value="vai">
<tr>
<td width="25%" style="border: 1 solid #000000; margin-left: 4" height="23" bgcolor="#808080"><font face="Times New Roman" size="2" color="#FFFFFF">Data</font></td>
<td width="75%" style="margin-left: 4" colspan="3" height="23" class=tendina><? IF ($cmd == "salva") { echo "$row[data_app]"; } else IF ($cmd == "do") { ?>
<span class="tendina" style="margin-left: 4">
<input type=text name=day2 size=2 maxlenght=2 class=tendina value=<? echo ".$day."?>>
</span>/
<input type=text name=mon size=2 maxlenght=2 class=tendina value="<? echo $mon ?>">/<input type=text name=year size=4 maxlenght=4 class=tendina value="<?echo $year ?>">
<? } ELSE { ?>
<input type=text name=day size=2 maxlenght=2 class=tendina value="<? echo $ad[mday] ?>">/<input type=text name=mon size=2 maxlenght=2 class=tendina value="<? echo $ad[mon] ?>">/<input type=text name=year size=4 maxlenght=4 class=tendina value="<?echo $ad[year] ?>">
<? } ?> </td>
</tr>
<tr>
<td width="25%" style="border: 1 solid #000000; margin-left: 4" height="24" bgcolor="#808080"><font face="Times New Roman" size="2" color="#FFFFFF">Ora inizio</font></td>
<td width="26%" style="margin-left: 4" height="24" class=tendina>
<? IF ($cmd == "salva") { echo "$row[ora_app]"; } else { ?>
<input type=text name=ora_init size=2 maxlenght=2 class=tendina value=<? echo $ora_init ?>>:<input type=text name=min_init size=2 maxlenght=2 class=tendina value=<? echo $min_init ?>>
<? } ?> </td>
<td width="18%" style="border: 1 solid #000000; margin-left: 4" height="24" bgcolor="#808080"><font face="Times New Roman" size="2" color="#FFFFFF">Ora fine</font></td>
<td width="31%" style="margin-left: 4" height="24" class=tendina>
<? IF ($cmd == "salva") { echo "$row[ora_fine_app]"; } else { ?>
<input type=text name=ora_fine size=2 maxlenght=2 class=tendina value=<? echo $ora_fine ?>>:<input type=text name=min_fine size=2 maxlenght=2 class=tendina value=<? echo $min_fine ?>>
<? } ?> </td>
</tr>
<tr>
<td width="25%" style="border: 1 solid #000000; margin-left: 4" height="24" bgcolor="#808080"><font face="Times New Roman" size="2" color="#FFFFFF">Dove</font></td>
<td width="75%" style="margin-left: 4" colspan="3" height="24" class=tendina>
<? IF ($cmd == "salva") { echo "$row[dove]"; } else { ?>
<input type=text name=dove size=30 maxlenght=30 class=tendina >
<? } ?> </td>
</tr>
<tr>
<td width="25%" style="border: 1 solid #000000; margin-left: 4" height="50" bgcolor="#808080" valign="top"><font face="Times New Roman" size="2" color="#FFFFFF">Motivo</font></td>
<td width="75%" style="margin-left: 4" colspan="3" height="50" valign="top" class=tendina>
<? IF ($cmd == "salva") { echo "$row[motivo]"; } else { ?>
<textarea name=motivo cols=30 rows=5 class=tendina></textarea>
<? } ?> </td>
</tr>
<tr>
<td width="100%" style="border: 1 solid #000000; margin-left: 4" height="22" bgcolor="#808080" valign="middle" colspan="4">
<p align="center">
<? IF ($cmd == "salva") {
echo "<font face=\"Times New Roman\" size=\"1\" color=\"#FFFFFF\"></font>"; } else { ?><input type=submit value="Salva" class=tendina><? } ?></td>
</tr>
<? IF ($cmd == "salva") { ?>
<tr>
<td width="100%" style="border: 1 solid #000000; margin-left: 4" height="22" bgcolor="#808080" valign="middle" colspan="4">
<div align="center">
<table border="0" cellpadding="0" width="90%">
<td width="100%" valign="bottom" align=right>
<a href="attivita.php?id=<? echo $row[id] ?>&cam=done">
[img]immagini/conferma.jpg[/img]</a>
<a href="attivita.php?id=<? echo $row[id] ?>&cam=elimina">
[img]immagini/elimina.jpg[/img]</a>
</table>
</div> </td>
</tr>
<? } ?>
</form>
</table>
</div>
</td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
<? mysql_close($link); ?>
Così a colpo d'occhio direi che il problema è che lo script che hai postato è in PHP, non in javascript, hai installato php sul tuo server web? Se non lo hai fatto, fallo, è indispensabile!
Ciao!
"Le uniche cose che sbagli sono quelle che non provi a fare."
Atipica
Vedi annotazioni nella precedente.
Comunque se fai il submit all'onload della pagina lo script per il controllo dei campi e' inutile: non viene nemmeno richiamato.
Il guaio per i poveri computers e' che sono gli uomini a comandarli.
Attenzione ai titoli delle discussioni: (ri)leggete il regolamento
Consultate la discussione in rilievo: script / discussioni utili
Usate la funzione di Ricerca del Forum