Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

problem with forms

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

problem with forms

Postby gemini1325 » Fri Aug 09, 2002 5:47 am

i have a problem with forms on windows. everything i enter on the mainpage doesn't go to the php script.

--enternews.php--
<form action="newnews.php" method="post">
Temat: <input type="text" name="ng"><br>
Autor: <input type="text" name="au"><br>
Email: <input type="text" name="em"><br>
Wiadomo&#347;&#263;: <textarea name="wi" rows=10 cols=50></textarea><br>
<input type="submit" value="Wy&#347;lij">
</form>
--cut here--

--newnews.php--
<?PHP
$sc = fopen("database.txt","r");
$dt = fopen("dbcopy.txt","w+");
while(!feof($sc))
{
$linia = fgets($sc);
fwrite($dt,"$linia");
}
fclose($sc);
fclose($dt);
$datenow = date("d.m.y");
$timenow = date("H:i:s");
$filnm = date("dmyHis");
$db = fopen("database.txt","w+");
$dbrst = fopen("dbcopy.txt","r");
fwrite($db,"$filnm.txt\n");
while(!feof($dbrst))
{
$linia = fgets($dbrst);
fwrite($db,"$linia");
}
fclose($db);
fclose($dbrst);
$nwnsfl = fopen("$filnm.txt","w+");
fwrite($nwnsfl,"$ng\n");
fwrite($nwnsfl,"$au\n");
fwrite($nwnsfl,"$em\n");
fwrite($nwnsfl,"$datenow $timenow\n");
fwrite($nwnsfl,"$wi\n");
fclose($nwnsfl);
?>
--cut here--

my system info:
Windows ME PL 4.90.3000
Apache 2.0.39 and 1.3.26
Php 4.2.1

please help!

regards,
gemini
gemini1325
New php-forum User
New php-forum User
 
Posts: 4
Joined: Fri Aug 09, 2002 5:38 am

Postby DoppyNL » Fri Aug 09, 2002 5:56 am

You are accessing the posted variables directly like this:

$ng

but they may not be global.
as of version 4.1.x the configuration setting "register_globals" is off by default because of security reasons.

you can acces you're posted variables via the array $_POST or $_GET (depending on the submit form) or you can use $_REQUEST (wich containts both)

in short:

try this:

$_POST['ng']

Greetz Daan
DoppyNL
 

Postby gemini1325 » Fri Aug 09, 2002 8:20 am

thanks for the info,
unfortunatelly, your sollution to the problem didn't work, but you helped a lot, so i knew what i was looking for. import_request_variables() helped in this situation.

does making the variables global reduce perfomance much? (the site will be hosted at a priv. server, i think no more than 1Ghz :-()




best regards,
gemini


edit: BTW: do you know how to get Gallery running http://gallery.menalto.com/modules.php?op=modload&name=News&file=index?? i have a little problem with it: it can't acces some files:
Error: Could not acquire lock (C:/web/albums/albumdb.dat.lock)!


also i have this warnings when i try to configure it:
Allow the Gallery .htaccess file to set application specific configuration options for the Gallery application. This is controlled by the webserver owner so it's not always possible for you to change it. The main drawbacks to not having this are that you may not be able to upload files > 2MB (eg, big ZIP files) and you may not be able to use mod_rewrite (see below). Warning!

Apache is not obeying your .htaccess file. Try entering the following into your web server's httpd.conf file:

<Directory c:\web>
AllowOverride Options FileInfo
</Directory>

(if i change the httpd.conf file i get error 500)


and
Check to see if your webserver is compiled with mod_rewrite. Mod_rewrite allows the Gallery to use shorter URLs that are easier to read and look nicer when you mail them to your web-challenged relatives. It's not an essential feature. Warning!


Either mod_rewrite is not installed or your .htaccess file is not enabled (see above). Either way, we'll have to use longer URLs in the Gallery. If you want to turn it on I'd suggest that you make sure that your .htaccess file works and then if it still doesn't work you may need to reconfigure and rebuild Apache with this flag:
--enable-module=rewrite



i would be very grateful if you would help. i've posted on many mailing lists and sites, but no body answered my question.



best regards,
gemini
gemini1325
New php-forum User
New php-forum User
 
Posts: 4
Joined: Fri Aug 09, 2002 5:38 am

Postby DoppyNL » Fri Aug 09, 2002 8:58 am

gemini1325 wrote:does making the variables global reduce perfomance much? (the site will be hosted at a priv. server, i think no more than 1Ghz :-()

no, but it will be allways of in the future, with allways off I mean you can't change it! So programming that way right now might be a good idea.

Also, it's off because of security reasons, so automaticly making those variables global could be a security problem in case someone wants to hack you're pages.

as for Gallery, I don't know that piece of software. I can't see the problem myself in there, nor a possible sollution. Perhaps you should contact the programmers of Gallery themself if you still haven't got it running but walked you're way through there help-pages.

Greetz Daan
DoppyNL
 


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.