/[health_html]/inc/pgRegistracija.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /inc/pgRegistracija.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by ravilov, Tue Sep 25 15:38:04 2001 UTC revision 1.2 by ravilov, Wed Sep 26 13:04:28 2001 UTC
# Line 76  Line 76 
76                  if (!$zanimanje) $error |= 16;                  if (!$zanimanje) $error |= 16;
77                  if (!$nesto && !$spec_0) $error |= 32;                  if (!$nesto && !$spec_0) $error |= 32;
78                  if ($error == 0) {                  if ($error == 0) {
79                          $ime2 = my_quote($ime, true, false);                          $username = GenerateUsername($ime, $prezime);
80                          $ime2 = strtolower(ereg_replace('[^A-Za-z0-9]', "", $ime2));                          $password = GeneratePassword();
                         $prezime2 = my_quote($prezime, true, false);  
                         $prezime2 = strtolower(ereg_replace('[^A-Za-z0-9]', "", $prezime2));  
                         $cnt = 1;  
                         while ($cnt <= strlen($ime2)) {  
                                 $username = substr($ime2, 0, $cnt++).$prezime2;  
                                 $sql = "SELECT username FROM users WHERE username = '$username'";  
                                 $sth = $dbh->prepare($sql);  
                                 if (!$sth) error("Cannot prepare query: \"$sql\"");  
                                 if (!$sth->execute()) error("Cannot execute query: \"$sql\"");  
                                 $row = $sth->fetchrow_array();  
                                 $sth->finish();  
                                 if (!$row) break;  
                         }  
                         if ($cnt > strlen($ime2)) {  
                                 $username2 = $username;  
                                 $cnt = 1;  
                                 while (true) {  
                                         $username = $username2.($cnt++);  
                                         $sql = "SELECT username FROM users WHERE username = '$username'";  
                                         $sth = $dbh->prepare($sql);  
                                         if (!$sth) error("Cannot prepare query: \"$sql\"");  
                                         if (!$sth->execute()) error("Cannot execute query: \"$sql\"");  
                                         $row = $sth->fetchrow_array();  
                                         $sth->finish();  
                                         if (!$row) break;  
                                 }  
                         }  
                         $chars = preg_split('//', "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");  
                         array_shift($chars);  
                         array_pop($chars);  
                         $password = "";  
                         for ($i = 0; $i < 8; $i++) $password .= $chars[rand(0, count($chars))];  
81                          $titula = $titula ? my_quote($titula) : "NULL";                          $titula = $titula ? my_quote($titula) : "NULL";
82                          $ime = $ime ? my_quote($ime) : "NULL";                          $ime = $ime ? my_quote($ime) : "NULL";
83                          $prezime = $prezime ? my_quote($prezime) : "NULL";                          $prezime = $prezime ? my_quote($prezime) : "NULL";
# Line 132  Line 100 
100                                  $sql = "INSERT INTO user_spec (user_id, spec_id) VALUES ($row, ".$specs[$i]["id"].")";                                  $sql = "INSERT INTO user_spec (user_id, spec_id) VALUES ($row, ".$specs[$i]["id"].")";
101                                  $dbh->dbh_do($sql);                                  $dbh->dbh_do($sql);
102                          }                          }
103                          $mail = "\nKorisničko ime: $username\nLozinka: $password\n\nhttp://dpavlinusic1.pliva.hr/ph/thefilez/med/?section=login&username=$username\n";                          $mail = "\nKorisničko ime: $username\nLozinka: $password\n\nhttp://dpavlinusic1.pliva.hr/ph/thefilez/med/?section=prijava&username=$username\n";
104  echo "[$email] [$mail]<BR>\n";  #echo "[$email] [$mail]<BR>\n";
105                          $ret = mail($email, "PLIVAmed.net - Registracija", "\nKorisničko ime: $username\nLozinka: $password\n\nhttp://dpavlinusic1.pliva.hr/ph/thefilez/med/?section=login&username=$username\n", "From: registracija@plivamed.net");                          $ret = mail($email, "PLIVAmed.net - Registracija", $mail, "From: registracija@plivamed.net");
106                  }                  }
107                  $tpl->assign("emailok", $emailok);                  $tpl->assign("emailok", $emailok);
108                  $tpl->assign("godrodok", $godrodok);                  $tpl->assign("godrodok", $godrodok);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.26