Changeset 4304 for trunk/include


Ignore:
Timestamp:
Nov 18, 2009, 9:07:20 PM (14 years ago)
Author:
Eric
Message:

Escape all login and username characters in database
Display correctly usernames

(I hope not to have made mistakes)

Location:
trunk/include
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_comment.inc.php

    r3600 r4304  
    100100SELECT COUNT(*) AS user_exists
    101101  FROM '.USERS_TABLE.'
    102   WHERE '.$conf['user_fields']['username']." = '".$comm['author']."'";
     102  WHERE '.$conf['user_fields']['username']." = '".addslashes($comm['author'])."'";
    103103      $row = mysql_fetch_assoc( pwg_query( $query ) );
    104104      if ( $row['user_exists'] == 1 )
  • trunk/include/functions_mail.inc.php

    r4265 r4304  
    365365    $keyargs_content_admin_info = array
    366366    (
    367       get_l10n_args('Connected user: %s', $user['username']),
     367      get_l10n_args('Connected user: %s', stripslashes($user['username'])),
    368368      get_l10n_args('IP: %s', $_SERVER['REMOTE_ADDR']),
    369369      get_l10n_args('Browser: %s', $_SERVER['HTTP_USER_AGENT'])
     
    484484          if (!empty($row['mail_address']))
    485485          {
    486             array_push($Bcc, format_email($row['username'], $row['mail_address']));
     486            array_push($Bcc, format_email(stripslashes($row['username']), $row['mail_address']));
    487487          }
    488488        }
     
    795795    if ( mkgetdir( $dir,  MKGETDIR_DEFAULT&~MKGETDIR_DIE_ON_ERROR) )
    796796    {
    797       $filename = $dir.'/mail.'.$user['username'].'.'.$lang_info['code'].'.'.$args['template'].'.'.$args['theme'];
     797      $filename = $dir.'/mail.'.stripslashes($user['username']).'.'.$lang_info['code'].'.'.$args['template'].'.'.$args['theme'];
    798798      if ($args['content_format'] == 'text/plain')
    799799      {
  • trunk/include/functions_user.inc.php

    r4265 r4304  
    171171      $keyargs_content = array
    172172      (
    173         get_l10n_args('User: %s', $login),
     173        get_l10n_args('User: %s', stripslashes($login)),
    174174        get_l10n_args('Email: %s', $_POST['mail_address']),
    175175        get_l10n_args('', ''),
     
    179179      pwg_mail_notification_admins
    180180      (
    181         get_l10n_args('Registration of %s', $login),
     181        get_l10n_args('Registration of %s', stripslashes($login)),
    182182        $keyargs_content
    183183      );
     
    934934  {
    935935    $row = mysql_fetch_assoc($result);
    936     $username = $row['username'];
    937     $data = $time.$row['username'].$row['password'];
     936    $username = stripslashes($row['username']);
     937    $data = $time.stripslashes($row['username']).$row['password'];
    938938    $key = base64_encode(
    939939      pack('H*', sha1($data))
     
    10191019      {
    10201020        log_user($cookie[0], true);
    1021         trigger_action('login_success', $username);
     1021        trigger_action('login_success', stripslashes($username));
    10221022        return true;
    10231023      }
     
    10401040       '.$conf['user_fields']['password'].' AS password
    10411041  FROM '.USERS_TABLE.'
    1042   WHERE '.$conf['user_fields']['username'].' = \''.$username.'\'
     1042  WHERE '.$conf['user_fields']['username'].' = \''.mysql_real_escape_string($username).'\'
    10431043;';
    10441044  $row = mysql_fetch_assoc(pwg_query($query));
     
    10461046  {
    10471047    log_user($row['id'], $remember_me);
    1048     trigger_action('login_success', $username);
     1048    trigger_action('login_success', stripslashes($username));
    10491049    return true;
    10501050  }
    1051   trigger_action('login_failure', $username);
     1051  trigger_action('login_failure', stripslashes($username));
    10521052  return false;
    10531053}
  • trunk/include/menubar.inc.php

    r3282 r4304  
    282282  else
    283283  {
    284     $template->assign('USERNAME', $user['username']);
     284    $template->assign('USERNAME', stripslashes($user['username']));
    285285    if (is_autorize_status(ACCESS_CLASSIC))
    286286    {
  • trunk/include/picture_comment.inc.php

    r4265 r4304  
    4747
    4848  $comm = array(
    49     'author' => trim(@$_POST['author']),
    50     'content' => trim($_POST['content']),
     49    'author' => trim( stripslashes(@$_POST['author']) ),
     50    'content' => trim( stripslashes($_POST['content']) ),
    5151    'image_id' => $page['image_id'],
    5252   );
     
    153153      else
    154154      {
    155         $author = $row['username'];
     155        $author = stripslashes($row['username']);
    156156      }
    157157
  • trunk/include/ws_functions.inc.php

    r3720 r4304  
    524524
    525525  $comm = array(
    526     'author' => trim($params['author']),
    527     'content' => trim($params['content']),
     526    'author' => trim( stripslashes($params['author']) ),
     527    'content' => trim( stripslashes($params['content']) ),
    528528    'image_id' => $params['image_id'],
    529529   );
     
    701701      )
    702702  {
    703     $comment_post_data['author'] = $user['username'];
     703    $comment_post_data['author'] = stripslashes($user['username']);
    704704    $comment_post_data['key'] = get_comment_post_key($params['image_id']);
    705705  }
     
    12551255  global $user;
    12561256  $res = array();
    1257   $res['username'] = is_a_guest() ? 'guest' : $user['username'];
     1257  $res['username'] = is_a_guest() ? 'guest' : stripslashes($user['username']);
    12581258  foreach ( array('status', 'template', 'theme', 'language') as $k )
    12591259  {
Note: See TracChangeset for help on using the changeset viewer.