php on windows
Moderator: General Moderators
php on windows
i've got php installed (with apache 2.0.39) and it's working (supposedly) because when i make a php page with phpinfo(); in it, i get all the good stuff you're supposed to see. the problem is that i wrote a script and tested on my webhost server (running linux) and the scripts works "perfectly" but when trying to run it on my system, it doesn't do anything it's supposed to do. all running the same versions of php (different apache versions though...would that have to do with it?). i just don't see why it'll work one place and not another.... (actually tried it on two different windows machines and it doesn't work on either but works fine on the linux server...) any suggestions?
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
What is the script supposed to do? What is the script? Is the PHP configuration exactly the same on all the machines? Does the script use proprietary *nix commands - ie. commands that the manual says work on *nix but not on Windows?
Nobody can really offer any useful suggestions without a lot more information...
Mac
Nobody can really offer any useful suggestions without a lot more information...
Mac
the script basically takes a file and does a search and emails the results. no special commands....hmm code maybe?...
basically what it's doing on the windows machines is displaying the form and then you enter the info (name) and it goes back to the form....as if the switch isn't doing anything. (sorry if my code is junky). and yes the config is the same.
Code: Select all
<?php
// lost_pass.php
// retrieve lost passwords from gm.
if(!isset($action))
$action = "first";
// function that sends the email.
function find_name($value, $key, $username)
{
// your email.
$admin_email = "joe@bob.com";
// get the stuff from that lines of gm-authors.cgi.
$line = explode("|", $value);
// if it finds the username, send the mail.
if(strstr($lineї0], $username))
{
// sending the mail out.
$sent = mail("$lineї2]", "lost password", "you requested your password from http://yoursite.com\n\nusername: $lineї0]\npassword: $lineї1]\n\n", "from: $admin_email");
if($sent)
{
echo "mail has been sent. <a href="http://yoursite.com">back to the site</a>";
}
}
}
// function that passes info the function above.
function get_pass($username)
{
// location of the gm-authors file.
$author_path = "./cgi-bin/gm-authors.cgi";
// read the file and put the info in an array.
$author_file = file($author_path);
// how many authors?
$number = count($author_file);
// see if user is in the file.
$not_found = 0;
for($i=0; $i<$number; $i++)
{
if(!(strstr($author_fileї$i], $username)))
{
$not_found++;
}
}
// if author is not found, stop the script and say so.
if($not_found == $number) die("not found");
// if the author was found, go through the array and send mail.
array_walk($author_file, 'find_name', $username);
}
// get the username from the user.
function form()
{
?>
<html>
<head>
<title>get password</title>
</head>
<body>
<form action="<?php echo "$PHP_SELF?action=retrieve"; ?>" method="post">
name: <input type="text" name="username"><br>
<input type="submit" name="button" value="get it">
</form>
</body>
</html>
<?php
}
// decisions, decisions
switch ($action)
{
case "retrieve":
get_pass($username);
break;
case "first":
form();
break;
}- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
- RandomEngy
- Forum Contributor
- Posts: 173
- Joined: Wed Jun 26, 2002 3:24 pm
- Contact: