Page 1 of 1

Warning: Undefined variable: action in

Posted: Sun May 25, 2003 2:11 am
by metalhardscripts
Need some help with this tryed a few things and cant get it fixed maybe someone can help me with this heres the code error is on line 4 Warning: Undefined variable: action in D:\Webserver\www.everything.32k.org\topsite\sendpass.php on line 4
here it is

Code: Select all

<?php
include("design.php");
design_topp();
IF($action == "") &#123; 
print $lang&#1111;'forgot_pass'];
?>
<br>
<form name="form1" method="post" action="sendpass.php?action=send">
  <input type="text" name="email">
  <input type="submit" name="Submit" value="<?=$lang&#1111;'recive_pass']?>">
</form>
<?php
&#125;
elseif($action == "send") &#123;
$sql = "SELECT * FROM sites WHERE mail = '$email'";
$res = mysql_query($sql);
IF(mysql_num_rows($res) > 0) &#123;
$out = mysql_fetch_array($res);
mail($out&#1111;'mail'], $conf&#1111;'title'], $lang&#1111;'your_pass'] . " "" . $out&#1111;'pass'] . ""\n\n" . $conf&#1111;'title'], "From: " . $conf&#1111;'mail']);
print $lang&#1111;'pass_sent']; &#125;
elseIF(mysql_num_rows($res) < 1) &#123; print $lang&#1111;'no_mail']; &#125;
&#125;
design_bunn();
?>
there it is please helpppppppppp

Posted: Sun May 25, 2003 3:00 am
by Sevengraff
im guessing $action was suppost to be defined in the URL?
put this before line 4:

Code: Select all

if(isset($_GET['action']) {
   $action = $_GET['action'];
} else {
   $action = 'default action value';
}

even more errors

Posted: Mon May 26, 2003 1:34 am
by metalhardscripts
nope that didnt work at all just made so many errors it was unreal canstill need help with this tho if you want to see this script error right now the codes at top and heres the page running the script http://www.everything.32k.org/topsite/sendpass.php

Posted: Mon May 26, 2003 3:44 am
by volka
which version of php do you use and what is register_globals set to?

Code: Select all

<?php phpinfo(); ?>
will tell you.

php is

Posted: Mon May 26, 2003 12:56 pm
by metalhardscripts
php is 4.1.1 and the register_globals on-on and i only have space on this server so i dont control any of these setting my webserver host does

Posted: Mon May 26, 2003 2:25 pm
by volka
then maybe it's simply
IF($action == "") {
you're trying to (read-)access a variable that might not exist, try

Code: Select all

if(empty($action)) {
or if $action might contain the (valid) value 0

Code: Select all

if (!isset($action) || $action=="") {