ragazzi ho un problema anzi mi serve un consiglio. volevo chiedere se fosse possibile attraverso un tag a crocietta attivare o disattivare una funzione in questo caso quello si scrivere o no l'e-mail nel imput ?? se non sn riuscito a spiegarmi bene posso darvi qualche indicazione in + [in pratica cio che intendo è, se possibile attraverso ad un tag a crocietta attivare e disattivare una scritta dentro un imput] vi ringrazie gia in anticipo
Codice PHP:
<?PHP $reqlevel = 1;?>
<?php
$f = @$_GET['f'];
$t = @$_GET['t'];
if (!isset($f)) $f=0;
if (!isset($t)) $t=-1;
require('functions.php');
include ("../../config.php");
$forums=load_index();
set_index($forums[$f]);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<title><?php echo "$look_title | $i_name" ?></title>
<link rel="stylesheet" type="text/css" href="style/style.css">
<link rel="help" href="help.html">
<link rel="index" href="./">
<link rel="copyright" href="copyright.html">
<link rel="home" href="<?php echo $look_home ?>">
<link rel="up" href="thread.php?f=<?php echo $f ?>">
<script language="javascript" type="text/javascript"><!--
key_b=key_i=key_u=0;
function keyp(which) {
switch (which) {
case 0:
if (!key_b) {
key_b=1;
document.form.text.value+='[B]';
document.form.but0.value='..B';
} else {
key_b=0;
document.form.text.value+='[/B]';
document.form.but0.value='B..';
}
break;
case 1:
if (!key_i) {
key_i=1;
document.form.text.value+='[I]';
document.form.but1.value='..I';
} else {
key_i=0;
document.form.text.value+='[/I]';
document.form.but1.value='I..';
}
break;
case 2:
if (!key_u) {
key_u=1;
document.form.text.value+='[U]';
document.form.but2.value='..U';
} else {
key_u=0;
document.form.text.value+='[/U]';
document.form.but2.value='U..';
}
break;
case 3:
document.form.text.value+='[URL='+prompt('Please, insert the full page address', 'http://')+']'+prompt('Please, insert the page title', 'Page')+'[/URL]';
break;
case 4:
document.form.text.value+='[IMG]'+prompt('Please, insert the full image address', 'http://')+'[/IMG]';
break;
case 5:
document.form.text.value+='[EMAIL]'+prompt('Please, insert the eMail address', 'address@email')+'[/EMAIL]';
break;
}
document.form.text.focus();
}
function check() {
if (document.form.author.value.length==0) {
alert("Please insert a Name before submit!");
return false;
}
<?php if ($t==-1) { ?>
if (document.form.title.value.length==0) {
alert("Please insert a Title before submit!");
return false;
}
<?php } ?>
if (document.form.text.value.length==0) {
alert("Please insert some Text before submit!");
return false;
}
a=b=0;
if (document.form.text.value.search(/\[B\]/)>-1) a=document.form.text.value.match(/\[B\]/g).length;
if (document.form.text.value.search(/\[\/B\]/)>-1) b=document.form.text.value.match(/\[\/B\]/g).length;
while(a<b) {
document.form.text.value+='[B]';
a++;
}
while(a>b) {
document.form.text.value+='[/B]';
b++;
}
a=b=0;
if (document.form.text.value.search(/\[I\]/)>-1) a=document.form.text.value.match(/\[I\]/g).length;
if (document.form.text.value.search(/\[\/I\]/)>-1) b=document.form.text.value.match(/\[\/I\]/g).length;
while(a<b) {
document.form.text.value+='[I]';
a++;
}
while(a>b) {
document.form.text.value+='[/I]';
b++;
}
a=b=0;
if (document.form.text.value.search(/\[U\]/)>-1) a=document.form.text.value.match(/\[U\]/g).length;
if (document.form.text.value.search(/\[\/U\]/)>-1) b=document.form.text.value.match(/\[\/U\]/g).length;
while(a<b) {
document.form.text.value+='[U]';
a++;
}
while(a>b) {
document.form.text.value+='[/U]';
b++;
}
expires = new Date();
expires.setMonth(expires.getMonth()+2);
nocookie = new Date();
expires.setMonth(expires.getMonth()-1);
if (document.form.save_author.checked) {
document.cookie='cook_author='+document.form.author.value+';expires='+expires.toGMTString();
} else {
document.cookie='cook_author='+document.form.author.value+';expires='+nocookie.toGMTString();
}
if (document.form.save_email.checked) {
document.cookie='cook_email='+document.form.email.value+';expires='+expires.toGMTString();
} else {
document.cookie='cook_email='+document.form.email.value+';expires='+nocookie.toGMTString();
}
return true;
}
--></script>
</head>
<body>
<?php include ("../membersonly.inc.php"); ?>
<div align="center">[img]<?php echo $look_logo ?>[/img]
<form action=new_exe.php method=post onsubmit="return check();" name=form>
<table class="main" cellspacing=0 align=center>
<tr><td class="title" colspan="3"><?php if ($t==-1) echo 'New Thread'; else echo 'Add post'; ?> </td></tr>
<tr>
<td style="width:45%;text-align:right">[b]Nick[/b]</td>
<td><input name=author readonly value="<?php echo ("$user_currently_loged"); ?>"></td>
<td style="width:45%;text-align:left"><input type=checkbox checked name=save_author> <span class=mini>Memorizza</span></td>
</tr><tr>
<td style="text-align:right">
[b]la tua eMail[/b] (optional)</td>
<td><input name=email value=" <?PHP
// print the mailadres retrieved from the database
//htmlspecialchars() is used to make sure the users can't put any (working) html code in
//there name that would screw up the admin page
echo htmlspecialchars($row["mailadres"],ENT_QUOTES); ?>"></td>
<td style="width:45%;text-align:left"><input type=checkbox checked name=save_email> <span class=mini>Memorizza</span></td>
</tr>
<?php if ($t==-1) echo '<tr><td style="text-align:right">
[b]Titolo del Thread[/b]</td><td colspan="2"><input name=title></td></tr>'; ?>
<tr><td style="text-align:center" colspan="3">
<input name=but0 type=button value="B.." onclick="keyp(0)">
<input name=but1 type=button value="I.." onclick="keyp(1)">
<input name=but2 type=button value="U.." onclick="keyp(2)">
<input type=button value="URL" onclick="keyp(3)">
<input type=button value="Immagine" onclick="keyp(4)">
<input type=button value="eMail" onclick="keyp(5)">
<textarea name=text cols=60 rows=8></textarea>
</td></tr>
<tr><td colspan="3" style="text-align:center">
<input type=button value=Annulla onclick="history.back()">
<input type=reset value=Reset>
<input style="border-color:white" type=submit value=Invio>
<input type=hidden name=f value=<?php echo $f ?>>
<input type=hidden name=t value=<?php echo $t ?>>
<input type=hidden name=time value=<?php echo time() ?>>
</td></tr>
<tr><td colspan="3" class="copyright">[url="index.php"]Home[/url]</td></tr>
</table>
</form>
</div>
</body>
</html>