Mehrere input felder

cäpten

Grünschnabel
Hallo leute auf meiner seite kann man gerade nur eine seite eintragen,ich will aber mehrere eintragen können.Ich habe en screen gemacht schauts euch bitte an.Ich habe einiges ausprobiert aber ohne erfolg.

screenqx5.jpg


hier sind die dateien.
1.join.php

PHP:
<?php

class join extends join_edit {
  function join() {
    global $FORM, $LNG, $TMPL;

    $TMPL['header'] = $LNG['join_header'];

    $TMPL['error_username'] = '';
    $TMPL['error_style_username'] = '';
    $TMPL['error_password'] = '';
    $TMPL['error_style_password'] = '';
    $TMPL['error_url'] = '';
    $TMPL['error_style_url'] = '';
    $TMPL['error_email'] = '';
    $TMPL['error_style_email'] = '';
    $TMPL['error_title'] = '';
    $TMPL['error_style_title'] = '';
    $TMPL['error_banner_url'] = '';
    $TMPL['error_style_banner_url'] = '';
    $TMPL['error_top'] = '';
    $TMPL['error_style_top'] = '';
    $TMPL['error_captcha'] = '';
    $TMPL['error_style_captcha'] = '';
    $TMPL['error_question'] = '';
    $TMPL['error_style_question'] = '';

    if (!isset($FORM['submit'])) {
      $this->form();
    }
    else {
      $this->process();
    }
  }

