Changeset 164


Ignore:
Timestamp:
Sep 24, 2003, 9:30:24 PM (21 years ago)
Author:
z0rglub
Message:

The generation of mail address works back. Since the add of another form on
the same page, it didn't work, because, when adding a new user and no
errors, the $_POST was cleaned, but made no differences between the 2
forms...

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/user_list.php

    r98 r164  
    3030//------------------------------------------------------------------ add a user
    3131$errors = array();
    32 if ( isset( $_POST['submit'] ) )
     32if ( isset( $_POST['submit_add_user'] ) )
    3333{
    3434  $errors = register_user(
     
    4646  $vtp->closeSession( $sub, 'errors' );
    4747}
    48 else
     48else if ( isset( $_POST['submit_add_user'] ) )
    4949{
    5050  $_POST = array();
     
    221221  $vtp->closeSession( $sub, 'category' );
    222222  // mail management : creation of the mail address if asked by administrator
    223   if ( isset( $_GET['mail'] ) )
    224   {
    225     $mail_address = array();
    226     $i = 0;
     223  if ( isset( $_POST['submit_generate_mail'] ) and isset( $_GET['mail'] ) )
     224  {
     225    $mails = array();
    227226    $query = 'SELECT id,mail_address';
    228227    $query.= ' FROM '.PREFIX_TABLE.'users';
     
    231230    while ( $row = mysql_fetch_array( $result ) )
    232231    {
    233       $key = 'mail-'.$row['id'];
    234       if ( $_POST[$key] == 1 )
    235       {
    236         $mail_address[$i++] = $row['mail_address'];
    237       }
     232      if ( $_POST['mail-'.$row['id']] == 1 )
     233        array_push( $mails, $row['mail_address'] );
    238234    }
    239235    $mail_destination = '';
    240     for ( $i = 0; $i < sizeof( $mail_address ); $i++ )
    241     {
    242       $mail_destination.= $mail_address[$i];
    243       if ( sizeof( $mail_address ) > 1 )
    244       {
    245         $mail_destination.= ';';
    246       }
    247     }
    248     if ( sizeof( $mail_address ) > 0 )
     236    foreach ( $mails as $i => $mail_address ) {
     237      if ( $i > 0 ) $mail_destination.= ',';
     238      $mail_destination.= $mail_address;
     239    }
     240    if ( sizeof( $mails ) > 0 )
    249241    {
    250242      $vtp->addSession( $sub, 'mail_link' );
  • trunk/template/default/admin/user_list.vtp

    r101 r164  
    3232    {#login} : <input type="text" name="username" value="{#f_username}" />
    3333    {#password} : <input type="text" name="password" value="{#f_password}" />
    34     <input type="submit" value="{#add}" name="submit" />
     34    <input type="submit" value="{#add}" name="submit_add_user" />
    3535  </div>
    3636</form>
     
    3838
    3939<!--VTP_users-->
    40 <form method="post" action="{#form_action}" name="{#form_name}">
     40<form method="post" action="{#form_action}">
    4141<table width="100%">
    4242  <!--VTP_category-->
     
    9191      <input type="button" value="{#listuser_button_all}" onClick="SelectAll(this.form)" style="margin-left:5px;margin-right:5px;" />
    9292      <input type="button" value="{#listuser_button_invert}" onClick="Inverser(this.form)" style="margin-left:5px;margin-right:5px;" />
    93       <input type="submit" value="{#listuser_button_create_address}" style="margin-left:5px;margin-right:5px;" />
     93      <input type="submit" value="{#listuser_button_create_address}" name="submit_generate_mail" style="margin-left:5px;margin-right:5px;" />
    9494      <!--VTP_mail_link-->
    9595      <a href="mailto:{#mailto}">mailto:{#mail_address_start}...</a>
Note: See TracChangeset for help on using the changeset viewer.