Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

check username script.... times 2

Guest
Aug 10, 2010 Aug 10, 2010

the check username script is a nice solution to check to make sure a record doesn't already exist... however... i need to check against two items and this wasn't designed to work this way.  whats the best way to do this?

TOPICS
Server side applications
436
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 11, 2010 Aug 11, 2010
LATEST

php/mysql

i prefer non theoretical answers.

here is the block of code that dreamweaver has entered for over 5 years now to "check username"

// *** Redirect if username exists

$MM_flag="MM_insert";

if (isset($_POST[$MM_flag])) {

  $MM_dupKeyRedirect="redirecturl.php";

  $loginUsername = $_POST['username'];

  $LoginRS__query = sprintf("SELECT username FROM database WHERE username=%s", GetSQLValueString($loginUsername, "text"));

  mysql_select_db($database_123, $123);

  $LoginRS=mysql_query($LoginRS__query, $123) or die(mysql_error());

  $loginFoundUser = mysql_num_rows($LoginRS);

  //if there is a row in the database, the username was found - can not add the requested username

  if($loginFoundUser){

    $MM_qsChar = "?";

    //append the username to the redirect page

    if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";

    $MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;

    header ("Location: $MM_dupKeyRedirect");

    exit;

  }

}

converting that to check multiple items.

and if this block of default code is garbage, a better suited way to do this.  each item needs to have it's own check, and own trigger, and own resulting error message for users identified, preferably without using a url redirect to avoid the use of url parameters if possible.  thanks in advance.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines