cartpauj Posted November 3, 2007 Share Posted November 3, 2007 This script is working fine except the part highlighted in green. I tried to register a name that already existed and it skipped the part in green alltogether and tried to create the user anyways. Did I do something wrong in the code? while (!feof ($f)) { $line = fgets ($f, 1024); if (ereg ("already exists", $line, $out)) { $msg = "<h2><font color='red'>{$euser} already exists.</font></h2><br /><a href='http://paradiseut.com/wp-login.php?action=register'>TRY ANOTHER USERNAME</a>"; fclose($f); //echo $msg; exit($msg); } else { require_once( ABSPATH . WPINC . '/registration.php'); $user_id = wp_create_user( $euser, $epass, $eemail ); if ( !$user_id ) { $msg = "Registration Failed. Please <a href='http://paradiseut.com/wp-login.php?action=register'>TRY AGAIN</a>. If the problem persists please <a href='http://paradiseut.com/?p=25'>CONTACT US</a>."; break; } else { wp_new_user_notification($user_id, $epass); break; } } fclose($f); } Quote Link to comment Share on other sites More sharing options...
Azu Posted November 6, 2007 Share Posted November 6, 2007 I don't think the problem is with the part in green. I think the problem is with this; while (!feof ($f)) { $line = fgets ($f, 1024); if (ereg ("already exists", $line, $out)) { You might want to make absolutely sure that it is properly searching for the actual user name and that it doesn't return false negatives. Quote Link to comment Share on other sites More sharing options...
cartpauj Posted November 6, 2007 Author Share Posted November 6, 2007 Thanks for the help I figured it out. I had the user create code inside the while loop so unless the first name it checked happened to be the same the current user was trying to use then the creation code got executed anyways. I just had to move the part below the green out of the while loop. Thanks for the help though Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.