Jump to content

[SOLVED] the part in green isn't working


cartpauj

Recommended Posts

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);

  }

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.