Example #1
0
void addnewuser(formfield *fields, int count)
{
  formfield *name, *passwd1, *passwd2, *dispname, *ref, *email;

  name=findfield("name",fields,count);
  passwd1=findfield("passwd1",fields,count);
  passwd2=findfield("passwd2",fields,count);
  dispname=findfield("dispname",fields,count);
  email=findfield("email",fields,count);
  ref=findfield("ref",fields,count);

  if((name==NULL) || (passwd1==NULL) || (passwd2==NULL) ||
     (dispname==NULL) || (email==NULL) || (ref==NULL)) {
    printf("wrong format\n");
    return;
  }

  if(userexist(name->data) || tempuserexist(name->data)) {
    printf("the username was taken. . . please try again\n");
    return;
  }

  if(verifyinfo(name->data, passwd1->data, passwd2->data, dispname->data, 
                email->data, ref->data)) {
    filterstring(ref->data);
    addtempuserinfo(name->data, passwd1->data, dispname->data, "", 
                    email->data, ref->data);
    printf("your account information has been received.  you will get an email after it is activated, so please wait.  this process should take a while.  so if you want a faster activation, do not be afraid to send us an e-mail.  <a href=\"index.html\">[return to webboard]</a>\n");
  }
}
Example #2
0
void add_user(socmed &s, adruser userbaru){
    if (userexist(s,userbaru->username)){               //cek jika user sudah ada
        cout << "User sudah ada!";
    }
    else {
        if (s.first==NULL){                             //jika list user masih kosong
            s.first = userbaru;
        }
        else {
            userbaru->next = s.first;
            s.first = userbaru;
        }
    }
};
Example #3
0
void addchild(formfield *fields, int count)
{
  formfield *pname, *ppasswd, *name, *passwd1, *passwd2, 
            *dispname, *email, *ref;
  char pdispname[30];
  char pimgfile[30];
  char sref[100];

  pname=findfield("pname",fields,count);
  ppasswd=findfield("ppasswd",fields,count);
  name=findfield("name",fields,count);
  passwd1=findfield("passwd1",fields,count);
  passwd2=findfield("passwd2",fields,count);
  dispname=findfield("dispname",fields,count);
  email=findfield("email",fields,count);
  ref=findfield("ref",fields,count);

  if((pname==NULL) || (ppasswd==NULL) ||
     (name==NULL) || (passwd1==NULL) || (passwd2==NULL) ||
     (dispname==NULL) || (email==NULL) || (ref==NULL)) {
    printf("wrong format\n");
    return;
  }

  if(!getuserinfo(pname->data, ppasswd->data, pdispname, pimgfile)) {
    printf("invalid parent account. . . (check username and password)\n");
    return;
  }

  if(userexist(name->data)) {
    printf("the username was taken. . . please try again\n");
    return;
  }

  if(verifyinfo(name->data, passwd1->data, passwd2->data, 
                dispname->data, email->data, pname->data)) {
    sprintf(sref,"%s(invt=%s)",ref->data,pname->data);
    adduserinfo(name->data, passwd1->data, dispname->data, "", email->data, sref);
    printf("your account has been added to the system under the invitation of %s.  it is activated and you can use it now. <a href=\"index.html\">[return to webboard]</a>\n", pdispname);
  }
}