Jump to content


Photo

Odd problem


  • Please log in to reply
2 replies to this topic

#1 locutus84

locutus84
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 18 May 2003 - 01:57 PM

Hey Im new here and hope someone would like to try to help me with this :) .... Yesterday I\'ve installed apache with php and mysql. When I try to execute a command like this below it doesn\'t execute it. Normally the
line: The post have been registered! should come up on the screen but it doesn\'t. And the table don\'t get the data that it should have got from this.

However this work on tripods database but not on my own server that I\'ve installed yesterday so the problem lies in my server and probably in mysql. Do anyone have any suggestion what it could be?
Thx in advance..

<?
$dbHost = \"localhost\";
$dbUser = \"*\";
$dbPass = \"*\";
$dbDatabase = \"forum\";
if(isset($posta)) {

mysql_connect(\"$dbHost\", \"$dbUser\", \"$dbPass\") or die (\"Error connecting to database.\");
$datum=date(\"Y-m-d H:i:s\");
$query = \"INSERT INTO forum(amne,namn,epost,inlagg,datum)
VALUES (\'$amne\',\'$namn\',\'$epost\',\'$inlagg\',\'$datum\')\" or die(\"jek\");
mysql_db_query($dbDatabase,$query);

echo \"The post have been registered!\";
} else {
?>
<html>
<body>
<form action=\"<?\"aaa.php\"?>\" method=\"POST\" name=\"formen\">
Ämne:<br>
<input type=\"text\" name=\"amne\"><br>
Namn:<br>
<input type=\"text\" name=\"namn\"><br>
Epost:<br>
<input type=\"text\" name=\"epost\"><br>
Inlägg:<br>
<textarea name=\"inlagg\" rows=\"5\" cols=\"40\"></textarea><br>
<input type=\"submit\" value=\"Skicka\" name=\"posta\">
<input type=\"reset\" value=\"Återställ\">
</form>
<?
}
?>
</body>
</html>

#2 metalblend

metalblend
  • Members
  • PipPipPip
  • Advanced Member
  • 89 posts
  • LocationCalifornia, USA

Posted 19 May 2003 - 01:43 AM

The server which hosts the file most likely has the directive register_globals off, which is the new configuration for PHP 4.2.0 and later. Read more about the alternative here: http://www.php.net/m...d.variables.php

I have configured your code to work fine on my server.. it runs a rather old version of PHP, which is why I have to use [b]$HTTP_{method}_VARS
method more commonly used. ;)

Here\'s the working copy.. fill out the form and the source is displayed on the next page: http://code.phirebru...ef/httpvars.php

Hopefully you find what sections you need to remove.. if not, let us know.

Hope that helps.

#3 locutus84

locutus84
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 20 May 2003 - 05:14 PM

thank you that helped alot :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users