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
https://forums.phpfreaks.com/topic/75942-solved-the-part-in-green-isnt-working/
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.

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.