Jump to content

abrogard

New Members
  • Posts

    8
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

abrogard's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Windows 10. IIS. when I try to echo or print $_SERVER values in my logon script (which I got from the web. I am very much a total beginner) I get no output at all. It seems to stop everything. There's something I am not understanding. Can anyone help? What I am trying to do is get the logged in User's name so's I send different users to different pages: each their own page. I have windows authentication on so they've all had to give a windows user logon to get to this page. then on this page they have give another login so's they can be prevented from going to each other's pages. If you see what I mean. That's the plan. I will post the script and you can see where I've put the echo. <?php /************************************************************************/ /* PHP Simple PasswordProtect v1.0 */ /* =========================== */ /* */ /* Written by Steve Dawson - http://www.stevedawson.com */ /* Freelance Web Developer - PHP, MySQL, HTML programming */ /* */ /* This program is free software. You can redistribute it and/or modify */ /* but please leave this header intact, thanks */ /************************************************************************/ ########################################################################## $password = "admin"; // Modify Password to suit for access, Max 10 Char. ########################################################################## ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Simple Password Protect - PHP PasswordProtect</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- P { FONT-SIZE: 8pt; COLOR: #000000; FONT-FAMILY: Verdana, Tahoma, Arial} TD { FONT-SIZE: 8pt; COLOR: #000000; FONT-FAMILY: Verdana, Tahoma, Arial} --> </style> </head> <body> <?php print "<h2 align=\"center\">PHP Simple Password Protect</h2>"; // If password is valid let the user get access if (isset($_POST["password"]) && ($_POST["password"]=="$password")) { header('Location: diana'); ?> <!-- START OF HIDDEN HTML - PLACE YOUR CONTENT HERE --> <p align="center"><br><br><br> <b>Congratulations</b><br>you have gained access to the Protected and Secret Area!</p> <?php // doesn't work when put here. //echo $_SERVER['LOGON_USER'] //echo $_SERVER['AUTH_USER'] //echo $_SERVER['REDIRECT_LOGON_USER'] //echo $_SERVER['REDIRECT_AUTH_USER'] ?> <!-- END OF HIDDEN HTML --> <?php } else { // Wrong password or no password entered display this message if (isset($_POST['password']) || $password == "") { print "<p align=\"center\"><font color=\"red\"><b>Incorrect Password</b><br>Please enter the correct password</font></p>";} print "<form method=\"post\"><p align=\"center\">Please enter your password for access<br>"; print "<input name=\"password\" type=\"password\" size=\"25\" maxlength=\"10\"><input value=\"Login\" type=\"submit\"></p></form>"; } print "<br><br><p align=\"center\">Written by <a href=\"http://www.stevedawson.com\">SteveDawson.com</a></p>"; ?> <BR> </body> </html>
  2. Thank you, Bob.... onwards to the next prob.
  3. I get this error message: Parse error: parse error, unexpected '=' in c:\Inetpub\wwwroot\xyford\manual\mybook.php on line 46 And here's line 46. The "=" causing the trouble is, I think, the "chapter=" one. if ($prevPage > $chapters[$chapter][0]) $out .= "<a href="/mybook.php?chapter={$chapter}&page={$prevPage}">Prev</a>"; I can't see what to do about it. Can anyone help?
  4. I couldn't edit that post - that's why it is still there. So STUPID! Nothing is written to the database because there's no command to write anything. Sorry, sorry, sorry. I don't think they do it in these forums but it'd please me if the moderator deleted the whole thing. My face is red.
  5. Can anyone point out what's wrong with my feedback.php? It used to work fine and I don't think I did anything but it stopped working - i.e. I had it on a site which I never looked at and when I did look at it I noticed the rubbish written to the database had inexplicably stopped being written there some months ago..... since then I've tried to clean it up and use it elsewhere ( I'm a baby at php and most else) but I can't get it to go right. In this attempt it was giving me the dreaded 'headers already written..' error and I (after googling) took out all the blank space I could and extra comments and what not and stuck in some debugging prints for me and now I get no errors but I get nothing written to the database and no email sent to me. If anyone cares to look at it to help me out, here it is, warts and all, with just the names changed to protect the innocent. <? // mail it $mailto = 'med@yahoo.com' ; $subject = "Ploverpark Feedback Form" ; $formurl = "feedback.html" ; $errorurl = "error.html" ; $thankyouurl = "thankyou.html" ; $uself = 0; $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $username = $_POST['username'] ; $firstname = $_POST['firstname'] ; $email = $_POST['email'] ; $comments = $_POST['comments'] ; $secondname = $_POST['secondname'] ; $country = $_POST['country'] ; $phone = $_POST['phone'] ; // do write to database now--------------------------- $link = mysql_connect("mydb.com", "my_pkguest", "password") or die("Could not connect : " . mysql_error()); print "Connected successfully<p>"; $DB = "my_pkguest"; $table = "clients"; mysql_select_db($DB) or die ("Database $DB not select.." . mysql_error()); print "Successfully select the Database: $DB "; $query = "INSERT INTO $table(username,firstname,secondname,email,country,phone,comments) values('$username','$firstname','$secondname','$email','$country','$phone','$comments')"; print "Successfully inserted to table: $table "; //------------------------------------------------------ $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } print "Now past the if isset "; //if (empty($name) || empty($email) || empty($comments)) { // header( "Location: $errorurl" ); // exit ; //} if ( ereg( "[\r\n]", $username ) || ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit ; } print "Now past the if ereg "; if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "UserName of sender: $username\n" . "Firstname of sender: $firstname\n" . "Secondname of sender : $secondname\n" . "Country of sender : $country\n" . "Phone number of sender: $phone\n" . "Email of sender: $email\n" . "------------------------- COMMENTS -------------------------\n\n" . $comments . "\n\n------------------------------------------------------------\n" ; print "Now past the messageproper "; mail($mailto, $subject, $messageproper, "From: \"$username\" <$email>" . $headersep . "Reply-To: \"$username\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" ); print "Now past the mail"; //header( "Location: $thankyouurl" ); // exit ; ?>
  6. No it wouldn't be. That's the whole point. It is not a real directory. It can't be found. But I've found it.  When I searched for 'ext' instead of searching for 'mbstring' I got a better clue - 'search' told me it was inside a .zip file.  Actually a corrupt zip file that is supposed to be php516winzip but I can't use because it always reports 'unexpected end of file' when I try to install from it. That's how come the installation I've got doesn't include the ext directory.   But, surprisingly enough, I was able to extract the 'ext' directory from it.  Winzip did that for me without any problem. Then I put the mbstring.dll into php root dir and now everything's fine.  :)   Thanks for your input and have a good day...  regards, ab :)
  7. Ah... I would if I could... I didn't make it clear - the directory 'ext' not being a real directory I can't actually find the file. I don't know where it is. I don't know what it means that it is - that 'ext' is - 'an application extension'. Where do I find 'an application extension' ? How do I open it to get a .dll out? I should have said it that way the first time round. regards, dh and, p.s., I didn't specify anything in php.ini and the default seems to be '.\' or something.
  8. On my WinXP system running IIS and PHP and PHPAdmin and Mysql: I get a warning '...unable to load dynamic library php_mbstring.dll...' I find it with 'Search' and it shows it as being in the directory 'ext' - which apparently isn't a directory at all but signifies an 'application extension'. How do I help php out and give it access to this library? regards, ab :)
×
×
  • 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.