Jump to content

0tter

Members
  • Posts

    18
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

0tter's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Aha so it always occurring. I was wondering about that, the thing is having been away from PHP for years now this is all a new mystical art to me again. The problem I have getting my head around is that if I switch to 4 then there's no error reporting (as you kindly pointed out) then switch to 5.2 and hey presto there it is, but behold when I switch to 5.4 it disappears again, that's why all a bit confused. Thing is too, I copied a lot and I mean a lot of the code from a lofty book, to find out now that it's all flawed is quite an eye-opener to me. I have the book in storage somewhere and if I could find out what it was then it might be just a matter of finding the latest edition to find out what the code might be now - any suggestions on the back of a postcard please. I'm off to the beach with the little un today, I actually had a really bad nights sleep last night waking up thinking of coding, that's how much it's got to me. I really could do without the child minding but I've got to do it and the PHP 4 is switched off next week so I'm getting very uncomfortable with the whole situation. Thanks again for all your help. Cheers, Bill
  2. Thanks for the suggestion, I'll give that a go and see if it sheds any light on the solution. Thing is though that this all worked fine in PHP 4 and I've not changed a thing to stop it working in 5.2. Great suggestion though, I'll deffo give it a go. Cheers Bill
  3. Aha, I've managed to find some time to get this sorted and..... My host oneandone offers two flavours of PHP version 5 to upgrade to: 5.2 and 5.4. I had been working with 5.4 but I accidently flicked on 5.2 today and I found that I was actually getting some error messages for a change. Why I just do not know, but they've proved mega helpful so far, I was really operating in the dark without them. Anyway I've got through a bundle of errors and I'm a bit stuck on this one now: Warning: extract() [function.extract]: First argument should be an array in /homepages/11/d101038731/htdocs/website/phpscripts/terms_and_conditions_frameset.php on line 20 Line 20 being the last line of this code..... could it be the mysql_fetch_array($result); is the problem....? $query = "SELECT familyid, email FROM user WHERE username='$username'"; $result = mysql_query($query) or die ("Couldn't execute query."); $row = mysql_fetch_array($result); extract($row);
  4. Well I'm getting somewhere, the lost password function works but logging in only works the first time one tries to do it, the second login attempt will not let you login - darn it. I tried doing search and replaces on: Search Replace $HTTP_GET_VARS $_GET $HTTP_POST_VARS $_POST $HTTP_COOKIE_VARS $_COOKIE $HTTP_SESSION_VARS $_SESSION $HTTP_SERVER_VARS $_SERVER You reckon that's all of them, or might there be one or two that I'm missing. Do you think that a global search and replace was wise and am I likely to be opening a large can of squiggly worms. Thanks... apologies if you don't get a reply pronto but I'm on child minding duties for most of the weekend. Cheers, Bill
  5. Crikey all of those too. I'll have to get some coding done this weekend - if only I didn't have a three year old to look after on Saturday and Sunday. I'll see what I can get done tonight. Cheers, Bill
  6. Funnily enough this is what I tried first when I was trying to get the error reporting to work. It was completely fruitless and when your error reporting suggestion was posted then that's where I thought the solution would lie. Still onward and upward, it might be a bit of a job now but I'm one step further to getting it all sorted out. I'll carry on posting here with all you every so helpful folk and see if I can get it all worked out. Cheers you've been uber-helpful. Bill
  7. I was worried that it was going to be something like this. There's a lot of code on the site, do you reckon that there's going to be anymore like this? Surely looking at this it's just a search for $HTTP_POST_VARS and replace with $_POST I doubt it could be just that easy... Cheers, you've been a great help too.
  8. Well I tried it out: else if (mysql_num_rows($result)==0) { echo mysql_error(); die; // return false; // username not in db } else And it did well and truly stop at this point, so this seems to be the cause of concern, but beans were not spilled and it just came up with a blank. Actually I tried it in a few spots too - just in case - and added some other echo statements around it just to make sure it was getting to this point but it was all to no avail. I'm not having much luck today am I, I did however think that was a brilliant idea and we were getting closer to the solution but not being able to get an error is not much help. Any more suggestions would be very very welcome.
  9. Doing it now... Speak now or else it's the thumbscrews....
  10. I added it to the code as below, but it's not spilling the beans, am I doing something wrong with it? function notify_password($username, $password) // notify the user that their password has been changed { if (!($conn = db_connect())) echo mysql_error(); // return false; $result = mysql_query("select email from user where username='$username'"); if (!$result) { echo mysql_error(); // return false; // not changed } else if (mysql_num_rows($result)==0) { echo mysql_error(); // return false; // username not in db } else { $email = mysql_result($result, 0, 'email'); $from = "From: support@TheLitmusTest.com \r\n"; $mesg = "Your TheLitmusTest.com password has been changed to $password \r\n" ."Please change it next time you log in. \r\n"; if (mail($email, 'TheLitmusTest.com login information', $mesg, $from)) return true; else echo mysql_error(); return false; } }
  11. It's called from forgot_password.php This code is: <link href="../css/secure_page.css" rel="stylesheet" type="text/css"> <?php require_once("bookmark_fns.php"); do_html_header("Resetting password"); //creating short variable name $username = $HTTP_POST_VARS['username']; if ($password=reset_password($username)) { if (notify_password($username, $password)) { ?> Your password has been emailed to your email address. <br> We recommend you change it to something memorable as soon as you can. <br> <?php display_login_form(); do_html_footer(); } else { ?> Your password could not be emailed to you. <br> Try again later <br> <?php display_forgot_form(); do_html_footer(); } } else { ?> Your password could not be emailed to you. <br> Try again later <br> <?php display_forgot_form(); do_html_footer(); } // do_html_url('login.php', 'Login'); // do_html_footer(); ?>
  12. Aha, that sounds like good advice, I'll give that a go now. Cheers
  13. Hi there, I wondered if there was anyone out there who could help. I did some PHP coding some years ago for a site, the site is hosted on oneandone and a couple of months back we went through the traumatic exercise of updating the site to the version 5 MySQL and now I'm going through a similar exercise to upgrade from version 4 to version 5.4 PHP. Now I know I should have done this ages ago but it's not really my site and I've just accepted the onerous responsibility of doing this upgrade - despite forgetting just about everything I know about PHP. Hey I've got to that age now :-) Basically though switching over to PHP 5.4 on oneandone is a doddle but once you do this then no-one can log in. I'm trying to switch on error reporting but that's not being very successful, but I have found a chink of light in that once one requests a new password then it still does not work, but the reasoning for it not working - it seems to me - is that it's not finding the username in the user database. So either it's not passing the username or its somehow just not finding the username in the database. This is the questionable function code: function notify_password($username, $password) // notify the user that their password has been changed { if (!($conn = db_connect())) return false; $result = mysql_query("select email from user where username='$username'"); if (!$result) { return false; // not changed } else if (mysql_num_rows($result)==0) { return false; // username not in db } else { $email = mysql_result($result, 0, 'email'); $from = "From: test@test.com \r\n"; $mesg = "Your Test.com password has been changed to $password \r\n" ."Please change it next time you log in. \r\n"; if (mail($email, 'Test.com login information', $mesg, $from)) return true; else return false; } } I reckon it fails at the: $result = mysql_query("select email from user where username='$username'"); if (!$result) { return false; // not changed bit. I could be wrong but I changed the "return false" to "return true" for this bit and it seemed to make things better, well at least it thought it was working. Any help would be very much appreciated but please be gentle as I'm not really a PHP freak, I'm more a PHP twiddler. Cheers, Bill
  14. Brilliant, brilliant, brilliant..... Thanks Mac_Gyver that's fettled it..... I can now go back to a healthy existence and start seeing my daughter again. Waheeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee Bill
  15. Hang on I didn't see the first bit.... If I were to replace every instance of password(xxx) with old_password(xxx) then this might be goer??? I think I would have to be carefull about the ones I replaced but basically should this work. This sounds like a very quick and dirty solution should it be a goer. Hmmmm, I think I need to get to bed and give this a go in the morning. Cheers again
×
×
  • 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.