nit Posted March 20, 2007 Share Posted March 20, 2007 Hi all I'm practising php but for some of my scipts i get an error like this: Forbidden You don't have permission to access /prog/<br /><b>Notice</b>: Use of undefined constant PHP_SELF - assumed 'PHP_SELF' in <b>c:/PHP/prog/s6.php</b> on line <b>11</b><br />PHP_SELF on this server. I'm using Apache 1.3 I really dont have the time to go check all my settings, i got exams in 2 days...so can anyone help me fix the problem? Thanks Link to comment https://forums.phpfreaks.com/topic/43441-need-help/ Share on other sites More sharing options...
redarrow Posted March 20, 2007 Share Posted March 20, 2007 Post ur code ok. Link to comment https://forums.phpfreaks.com/topic/43441-need-help/#findComment-210950 Share on other sites More sharing options...
nit Posted March 20, 2007 Author Share Posted March 20, 2007 Oh, sorry! The script works when i use action="s6.php" which is the name of the same script, or any other script.... but i get the error message for all combinations of PHP_SELF / $_SERVER[php_SELF]. <html> <? if (isset ($_POST['submit'])) { $name=$_POST['username']; $email=$_POST['email']; } ?> <form action= "<? echo PHP_SELF; ?>" method="post"> Name: <input type="textfield" name="username" /><br /> Email: <input type="textfield" name="email" /><br /> <input type="submit" name="submit" value="Display" /> </form> <? if(isset($_POST['submit'])) { $name=ucwords(strtolower($name)); echo("<br>Name: $name"); $k=0; for($i=0;$i<strlen($email);$i++) if($email[$i]=='@') $k++; if($k>0) echo ("<br>Email: $email"); else echo("<br> Please enter a correct email"); } ?> </html> Link to comment https://forums.phpfreaks.com/topic/43441-need-help/#findComment-210975 Share on other sites More sharing options...
redarrow Posted March 20, 2007 Share Posted March 20, 2007 <?php echo $_SERVER['PHP_SELF']?> Link to comment https://forums.phpfreaks.com/topic/43441-need-help/#findComment-210976 Share on other sites More sharing options...
nit Posted March 20, 2007 Author Share Posted March 20, 2007 ;( it still gives me the error! Link to comment https://forums.phpfreaks.com/topic/43441-need-help/#findComment-210980 Share on other sites More sharing options...
nit Posted March 20, 2007 Author Share Posted March 20, 2007 I got another question,it's an exam question actually: I'm supposed to create a login form, accept user name and password(forget validation for now) and display another form which asks for some details..if the user doesnt enter the details (in the second form) in a specific amount of time, i have to timeout his session and give a warning.I have never used sessions before and really don't have enuf time to learn it now(php exams in 2 days and got 11 more scripts to learn)So, can someone just add the necessary code in the following program: I've just written a script which does all of the above , apart from use of sessions.(This program carries 35 marks!) Thanks <?php if(!isset($_POST['submit1']) && !isset($_POST['submit2'])) { ?> <form action="s9.php" method="post"> <br>Name:<input type="textfield" name="username"> <br>Password: <input type="password" name="password"> <br><input type="submit" name="submit1" value="Log in"> </form> <? } ?> <? if(isset($_POST['submit1'])) { $name=$_POST['username']; $password=$_POST['password']; ?> <form action="s9.php" method="post"> <br>Full Name:<input type="textfield" name="fname"> <br>City: <input type="textfield" name="city"> <br>Phone no: <input type="textfield" name="phone"> <br><input type="submit" name="submit2" value="View details"> <? } ?> <? if(isset($_POST['submit2'])) { $fname=$_POST['fname']; $city=$_POST['city']; $phone=$_POST['phone']; echo ("<br>$fname"); echo ("<br>$city"); echo ("<br>$phone"); } ?> Link to comment https://forums.phpfreaks.com/topic/43441-need-help/#findComment-210988 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.