Foros del Web » Programando para Internet » PHP »

Tengo problema con el registro de usuarios en una pagina php

Estas en el tema de Tengo problema con el registro de usuarios en una pagina php en el foro de PHP en Foros del Web. se dañó el archivo en el cual el usuario llenaba sus datos y se registra en la pagina para poder ser cliente de la misma, ...
  #1 (permalink)  
Antiguo 31/05/2008, 20:25
 
Fecha de Ingreso: mayo-2008
Mensajes: 2
Antigüedad: 16 años
Puntos: 0
Pregunta Tengo problema con el registro de usuarios en una pagina php

se dañó el archivo en el cual el usuario llenaba sus datos y se registra en la pagina para poder ser cliente de la misma, me gustaria que me ayudaran a recrearlo, tengo la parte que sigue donde se validan los datos y todo lo demás solo falta el principio.
Pienso que si le dan un vistazo a la pagina que valida y comprueba los datos me podrian ayudar mejor, por eso se la muestro más abajo, es poco largo, pero especificamente necesito una ayuda en la parte que debo recrear, o sea, cuales datos(label, textbox y demás debe tener):

<?php
/*
$Id: account_edit.php,v 1.65 2003/06/09 23:03:52 hpdl Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/

require('includes/application_top.php');

if (!tep_session_is_registered('customer_id')) {
$navigation->set_snapshot();
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
}

// needs to be included earlier to set the success message in the messageStack
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT_EDIT);

if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) {
if (ACCOUNT_GENDER == 'true') $gender = tep_db_prepare_input($HTTP_POST_VARS['gender']);
$firstname = tep_db_prepare_input($HTTP_POST_VARS['firstname']);
$lastname = tep_db_prepare_input($HTTP_POST_VARS['lastname']);
if (ACCOUNT_DOB == 'true') $dob = tep_db_prepare_input($HTTP_POST_VARS['dob']);
$email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']);
$telephone = tep_db_prepare_input($HTTP_POST_VARS['telephone']);
$fax = tep_db_prepare_input($HTTP_POST_VARS['fax']);

$error = false;

if (ACCOUNT_GENDER == 'true') {
if ( ($gender != 'm') && ($gender != 'f') ) {
$error = true;

$messageStack->add('account_edit', ENTRY_GENDER_ERROR);
}
}

if (strlen($firstname) < ENTRY_FIRST_NAME_MIN_LENGTH) {
$error = true;

$messageStack->add('account_edit', ENTRY_FIRST_NAME_ERROR);
}

if (strlen($lastname) < ENTRY_LAST_NAME_MIN_LENGTH) {
$error = true;

$messageStack->add('account_edit', ENTRY_LAST_NAME_ERROR);
}

if (ACCOUNT_DOB == 'true') {
if (!checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4))) {
$error = true;

$messageStack->add('account_edit', ENTRY_DATE_OF_BIRTH_ERROR);
}
}

if (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
$error = true;

$messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_ERROR);
}

if (!tep_validate_email($email_address)) {
$error = true;

$messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
}

$check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "' and customers_id != '" . (int)$customer_id . "'");
$check_email = tep_db_fetch_array($check_email_query);
if ($check_email['total'] > 0) {
$error = true;

$messageStack->add('account_edit', ENTRY_EMAIL_ADDRESS_ERROR_EXISTS);
}

if (strlen($telephone) < ENTRY_TELEPHONE_MIN_LENGTH) {
$error = true;

$messageStack->add('account_edit', ENTRY_TELEPHONE_NUMBER_ERROR);
}

if ($error == false) {
$sql_data_array = array('customers_firstname' => $firstname,
'customers_lastname' => $lastname,
'customers_email_address' => $email_address,
'customers_telephone' => $telephone,
'customers_fax' => $fax);

if (ACCOUNT_GENDER == 'true') $sql_data_array['customers_gender'] = $gender;
if (ACCOUNT_DOB == 'true') $sql_data_array['customers_dob'] = tep_date_raw($dob);

tep_db_perform(TABLE_CUSTOMERS, $sql_data_array, 'update', "customers_id = '" . (int)$customer_id . "'");

tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . (int)$customer_id . "'");

$sql_data_array = array('entry_firstname' => $firstname,
'entry_lastname' => $lastname);

tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$customer_default_address_id . "'");

// reset the session variables
$customer_first_name = $firstname;

$messageStack->add_session('account', SUCCESS_ACCOUNT_UPDATED, 'success');

tep_redirect(tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
}
}

$account_query = tep_db_query("select customers_gender, customers_firstname, customers_lastname, customers_dob, customers_email_address, customers_telephone, customers_fax from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");
$account = tep_db_fetch_array($account_query);

$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ACCOUNT_EDIT, '', 'SSL'));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<?php require('includes/form_check.js.php'); ?>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><?php echo tep_draw_form('account_edit', tep_href_link(FILENAME_ACCOUNT_EDIT, '', 'SSL'), 'post', 'onSubmit="return check_form(account_edit);"') . tep_draw_hidden_field('action', 'process'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_account.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
if ($messageStack->size('account_edit') > 0) {
?>
<tr>
<td><?php echo $messageStack->output('account_edit'); ?></td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
</tr>
<?php
}
?>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="main"><b><?php echo MY_ACCOUNT_TITLE; ?></b></td>
<td class="inputRequirement" align="right"><?php echo FORM_REQUIRED_INFORMATION; ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
<tr class="infoBoxContents">
<td><table border="0" cellspacing="2" cellpadding="2">
<?php
if (ACCOUNT_GENDER == 'true') {
if (isset($gender)) {
$male = ($gender == 'm') ? true : false;
} else {
$male = ($account['customers_gender'] == 'm') ? true : false;
}
$female = !$male;
?>
<tr>
<td class="main"><?php echo ENTRY_GENDER; ?></td>
<td class="main"><?php echo tep_draw_radio_field('gender', 'm', $male) . '&nbsp;&nbsp;' . MALE . '&nbsp;&nbsp;' . tep_draw_radio_field('gender', 'f', $female) . '&nbsp;&nbsp;' . FEMALE . '&nbsp;' . (tep_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>': ''); ?></td>
</tr>
<?php
}
?>
<tr>
<td class="main"><?php echo ENTRY_FIRST_NAME; ?></td>
<td class="main"><?php echo tep_draw_input_field('firstname', $account['customers_firstname']) . '&nbsp;' . (tep_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?></td>
</tr>
<tr>
<td class="main"><?php echo ENTRY_LAST_NAME; ?></td>
<td class="main"><?php echo tep_draw_input_field('lastname', $account['customers_lastname']) . '&nbsp;' . (tep_not_null(ENTRY_LAST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?></td>
</tr>
<?php
if (ACCOUNT_DOB == 'true') {
?>

?>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:51.