How worth is the software XAMPP

Problems with the Windows version of XAMPP, questions, comments, and anything related.

How worth is the software XAMPP

Postby AAA123 » 30. December 2010 13:31

How worth is the software XAMPP if it can not display entered value in following script "get-it.php"
(Apache works, php.ini as original)
<?
echo '<HTML><HEAD><TITLE> Get and Display</TITLE><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-2">';
echo '</HEAD><BODY>';

if ($tekst) { print "Entered value <B>$tekst</B><BR>";
print '<A HREF="http://localhost/get-it.php"> Back </A>';

} else { // no data, display the form
print '<FORM ACTION="http://localhost/get-it.php" METHOD=GET>';
print '<INPUT TYPE="text" NAME="tekst">';
print '<INPUT TYPE="submit" VALUE="Send">';
print '</FORM>';
}
echo '</BODY></HTML>';
?>
AAA123
 
Posts: 15
Joined: 30. December 2010 12:52

Re: How worth is the software XAMPP

Postby Sharley » 30. December 2010 13:34

Try using <?php instead of <? as in XAMPP 1.7.3 short_open_tags are set to off by default.

Please read the comments in the php.ini file about short_open_tags.
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: How worth is the software XAMPP

Postby AAA123 » 30. December 2010 13:52

I've changed <? into <?php , but it still doesnt work!
AAA123
 
Posts: 15
Joined: 30. December 2010 12:52

Re: How worth is the software XAMPP

Postby Sharley » 30. December 2010 13:59

What does not working for you mean?

Details please so it can be checked out - what do you see in your browser, error messages etc?

What are you typing in your browser's address bar?
User avatar
Sharley
AF Moderator
 
Posts: 3316
Joined: 03. October 2008 05:10
Location: Yeppoon, Australia Time Zone: GMT/UTC+10
Operating System: Win 7 Pro 32bit/XP Pro SP3

Re: How worth is the software XAMPP

Postby AAA123 » 30. December 2010 14:47

1) First you see
http://localhost/get-it.php
^^^^^^^^^^^^^^^^^^^^^^^^^
field [abba ] button [Send]
----------------------------------------------------------------------

2) After clicking on "Send" button in Mozilla Firefox you may see
http://localhost/get-it.php?tekst=abba
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
field[ now is empty ] button [Send]

PS. I have screen dumps showing explanation above ,
but I dont see any possibilities how to attach it to the forum
AAA123
 
Posts: 15
Joined: 30. December 2010 12:52

Re: How worth is the software XAMPP

Postby AAA123 » 30. December 2010 16:27

* Edit post
* Delete post
* Report this post
* Reply with quote

Re: How worth is the software XAMPP
Postby AAA123 » 30. December 2010 14:47

The script "get-it.php" (see prev topic events) is elementary and worked under Apache1.3 and PHP4.3, but under XAMPP it does not display entered value!

1) First you type in address bar:
http://localhost/get-it.php
^^^^^^^^^^^^^^^^^^^^^^^^^
The following form is displayed:

field [abba ] button [Send]
----------------------------------------------------------------------

2) After clicking on "Send" button you may see in address bar:
http://localhost/get-it.php?tekst=abba
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The following form is displayed:

field[ now is empty ] button [Send]

Good, but also sould be displayed a message "The entered value abba".
But is not. Help!

PS. I have screen dumps showing explanation above ,
but I dont see any possibilities how to attach it to the forum
AAA123
 
Posts: 15
Joined: 30. December 2010 12:52

Re: How worth is the software XAMPP

Postby Altrea » 30. December 2010 16:30

try $_GET['tekst'] instead of $tekst.

global values will not be transfered to local variables since register_globals is set to off (and thats a good change for security)
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8298
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: How worth is the software XAMPP

Postby AAA123 » 30. December 2010 19:11

Altrea wrote:
try $_GET['tekst'] instead of $tekst

I did, then the script "get-it.php" results in following message:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\xampp\htdocs\get-it.php on line 4 (the line now containing supposed $_GET['tekst']
AAA123
 
Posts: 15
Joined: 30. December 2010 12:52

Re: How worth is the software XAMPP

Postby Altrea » 30. December 2010 21:46

Please show your sourcecode again with the changes you made (and please use the "code BB-Tags" for better reading).
Somewhere in your code you have done something wrong
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8298
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: How worth is the software XAMPP

Postby AAA123 » 31. December 2010 09:25

Here is code with changet $tekst into $_GET['tekst'].
Because Internet browser does not interpret involved tags in this message, you see all good as is.
(bb-tags will rather confuse).
The script only test if method GET works. After the submision of entered value, it is added into current URL after ? (for example): http://localhost/get-it.php?$tekst=value.
Then it should be displayed. The variable name used by GET is the same as the field name in the form.

<?php
echo '<HTML><HEAD><TITLE> Get and Display</TITLE><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-2">';
echo '</HEAD><BODY>';

if ($_GET['tekst']) { print "Entered value: <B>$_GET['tekst']</B><BR>";
print '<A HREF="http://localhost/get-it.php"> Back </A>';

} else { // no data, display the form
print '<FORM ACTION="http://localhost/get-it.php" METHOD=GET>';
print '<INPUT TYPE="text" NAME="tekst">';
print '<INPUT TYPE="submit" VALUE="Send">';
print '</FORM>';
}
echo '</BODY></HTML>';
?>
AAA123
 
Posts: 15
Joined: 30. December 2010 12:52

Re: How worth is the software XAMPP

Postby Altrea » 31. December 2010 15:02

AAA123 wrote:print "Entered value: <B>$_GET['tekst']</B><BR>";

This can't work this way.

Two possibilities for Array-Values in print:

Code: Select all
print "Entered value: <B>{$_GET['tekst']}</B><BR>";

Code: Select all
print "Entered value: <B>" .$_GET['tekst']. "</B><BR>";
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8298
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: How worth is the software XAMPP

Postby AAA123 » 01. January 2011 13:55

Altrea thanks you very much for the hint to display entered value from the form field ie:

print "Entered value: <B>{$_GET['tekst']}</B><BR>";

but value is not displayed still.

I decided to set in "php.ini"

register_globals = On

and now it works.
AAA123
 
Posts: 15
Joined: 30. December 2010 12:52

Re: How worth is the software XAMPP

Postby Altrea » 01. January 2011 15:48

register_globals can be a big security issue, especially if you have just basic php knowledge.
And register_globals will be returned with the release of PHP 6.

So my suggestion is that you should learn to write clean and secure PHP scripts right know and leave register_globals off.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8298
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 63 guests