Jump to content

add directory to form...


forumnz

Recommended Posts

how can i alter this so that when stg2 is updated, it also adds gallery/ to the front of it?

 

Thanks a lot.

 

 

 

 

 

<?php

 

error_reporting(E_ALL);

ini_set('display_errors', '1');

 

 

 

if ($submit) {

 

  // process form

 

  $db = mysql_connect("localhost", "photomagik", "****");

 

  mysql_select_db("photomagik_co_nz_-_soho",$db);

 

  $sql = "UPDATE mag  set stg1='$stg1',stg2='$stg2',stg3='$stg3' WHERE id='$nm'";

 

  $result = mysql_query($sql);

 

  //echo $sql;

 

  echo "Thank you! Information entered. <a href=edit.php>Back...</a>\n";

 

} else{

 

 

 

  // display form

 

 

 

  ?>

 

 

 

  <form method="post" action="<?php echo $PHP_SELF?>">

 

  1:<input name="nm" type="checkbox" value="1"><br />

 

  2:<input name="nm" type="checkbox" value="2"><br />

 

  3:<input name="nm" type="checkbox" value="3"><br />

 

  4:<input name="nm" type="checkbox" value="4"><br />

 

  5:<input name="nm" type="checkbox" value="5"><br />

 

  6:<input name="nm" type="checkbox" value="6"><br />

 

  Link<input type="Text" name="stg2"><br>

 

  Image<input type="Text" name="stg1"><br>

 

  Text<input type="Text" name="stg3"><br>

 

  <input type="Submit" name="submit" value="Enter information">

 

  </form>

 

 

 

  <?php

 

 

 

} // end if

 

 

 

?>

 

Link to comment
Share on other sites

my bad, or you could change it to

 

$stg2 = 'gallery/'.$stg2;

 

register_globals is the php config setting where all request methods automatically register defined variables in the local environment, opens you up to all sorts of hacking attacks..

 

for instance, i could just as easily access your page  like this...

 

www.YOURDOMAIN.com/YOURSCRIPT.php?submit=1

 

and the script will think that i've posted the form and will start to process it as such.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.