  function form() {
    global $CONF, $FORM, $LNG, $TMPL;

    // Display the CAPTCHA?
    if ($CONF['captcha']) {
      $TMPL['rand'] = rand(1, 1000000);
      $TMPL['join_captcha'] = $this->do_skin('join_captcha');
    }
    else {
      $TMPL['join_captcha'] = '';
    }

    // Display the security question?
    if ($CONF['security_question'] && $CONF
['security_answer']) {
      $TMPL['security_question'] = $CONF
['security_question'];
      if (isset($FORM['security_answer'])) 
{ $TMPL['security_answer'] = 
strip_tags($FORM['security_answer']); }
      else { $TMPL['security_answer'] = ''; }

      $TMPL['join_question'] = $this->do_skin('join_question');
    }
    else {
      $TMPL['join_question'] = '';
    }

    $TMPL['categories_menu'] = "
<select name=\"category\">\n";
    foreach ($CONF['categories'] as $cat => $skin) {
      if (isset($TMPL['category']) && $TMPL['category'] 
== $cat) {
        $TMPL['categories_menu'] .= 
"<option value=\"{$cat}\" selected=
\"selected\">{$cat}
</option>\n";
      }
      else {
        $TMPL['categories_menu'] .= "<option value=\"{$cat}\">{$cat}</option>\n";
      }
    }
    $TMPL['categories_menu'] .= "</select>";

    if ($CONF['max_banner_width'] && $CONF
['max_banner_height']) {
      $TMPL['join_banner_size'] = 
sprintf($LNG['join_banner_size'], 
$CONF['max_banner_width'], $CONF['max_banner_height']);
    }
    else {
      $TMPL['join_banner_size'] = '';
    }

    if (!isset($TMPL['username'])) { $TMPL['username'] = ''; }
    if (!isset($TMPL['url'])) { $TMPL['url'] = 'http://'; }
    if (!isset($TMPL['title'])) { $TMPL['title'] = ''; }
    if (!isset($TMPL['description'])) { $TMPL['description'] = ''; }
    if (!isset($TMPL['banner_url'])) { $TMPL['banner_url'] = '
<a href="http://" target="_blank">http://</a>'; }
    if (!isset($TMPL['email'])) { $TMPL['email'] = ''; }

    if (isset($TMPL['url'])) { $TMPL['url'] = 
stripslashes($TMPL['url']); }
    if (isset($TMPL['title'])) { $TMPL['title'] = stripslashes($TMPL['title']); }
    if (isset($TMPL['description']))
 { $TMPL['description'] = 
stripslashes($TMPL['description']); }
    if (isset($TMPL['category'])) { $TMPL['category'] = stripslashes($TMPL['category']); }
    if (isset($TMPL['banner_url'])) { $TMPL['banner_url'] = stripslashes($TMPL['banner_url']); }
    if (isset($TMPL['email'])) { $TMPL['email'] = stripslashes($TMPL['email']); }

    $TMPL['content'] = $this->do_skin('join_form');
  }

  function process() {
    global $CONF, $DB, $FORM, $LNG, $TMPL;

    $TMPL['username'] = $DB->escape($FORM['u'], 1);
    $TMPL['url'] = $DB->escape($FORM['url'], 1);
    $TMPL['title'] = $DB->escape($FORM['title'], 1);
    $FORM['description'] = str_replace
(array("\r\n", "\n", "\r"), ' ', $FORM['description']);
    $TMPL['description'] = 
$DB->escape($FORM['description'], 1);
    $TMPL['category'] = 
$DB->escape($FORM['category'], 1);
    $TMPL['banner_url'] = 
$DB->escape($FORM['banner_url'], 1);
    $TMPL['email'] = $DB->escape($FORM['email'], 1);

    $TMPL['title'] = $this->
bad_words($TMPL['title']);
    $TMPL['description'] = 
$this->bad_words($TMPL['description']);

    if ($this->check_ban('join')) {
      if ($this->check_input('join')) {
        $password = md5($FORM['password']);

        require_once("{$CONF['path']}/inc/in.php");
        $short_url = in::short_url($TMPL['url']);

        $join_date = date('Y-m-d', time() + (3600*$CONF['time_offset']));

        $user_ip = $DB->escape
($_SERVER['REMOTE_ADDR'], 1);

        $DB->query("INSERT INTO
 {$CONF['sql_prefix']}_sites (username, 
password, url, short_url, title, description, 
category, banner_url, email, join_date, active, 
openid, user_ip)
                  VALUES ('{$TMPL['username']}', 
'{$password}', '{$TMPL['url']}', '{$short_url}', 
'{$TMPL['title']}', '{$TMPL['description']}', 
'{$TMPL['category']}', 

'{$TMPL['banner_url']}', '{$TMPL['email']}', 
'{$join_date}', 
{$CONF['active_default']}, 0, 
'{$user_ip}')", __FILE__, __LINE__);
        $DB->query("INSERT INTO 
{$CONF['sql_prefix']}_stats (username) 
VALUES 
('{$TMPL['username']}')", __FILE__, __LINE__);

        if ($CONF['google_friendly_links']) {
          $TMPL['verbose_link'] = "";
        }
        else {
          $TMPL['verbose_link'] = "index.php?a=in&u={$TMPL['username']}";
        }
        $TMPL['link_code'] = $this->do_skin('link_code');

        $LNG['join_welcome'] = sprintf
($LNG['join_welcome'], $TMPL['list_name']);

        if ($CONF['email_admin_on_join']) {
          $join_email_admin = new skin
('join_email_admin');
          $join_email_admin->send_email
($CONF['your_email']);
        }

        if ($CONF['active_default']) {
          $join_email = new skin('join_email');
          $join_email->send_email($TMPL['email']);

          $TMPL['content'] = $this->do_skin('join_finish');
        }
        else {
          $TMPL['content'] = $this->do_skin
('join_finish_approve');
        }
      }
      else {
        $this->form();
      }
    }
    else {
      $this->form();
    }
  }
}
?>

und hier die join.html
PHP:
<p class="{$error_style_top}">{$error_top}</p>

<form action="index.php?a=join" method="post" name="join_form">
<fieldset>
<legend>{$lng->join_user}</legend>
<div class="{$error_style_username}"><label class="form">{$lng->g_username}<br />
<input type="text" name="u" size="20" value="{$username}" />
{$error_username}
</label></div><br />
<div class="{$error_style_password}">
<label class="form" style="float: left; margin-right: 2em;">{$lng->g_password}<br />
<input type="password" name="password" size="20" />
</label>
<label class="form">{$lng->join_confirm_password}<br/ >
<input type="password" name="confirm_password" size="20" />
{$error_password}
</label></div>
</fieldset>

<fieldset>
<legend>{$lng->join_website}</legend>
<div class="{$error_style_url}"><label class="form">{$lng->g_url}<br />
<input type="text" name="url" size="50" value="{$url}" />
{$error_url}
</label></div><br />
<div class="{$error_style_title}"><label class="form">{$lng->g_title}<br />
<input type="text" name="title" size="50" value="{$title}" />
{$error_title}
</label></div><br />
<label class="form">{$lng->g_description}<br />
<textarea cols="40" rows="5" name="description">{$description}</textarea><br /><br />
</label>
<label class="form">{$lng->g_category}<br />
{$categories_menu}<br /><br />
</label>
<div class="{$error_style_banner_url}">
<label class="form">{$lng->g_banner_url}
 {$join_banner_size}<br />
<input type="text" name="banner_url" size="50" value="{$banner_url}" />
{$error_banner_url}
</label></div><br />
<div class="{$error_style_email}"><label class="form">{$lng->g_email}<br />
<input type="text" name="email" size="50" value="{$email}" />
{$error_email}
</label></div>
</fieldset>

<fieldset>
<legend>{$lng->join_security}</legend>
{$join_captcha}
{$join_question}
<input name="submit" type="submit" value="{$lng->join_header}" />
</fieldset>
</form>
 
Kann es sein, dass du versuchst eine schon vorhandene Webapplikation wie "vBulletin Board", "Woltlab Burning Board" oder "Invision Power Board" ab zu ändern?
Wenn dem so ist, dann gestaltet sich das Ganze wohl als ungemein schwieriger!
Bedenke, wo und wie die Adressen bzw. die Titel überall eingebunden werden und poste ggf. noch den Quelltext dieser Seiten.

Ich schreibe, ohne den vollständigen Kontext zu kennen, da ich momentan zu müde bin, mir den Quelltext durch zu lesen. Entschuldigung :(
Falls ich daran denke, werde ich mich später noch einmal mit diesem Thread auseinander setzen, falls nicht, nochmal: Entschuldigung :/
 
Zuletzt bearbeitet:
Es handelt sich hier nicht um irgendwelche "Boards".Ich möchte nur mehrere input felder haben.

Nun gut, die Intonation der einzelnen Wörter kannst du natürlich schlecht nachvollziehen, bei geschriebenen Text. Es ging mir viel mehr darum zu erfahren, ob du ein fremdes Skript verwendest.

:eek: Ordnungswahn
join.html
PHP:
<p class="{$error_style_top}">{$error_top}</p>
<form action="index.php?a=join" method="post" name="join_form">
  <fieldset>
    <legend>{$lng->join_user}</legend>
    <div class="{$error_style_username}">
      <label class="form">
        {$lng->g_username}<br />
        <input type="text" name="u" size="20" value="{$username}" />
        {$error_username}
      </label>
    </div>
    <br />
    <div class="{$error_style_password}">
      <label class="form" style="float: left; margin-right: 2em;">{$lng->g_password}<br />
        <input type="password" name="password" size="20" />
      </label>
      <label class="form">
        {$lng->join_confirm_password}<br/ >
        <input type="password" name="confirm_password" size="20" />
        {$error_password}
      </label>
    </div>
  </fieldset>
  
  <fieldset>
    <legend>{$lng->join_website}</legend>
    <div class="{$error_style_url}">
      <label class="form">
        {$lng->g_url} Nr.1<br />
        <input type="text" name="url" size="50" value="{$url}" />
        {$error_url}
      </label>
    </div>
    <br />
    <div class="{$error_style_title}">
      <label class="form">
        {$lng->g_title} Nr.1<br />
        <input type="text" name="title" size="50" value="{$title}" />
        {$error_title}
      </label>
    </div>
    <div class="{$error_style_url}">
      <label class="form">
        {$lng->g_url} Nr.2<br />
        <input type="text" name="url2" size="50" value="{$url2}" />
        {$error_url}
      </label>
    </div>
    <br />
    <div class="{$error_style_title}">
      <label class="form">
        {$lng->g_title} Nr.2<br />
        <input type="text" name="title2" size="50" value="{$title2}" />
        {$error_title}
      </label>
    </div>
        <div class="{$error_style_url}">
      <label class="form">
        {$lng->g_url} Nr.3<br />
        <input type="text" name="url3" size="50" value="{$url3}" />
        {$error_url}
      </label>
    </div>
    <br />
    <div class="{$error_style_title}">
      <label class="form">
        {$lng->g_title} Nr.3<br />
        <input type="text" name="title3" size="50" value="{$title3}" />
        {$error_title}
      </label>
    </div>
    <br />
    <label class="form">
      {$lng->g_description}<br />
      <textarea cols="40" rows="5" name="description">{$description}</textarea><br />
      <br />
    </label>
    <label class="form">
      {$lng->g_category}<br />
      {$categories_menu}<br /><br />
    </label>
    <div class="{$error_style_banner_url}">
      <label class="form">
        {$lng->g_banner_url}
        {$join_banner_size}<br />
        <input type="text" name="banner_url" size="50" value="{$banner_url}" />
        {$error_banner_url}
      </label>
    </div>
    <br />
    <div class="{$error_style_email}">
      <label class="form">
        {$lng->g_email}<br />
        <input type="text" name="email" size="50" value="{$email}" />
        {$error_email}
      </label>
    </div>
  </fieldset>
  
  <fieldset>
    <legend>{$lng->join_security}</legend>
    {$join_captcha}
    {$join_question}
    <input name="submit" type="submit" value="{$lng->join_header}" />
  </fieldset>
</form>

join.vergessen
PHP:
<?php

class join extends join_edit {
  function join() {
    global $FORM, $LNG, $TMPL;

    $TMPL['header'] = $LNG['join_header'];

    $TMPL['error_username'] = '';
    $TMPL['error_style_username'] = '';
    $TMPL['error_password'] = '';
    $TMPL['error_style_password'] = '';
    $TMPL['error_url'] = '';
    $TMPL['error_style_url'] = '';
    $TMPL['error_email'] = '';
    $TMPL['error_style_email'] = '';
    $TMPL['error_title'] = '';
    $TMPL['error_style_title'] = '';
    $TMPL['error_banner_url'] = '';
    $TMPL['error_style_banner_url'] = '';
    $TMPL['error_top'] = '';
    $TMPL['error_style_top'] = '';
    $TMPL['error_captcha'] = '';
    $TMPL['error_style_captcha'] = '';
    $TMPL['error_question'] = '';
    $TMPL['error_style_question'] = '';

    if (!isset($FORM['submit'])) {
      $this->form();
    }
    else {
      $this->process();
    }
  }

  function form() {
    global $CONF, $FORM, $LNG, $TMPL;

    // Display the CAPTCHA?
    if ($CONF['captcha']) {
      $TMPL['rand'] = rand(1, 1000000);
      $TMPL['join_captcha'] = $this->do_skin('join_captcha');
    }
    else {
      $TMPL['join_captcha'] = '';
    }

    // Display the security question?
    if ($CONF['security_question'] && $CONF
['security_answer']) {
      $TMPL['security_question'] = $CONF
['security_question'];
      if (isset($FORM['security_answer'])) 
{ $TMPL['security_answer'] = 
strip_tags($FORM['security_answer']); }
      else { $TMPL['security_answer'] = ''; }

      $TMPL['join_question'] = $this->do_skin('join_question');
    }
    else {
      $TMPL['join_question'] = '';
    }

    $TMPL['categories_menu'] = "
<select name=\"category\">\n";
    foreach ($CONF['categories'] as $cat => $skin) {
      if (isset($TMPL['category']) && $TMPL['category'] 
== $cat) {
        $TMPL['categories_menu'] .= 
"<option value=\"{$cat}\" selected=
\"selected\">{$cat}
</option>\n";
      }
      else {
        $TMPL['categories_menu'] .= "<option value=\"{$cat}\">{$cat}</option>\n";
      }
    }
    $TMPL['categories_menu'] .= "</select>";

    if ($CONF['max_banner_width'] && $CONF
['max_banner_height']) {
      $TMPL['join_banner_size'] = 
sprintf($LNG['join_banner_size'], 
$CONF['max_banner_width'], $CONF['max_banner_height']);
    }
    else {
      $TMPL['join_banner_size'] = '';
    }

    if (!isset($TMPL['username'])) { $TMPL['username'] = ''; }
    if (!isset($TMPL['url'])) { $TMPL['url'] = 'http://'; }
    if (!isset($TMPL['title'])) { $TMPL['title'] = ''; }
    if (!isset($TMPL['url2'])) { $TMPL['url2'] = 'http://'; }
    if (!isset($TMPL['title2'])) { $TMPL['title2'] = ''; }
    if (!isset($TMPL['url3'])) { $TMPL['url3'] = 'http://'; }
    if (!isset($TMPL['title3'])) { $TMPL['title3'] = ''; }
    if (!isset($TMPL['description'])) { $TMPL['description'] = ''; }
    if (!isset($TMPL['banner_url'])) { $TMPL['banner_url'] = '
<a href="http://" target="_blank">http://</a>'; }
    if (!isset($TMPL['email'])) { $TMPL['email'] = ''; }

    if (isset($TMPL['url'])) { $TMPL['url'] = 
stripslashes($TMPL['url']); }
    if (isset($TMPL['title'])) { $TMPL['title'] = stripslashes($TMPL['title']); }
    if (isset($TMPL['title2'])) { $TMPL['title2'] = stripslashes($TMPL['title2']); }
    if (isset($TMPL['title3'])) { $TMPL['title3'] = stripslashes($TMPL['title3']); }
    if (isset($TMPL['description']))
 { $TMPL['description'] = 
stripslashes($TMPL['description']); }
    if (isset($TMPL['category'])) { $TMPL['category'] = stripslashes($TMPL['category']); }
    if (isset($TMPL['banner_url'])) { $TMPL['banner_url'] = stripslashes($TMPL['banner_url']); }
    if (isset($TMPL['email'])) { $TMPL['email'] = stripslashes($TMPL['email']); }

    $TMPL['content'] = $this->do_skin('join_form');
  }

  function process() {
    global $CONF, $DB, $FORM, $LNG, $TMPL;

    $TMPL['username'] = $DB->escape($FORM['u'], 1);
    $TMPL['url'] = $DB->escape($FORM['url'], 1);
    $TMPL['title'] = $DB->escape($FORM['title'], 1);
    $TMPL['url2'] = $DB->escape($FORM['url2'], 1);
    $TMPL['title2'] = $DB->escape($FORM['title2'], 1);
    $TMPL['url3'] = $DB->escape($FORM['url3'], 1);
    $TMPL['title3'] = $DB->escape($FORM['title3'], 1);
    $FORM['description'] = str_replace
(array("\r\n", "\n", "\r"), ' ', $FORM['description']);
    $TMPL['description'] = 
$DB->escape($FORM['description'], 1);
    $TMPL['category'] = 
$DB->escape($FORM['category'], 1);
    $TMPL['banner_url'] = 
$DB->escape($FORM['banner_url'], 1);
    $TMPL['email'] = $DB->escape($FORM['email'], 1);

    $TMPL['title'] = $this->
bad_words($TMPL['title']);
    $TMPL['title2'] = $this->
bad_words($TMPL['title2']);
    $TMPL['title3'] = $this->
bad_words($TMPL['title3']);
    $TMPL['description'] = 
$this->bad_words($TMPL['description']);

    if ($this->check_ban('join')) {
      if ($this->check_input('join')) {
        $password = md5($FORM['password']);

        require_once("{$CONF['path']}/inc/in.php");
        $short_url = in::short_url($TMPL['url']);

        $join_date = date('Y-m-d', time() + (3600*$CONF['time_offset']));

        $user_ip = $DB->escape
($_SERVER['REMOTE_ADDR'], 1);

        $DB->query("INSERT INTO
 {$CONF['sql_prefix']}_sites (username, 
password, url, url2, url3, short_url, title, title2, title3 description, 
category, banner_url, email, join_date, active, 
openid, user_ip)
                  VALUES ('{$TMPL['username']}', 
'{$password}', '{$TMPL['url']}', '{$TMPL['url2']}', '{$TMPL['url3']}', '{$short_url}', 
'{$TMPL['title']}', '{$TMPL['title2']}', '{$TMPL['title3']}', '{$TMPL['description']}', 
'{$TMPL['category']}', 

'{$TMPL['banner_url']}', '{$TMPL['email']}', 
'{$join_date}', 
{$CONF['active_default']}, 0, 
'{$user_ip}')", __FILE__, __LINE__);
        $DB->query("INSERT INTO 
{$CONF['sql_prefix']}_stats (username) 
VALUES 
('{$TMPL['username']}')", __FILE__, __LINE__);

        if ($CONF['google_friendly_links']) {
          $TMPL['verbose_link'] = "";
        }
        else {
          $TMPL['verbose_link'] = "index.php?a=in&u={$TMPL['username']}";
        }
        $TMPL['link_code'] = $this->do_skin('link_code');

        $LNG['join_welcome'] = sprintf
($LNG['join_welcome'], $TMPL['list_name']);

        if ($CONF['email_admin_on_join']) {
          $join_email_admin = new skin
('join_email_admin');
          $join_email_admin->send_email
($CONF['your_email']);
        }

        if ($CONF['active_default']) {
          $join_email = new skin('join_email');
          $join_email->send_email($TMPL['email']);

          $TMPL['content'] = $this->do_skin('join_finish');
        }
        else {
          $TMPL['content'] = $this->do_skin
('join_finish_approve');
        }
      }
      else {
        $this->form();
      }
    }
    else {
      $this->form();
    }
  }
}
?>
Kann sein, dass es so klappt. Es ist ein wirklich unschöner Fix auf ein unschönes Skript. Keine Kudos an den Skripter :P
Du musst die Tabelle (bla_sites) entsprechend um url2, url3, title2 und title3 erweitern.
 
Zuletzt bearbeitet:
danke für deine Hilfe.Hat aber leider nicht geklappt.
Nach dem ich die Daten eingebe bekomme ich diese Fehlermeldung.
Code:
Fatal error: Database error in ".../inc/join.php" on line 138

Unknown column 'url2' in 'field list' in ..../inc/sql/mysql.php on line 72

hier ist die 72 zeile von mysql.php:
....
function error($file, $line) {
trigger_error("Database error in &quot;<b>{$file}</b>&quot; on line <b>{$line}</b><br /><br />\n" . @mysql_error($this->dbl), E_USER_ERROR);
}
.....
 
Es können einer Datenbank nur hinzugefügt werden, wo das gewünschte feld auch existiert...
Also schau dir mal an, welche Felder die Tabelle hat und in welche Felder du daten eintragen willst...

Und so nebenbei: Du nutzt eine Klasse, verwendest dort aber GLOBALE Variablen, daß macht man so eher nicht!

Der fehler liegt dann wohl eher in diesem Query vor...
PHP:
$DB->query("INSERT INTO
 {$CONF['sql_prefix']}_sites (username, 
password, url, url2, url3, short_url, title, title2, title3 description, 
category, banner_url, email, join_date, active, 
openid, user_ip)
 
Zuletzt bearbeitet:
Frage, hast du in deiner Datenbank überhaupt eine Spalte, die Url2 heißt?
Das wäre die erste Fehlermöglichkeit.

Die zweite konnte ich aber ausschliessen, da soweit ich das sehen kann kein Script Fehler in diesem Abschnitt:
PHP:
$DB->query("INSERT INTO
 {$CONF['sql_prefix']}_sites (username, 
password, url, url2, url3, short_url, title, title2, title3 description, 
category, banner_url, email, join_date, active, 
openid, user_ip)
                  VALUES ('{$TMPL['username']}', 
'{$password}', '{$TMPL['url']}', '{$TMPL['url2']}', '{$TMPL['url3']}', '{$short_url}', 
'{$TMPL['title']}', '{$TMPL['title2']}', '{$TMPL['title3']}', '{$TMPL['description']}', 
'{$TMPL['category']}', 

'{$TMPL['banner_url']}', '{$TMPL['email']}', 
'{$join_date}', 
{$CONF['active_default']}, 0, 
'{$user_ip}')", __FILE__, __LINE__);
vorliegt.
 
Zurück