- Home
- Categorie
- Coding e Sistemistica
- PHP
- aiuto con funzione get e post
-
aiuto con funzione get e post
ciao ragazzi... vorrei modificare correttamente questa pagina...
[PHP]<?php$title = 'Nuovo topic';
require 'pmheader.php';$sub = (empty($_POST['sub'])) ? "0" : $_POST['sub'];
$txt = (empty($_POST['txt'])) ? "0" : $_POST['txt'];
$forum = (empty($_POST['forum'])) ? "-1" : $_POST['forum'];echo $header;
if(!$userdata['session_logged_in'])
{
echo "Spiacente devi essere loggato per postare un nuovo topic. Clicca <anchor>Qui!<go href="" . append_sid("waplogin.$phpEx") . "" /></anchor>";
}else if($sub == "0" || $txt == "0" || $forum == "-1")
{
?>
Oggetto: <input name="sub" type="text" emptyok="false"/><br/>
Messaggio: <input name="txt" emptyok="false"/><br/>
Forum: <select name="forum">
<option value="-1">Scegli il forum</option>
<?php$query = $db->sql_query("select forum_id,forum_name from ". FORUMS_TABLE . " where forum_status = \"0\" order by cat_id ASC"); $forum = $db->sql_fetchrowset($query); foreach ($forum as $val) { $auth = auth(AUTH_ALL,$val['forum_id'],$userdata); if($auth['auth_post']) { echo "<option value=\"".$val['forum_id']."\">".htmlentities ($val['forum_name'])."</option>\n"; } }
?>
</select><br/>
<anchor>
Invia<br/>
<go href="<?php echo append_sid("wapnew.$phpEx?sub=$(sub)&txt=$(txt)&forum=$(forum)"); ?>" method="post">
<postfield name="sub" value="$(sub)"/>
<postfield name="txt" value="$(txt)"/>
<postfield name="forum" value="$(forum)"/>
</go>
</anchor>
<?php
}
else
{
$current_time = time();
$sql = $db->sql_query("SELECT * FROM " . USERS_TABLE . " WHERE username = '" . str_replace("'", "''", $userdata['username']) . "'");
$userdata = $db->sql_fetchrow($sql);
$user_id = $userdata['user_id'];
if( $userdata['user_level'] != ADMIN && $board_config['board_disable'] )
{
echo "Mi spiace ma il forum e'disattivato. Visita il sito web in un' altro momento";
}
else {
$sql = "SELECT forum_status FROM " . FORUMS_TABLE . " WHERE forum_id = "$forum_id"";
$query = $db->sql_query($sql);
$forum_status = $db->sql_fetchrow($query);
$auth = auth(AUTH_ALL,$forum_id,$userdata);
if ( $forum_status['forum_status'] == FORUM_LOCKED && !$auth['auth_mod'])
{
$footer = "<br/><br/><anchor>Forum Home<go href="" . append_sid("wap.$phpEx") . "" /></anchor>".$footer;
echo "Mi spiace questo forum e' chiuso. Non puoi postare nel topic.";
die(" ".$footer);
}
else
{
//Flood Control
$current_time = time();
$query = $db->sql_query("SELECT MAX(post_time) AS last_post_time FROM " . POSTS_TABLE . " WHERE poster_id = "$user_id"");
$flood = $db->sql_fetchrow($query);
if ( $flood['last_post_time'] > 0 && ( $current_time - $flood['last_post_time'] ) < $board_config['flood_interval'] )
{
echo "Non puoi inviare un messaggio subito. Aspetta un po e riprova.";
}
else
{
$txt = $txt." \n\n<i>Scritto da Nokia Mobile Device</i>";
$uid = make_bbcode_uid();
$txt = prepare_wap_post($txt,$uid);
$time = time();
$update_topics = $db->sql_query("insert into " . TOPICS_TABLE . " (forum_id, topic_title, topic_poster, topic_time, topic_views, topic_replies, topic_status, topic_vote, topic_type, topic_first_post_id, topic_last_post_id, topic_moved_id) values ("$forum", "$sub", "$user_id", "$time", "0", "0", "0", "0", "0", "0","0", "0")");
$topic = $db->sql_nextid();
$update_posts = $db->sql_query("insert into " . POSTS_TABLE . " (topic_id, forum_id, poster_id, post_time, poster_ip, enable_bbcode, enable_html, enable_smilies, enable_sig, post_edit_count) values ("$topic","$forum","".$userdata['user_id']."","$time","".$userdata['user_ip']."","0","0","1","$sig","0")");
$post_id = $db->sql_nextid();
$update_topics2 = $db->sql_query("update ". TOPICS_TABLE . " set topic_first_post_id = "$post_id", topic_last_post_id = "$post_id" where topic_id = "$topic"");
$update_text = $db->sql_query("insert into " . POSTS_TEXT_TABLE . " (post_id, bbcode_uid, post_subject, post_text) values ("$post_id", "$uid", "$sub", "$txt")");
$update_forums = $db->sql_query("update " . FORUMS_TABLE . " set forum_posts=forum_posts+1, forum_last_post_id = $post_id, forum_topics=forum_topics+1 where forum_id = "$forum"");
$update_user = $db->sql_query("update " . USERS_TABLE . " set user_posts=user_posts+1 where user_id = "$user_id"");
echo "Clicca <anchor>Qui!<go href="". append_sid("waptopic.$phpEx?topic=$topic&forum=$forum") . "" /></anchor> per vedere il tuo messaggio.";
}
}
}
}
echo $footer;
?>
[/PHP]
com'è ora se invio un messaggio compare nella barra del link...vorrei che non lo facesse...sapete aiutarmi???grazie
-
Dipende da casi del genere:
[php].........
......(wapnew.$phpEx?sub=$(sub)&txt=$(txt)&forum=$(forum)"); ?>"
........[/php]
Non puoi far molto lasciandola così dato che invii via url i parametri, posso consigliarti, dato che il form usa il method=POST, di memorizzarti il tutto in hidden data:
[php]<input type="hidden" name="sub" value="<?=$sub ?>">
<input type="hidden" name="txt" value="<?=$txt ?>">
............[/php]
Puoi provare così
-
e se fosse così???
[php]
<anchor>
Posta<br/>
<go href="<?php echo append_sid("wapreply.php?sig=$(sig)&topic=$topic&forum=$forum_id&start=$start&re=$(re)&go=1"e=$quote&post=$post_id"); ?>" method="post"><postfield name="un" value="$(un)"/> <postfield name="pw" value="$(pw)"/> <postfield name="re" value="$(re)"/> <postfield name="sig" value="$(sig)"/> </go>
</anchor>
[/php]
????
-
Scusami, ho riletto meglio il tuo codice, hai provato a modificarlo così?
[php]<go href="<?php echo append_sid(wapnew.$phpEx); ?>" method="post">
<postfield name="sub" value="$(sub)"/>
<postfield name="txt" value="$(txt)"/>
<postfield name="forum" value="$(forum)"/>
</go>
[/php]
Dato che hai già tutti e tre i dati nei vari postfield, perchè metterli anche nell'href?:? Non so, forse mi sfugge qualcosa (cosa che non escludo