Jump to content

Recommended Posts

hello, I am new to php and working on a script

 

 

here is a part of the php code

 

if (Is_Admin()) { print "<a href=$url?Admin>PHRASE_[Admin]</a> |";   }

 

index.php is loading properly for http://localhost

 

however after pointing the link "Admin" (href)  , http://localhost/php/php.exe/?Admin will be executed and  "No input file specified." message will appear on the next page

 

after removing $url ,

if (Is_Admin()) { print "<a href=?Admin>PHRASE_[Admin]</a> |";   }

 

page will properly load.

 

My question is where can I find the defined $url setting? so that it will always execute http://localhost/?Page I would like to go

 

I am running at Mysql, PHP v4 , Apache v1.3.23 without any problem on my local PC.

 

Is there any relation to "c:/apache/php/php.exe" SCRIPT_FILENAME at php info Environment?

 

I can remove the $url Manually for other links but I think much better to solve this problem the easy way, can you please advise. Thanks

Link to comment
https://forums.phpfreaks.com/topic/121066-url/
Share on other sites

@monkeypaw

thanks for your reply , i already figured it out

 

$url = getenv('SCRIPT_NAME');

if ($url == "") { $url = $_SERVER['SCRIPT_NAME']; }

$base_path = getcwd();

 

I read on some forums about changing SCRIPT_NAME to PHP_SELF

 

$url = getenv('PHP_SELF');

if ($url == "") { $url = $_SERVER['PHP_SELF']; }

$base_path = getcwd();

 

it worked out.

 

now I am stuck on Image verification code for registration form:

the images cannot be shown

 

<?php

if ($ARGV[0] == "Register") {

global $turing_test;

if ($turing_test == 1) {

$list =<<<_END_

<TR>

<TD><img src=$url?Turing_Image></TD>

<TD>PHRASE_[EnterValidationText] <INPUT TYPE="TEXT" VALUE="" NAME="TURING">

</TD>

</TR>

_END_;

print $list;}}

?>

 

 

again this $url , but after verifying the location of my turing/images/png files, they are exisitng as defined in the:

#### Turing

elseif ($ARGV[0] == 'Turing_Image')

{

session_start();

$im = ImageCreateFromPNG('./images/turing/background2.png');

$bg = imagecolorallocate($im, 255, 255, 255);

$textcolor = imagecolorallocate($im, 0, 0, 0);

ImageTTFText($im, 20, 0, 45, 27, $textcolor,'./images/turing/arial.ttf',$_SESSION['turing']);

header("Content-type: image/png");

imagepng($im);

}

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/121066-url/#findComment-624144
Share on other sites

 

however after pointing the link "Admin" (href)  , http://localhost/php/php.exe/?Admin will be executed and  "No input file specified." message will appear on the next page

How come your accessing php.exe from the web? This is not how PHP should be setup.

Link to comment
https://forums.phpfreaks.com/topic/121066-url/#findComment-624181
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.