Results 1 to 9 of 9
The following is a function that doesn't seem to work but it looks like it should. Unfortunetly XAMPP complains.
Code:
function write_information($personnel)
{
$integer = 0;$contiguous = $personnel;$metamorph = NULL;
...
- 06-19-2011 #1
why doesn't this function work
The following is a function that doesn't seem to work but it looks like it should. Unfortunetly XAMPP complains.
I get these errorsCode:function write_information($personnel) { $integer = 0;$contiguous = $personnel;$metamorph = NULL; for($integer == 0; $contiguous[$integer] != NULL; $integer++) { if(is_int($contiguous[$integer]) == FALSE) { $metamorph = $contiguous[$integer]; } else { $metamorph = $contiguous[$integer]; } } fputs($handle, $personnel."\n"); } if($_POST["password"]){write_information($_POST["password"]);}
Code:Notice: Uninitialized string offset: 9 in C:\Documents and Settings\iceweasel\Desktop\XAMPP\relik.ath.cx\login\create+account.php on line 60 Notice: Undefined variable: handle in C:\Documents and Settings\iceweasel\Desktop\XAMPP\relik.ath.cx\login\create+account.php on line 71 Warning: fputs() expects parameter 1 to be resource, null given in C:\Documents and Settings\iceweasel\Desktop\XAMPP\relik.ath.cx\login\create+account.php on line 71
- 06-19-2011 #2
The thing that is is stopping it working is that you haven't opened a file to write to and therefore the file handle ($handle) is null. Although I'm not sure what the aim of the function is, at one point you seem to be saying
You could also change your for loop fromCode:if(is_int($contiguous[$integer]) == FALSE) // If this is true then { $metamorph = $contiguous[$integer]; // do this } else // otherwise { $metamorph = $contiguous[$integer]; // do exactly the same thing and then completely ignore the result }toCode:for($integer == 0; $contiguous[$integer] != NULL; $integer++)
. The bolded bit in the original code is testing for equality rather than assigning.Code:for($integer = 0; $integer < count($contiguous); $integer++)
In fact, unless that's just a snippet, you could lose the entire for loop and get the same effect.If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)
My new blog. It's probably not as good as I think it is.
- 06-19-2011 #3
That was just a section of the code
That was just a section of the code, the handle is defined and works great for every other part of the code inside the same if statement as that is. That's the reason i'm asking what the problem is. Also I haven't finished the function that's why it does the same thing in both statements. I plan to make that function encrypt the password. Also I want to ask will that for loop of mine give me any other characters other then the password. I seem to be using it until it is NULL but I only want to use the loop for changing the password characters not any other characters like end of line. Lastly I have one more question and that is if you new of any functions that would help me encrypt passwords not excluding common functions.
Code:if (!$handle = fopen("database/".$_POST["username"], "w+"))
- 06-19-2011 #4
Heres the new errors after fixing it
Here are the new errors after fixing what you pointed out.
Code:Notice: Uninitialized string offset: 9 in C:\Documents and Settings\iceweasel\Desktop\XAMPP\relik.ath.cx\login register.php on line 60 Notice: Undefined variable: handle in C:\Documents and Settings\iceweasel\Desktop\XAMPP\relik.ath.cx\login \register.php on line 71 Warning: fputs() expects parameter 1 to be resource, null given in C:\Documents and Settings\iceweasel\Desktop \XAMPP\relik.ath.cx\login\register.php on line 71
- 06-19-2011 #5
Ok I just added a handle variable to the function and now it writes with the function but I still have one last problem and that is the offset error message above. I think it's talking about the NULL variable I used which isn't defined but I have no substitute for.
here's the line,
here's the error again,Code:for($integer = 0; $contiguous[$integer] != NULL; $integer++)
The weird thing is I used the variable NULL one line above it with no problems.Code:Notice: Uninitialized string offset: 9 in C:\Documents and Settings\iceweasel\Desktop\XAMPP\relik.ath.cx\login register.php on line 60
- 06-19-2011 #6
Heres the line right before that line.
$integer = 0;$contiguous = $personnel;$metamorph = NULL;
You can see what I mean by it not being bothered by my first
decleration using NULL
- 06-19-2011 #7
You can find the answer to that here
If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)
My new blog. It's probably not as good as I think it is.
- 06-19-2011 #8
- 06-20-2011 #9
To a particular post on this page. Read it carefully.


1Likes
Reply With Quote
