FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

i have a few questions

 


agentofnight
i had a few questions
i was wondering how i can close a window after submiting its infomation. this is wat i have
Code:

<?php
foreach($_POST as $key => $value){
   $$key= $value;
   }   
//check msg
if ($_POST['name']=="" || $_POST['msg']==""){
echo "Please go back and fill in every field.";

}
/
//Database stuff
   if('$submit'){
    $date=date(" M- d H:i");
   $connect=mysql_connect("localhost","root","");
   mysql_select_db("learnit");
   mysql_query("INSERT INTO shoutbox(date,name,msg) VALUES('$date','$name','$msg')") or die(mysql_error());
   mysql_close($connect) or die(mysql_error());
   }
echo
?>
// i want the window to close here, if it doesnt the window remains blank

i was also wondering if this loop is secure
Code:
foreach($_POST as $key => $value){
   $$key= $value;
   }   


and my last question is how can i make a page constantly refresh
shamil
You can not close window ulness you use javascript. If you want to use it you must include a javascript function which closes the window.
To make page refresh you can add below code between head tags.
Code:
<meta http-equiv="refresh" content="2;url=http://www.box.az">

2 is for after how many second the page is going to refresh.
Stubru Freak
agentofnight wrote:
i had a few questions
i was wondering how i can close a window after submiting its infomation. this is wat i have
Code:

<?php
foreach($_POST as $key => $value){
   $$key= $value;
   }   
//check msg
if ($_POST['name']=="" || $_POST['msg']==""){
echo "Please go back and fill in every field.";

}
/
//Database stuff
   if('$submit'){
    $date=date(" M- d H:i");
   $connect=mysql_connect("localhost","root","");
   mysql_select_db("learnit");
   mysql_query("INSERT INTO shoutbox(date,name,msg) VALUES('$date','$name','$msg')") or die(mysql_error());
   mysql_close($connect) or die(mysql_error());
   }
echo
?>
// i want the window to close here, if it doesnt the window remains blank

i was also wondering if this loop is secure
Code:
foreach($_POST as $key => $value){
   $$key= $value;
   }   


and my last question is how can i make a page constantly refresh


Javascript code for first is:
<script type="text/javascript">
window.close();
</script>
agentofnight
heh both of them worked thanxs guys
thnn
Code:
foreach($_POST as $key => $value){
   $$key= $value;
   } 

I would say that no the loop isnt secure. The reason for me saying that is that i could create a form with a large amount of false things and exploiting code and your script would still accept it. If you specify which ones you want then this cannot be done.
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.