Jump to content

Recommended Posts

the strange thing is...I have the exact same script on another part of my page and it works! the only thing that changed are the variable names and the path (which ive checked 27000 times) What this should do is check if you have a signature in the external file and if you do and you fill out the form correctly then it replaces your old signature with your new one. and if you dont have a signature already and filled out the form correctly then it should write your signature to the file...for some reason this isnt working after checking and rechecking...i need a second pair of eyes. Help please!

 

if (isset($_POST['change_submit2'])) {

if (($_SESSION['logged_in'] == '1')  && ($signature_test != '1') && ($_POST['change_box2'] == 'CHANGE') && ($invalid_character_test != '1') && ($invalid_character_test1 != '1')) {

$fh1 = fopen($users_signatures_path, 'r+');

fwrite($fh1, $sig_front);

frwrite($fh1, $_POST['signature']);

fwrite($fh1, $sig_back);

fwrite($fh1, '  ');

flose($fh1);

echo 'You have succesfully created a signature!';

} elseif (($_SESSION['logged_in'] == '1') && ($signature_test == '1') && ($_POST['change_box2'] == 'CHANGE') && ($invalid_character_test != '1') && ($invalid_character_test1 != '1')) {

$users_signatures_path1 = "../../users/users_signatures.txt";

$fh1 = fopen($users_signatures_path1, 'r+');

$read_fh1 = fread($_fh1, filesize($users_signatures_path1));

$the_new_sig = str_replace($mcurrent_sig, $mnew_sig, $read_fh1);

fclose($fh1);

$fh1 = fopen($users_signatures_path1, 'r+');

fwrite($fh1, $the_new_sig);

fclose($fh1);

echo $mnew_sig;

echo 'Your signature has been succesfully changed!';

} elseif ($_SESSION['logged_in'] != '1') {

echo 'You need to be logged in!';

} elseif ($_POST['change_box2'] != 'CHANGE') {

echo 'You must fill in the "CHANGE" box!';

} elseif ($invalid_character_test == '1') {

echo 'Contains illegal characters!';

} elseif ($invalid_character_test1 == '1') {

echo 'Contains illegal characters!';

}

}

Hey AyKay47 what do you mean by debuging it.

 

do you mean by using this

 

ini_set("display_errors", "1");error_reporting(-1);

 

I just used this just now for the first time. so not sure what all it really displays, but im assuming it displays any errors and even if you start a variable out with _

 

how does everyone handle this. Should i just keep this on every page so its always active? Is that what most people do?

Hey AyKay47 what do you mean by debuging it.

 

do you mean by using this

 

ini_set("display_errors", "1");error_reporting(-1);

 

I just used this just now for the first time. so not sure what all it really displays, but im assuming it displays any errors and even if you start a variable out with _

 

Starting a variable with _ is completely valid. The only reason it didn't work in this case is because he set the handle to $fh1, and instead used $_fh1.

Scootstah is the normal thing to do is to attached the following to a page that is required on all my pages?

cause i just attached this to my page that connects me to my database and i got hit with 3 Notices.

 

 

 

ini_set("display_errors", "1");error_reporting(-1);

@Shadowing,

 

You should have error_reporting set to E_ALL (or even better a -1) and display_errors set to ON in your master php.ini on your development system, so that you don't need to remember to put anything into your files or remember to remove it later. Also, by putting these setting into your master php.ini, fatal parse errors in your main file will also be reported and displayed. Putting those settings in your main file won't show fatal parse errors (in your main file, but do show them for any included file) because your code never runs when there is a parse error, so that settings due to lines of code never take effect.

yah i do have errors set to on

but they apparently didnt make me aware of undefined index's.

 

Notice: Undefined index: offense_level_points in C:\Software\XAMPP\xampp\htdocs\stargate\Users\battle.php on line 34

 

thats going to help me find errors much easier and makes things faster when there is a problem.

 

i think i have mine set to E_ALL atm going to go check. if so wonder why it wasnt showing me these undefined index errors

 

You should probably start your own thread for your series of questions.

 

The problem causing each error message you are getting should be fixed so that you only get errors from actual problems so that you can find and fix real problems in your code. The reporting and display/logging of the error message is only the last step in the error response code that php executes EVERY time it detects an error on a page, every time that page gets requested.

I think im good now.

I understand it shows a entire list of differant things i can set error reporting too.

I currently have it set to E_ALL & ~E_NOTICE. i dont see anything in the constants talking about -1 though.

 

but now i know why it wasnt showing me notices cause E notice means it doesnt show notices lol :)

 

thanks guys

Hey AyKay47 what do you mean by debuging it.

 

do you mean by using this

 

ini_set("display_errors", "1");error_reporting(-1);

 

I just used this just now for the first time. so not sure what all it really displays, but im assuming it displays any errors and even if you start a variable out with _

 

how does everyone handle this. Should i just keep this on every page so its always active? Is that what most people do?

 

yes, follow what PFM said. In this case, if the OP had the error settings correct, he should have received an "undefined variable" error and an invalid handle error.

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.