"") { // Get action $members->CurrentAction = $_POST["a_register"]; GetUploadFiles(); // Get upload files LoadFormValues(); // Get form values } else { $members->CurrentAction = "I"; // Display blank record LoadDefaultValues(); // Load default values } if ($members->CurrentAction <> "I" && $members->CurrentAction <> "C") { // Get captcha value $captcha = $objForm->GetValue("captcha"); // Check captcha value from form if ($captcha <> $_SESSION["EW_CAPTCHA_CODE"]) { // Captcha unmatched $_SESSION[EW_SESSION_MESSAGE] = "لطفا كد امنيتي را تايپ كنيد"; // Set message $members->CurrentAction = "I"; // Reset action, do not insert if captcha unmatched } } // Handle email activation if (@$_GET["action"] <> "") { $sAction = $_GET["action"]; $sEmail = $_GET["email"]; $qs = new cQueryString(); $sApprovalCode = $qs->getValue("code"); if ($sEmail == TEAdecrypt($sApprovalCode, EW_RANDOM_KEY)) { if (strtolower($sAction) == "confirm") { // Email activation if (ActivateEmail($sEmail)) { // activate this email $_SESSION[EW_SESSION_MESSAGE] = "اشتراك كاربري شما فعال شد"; // Set message acount activated Page_Terminate("login.php"); // Go to login page } } } if (@$_SESSION[EW_SESSION_MESSAGE] == "") { $_SESSION[EW_SESSION_MESSAGE] = "فعال سازي اشتراك كاربري شما با خطا مواجه شد"; // Set activate failed message } Page_Terminate("login.php"); // Go to login page } switch ($members->CurrentAction) { case "I": // Blank record, no action required break; case "A": // Add // Check for Duplicate User ID $sFilter = "(`email` = '" . ew_AdjustSql($members->username->CurrentValue) . "')"; // Set up filter (Sql Where Clause) and get Return Sql // Sql constructor in members class, membersinfo.php $members->CurrentFilter = $sFilter; $sUserSql = $members->SQL(); if ($rs = $conn->Execute($sUserSql)) { if (!$rs->EOF) { $bUserExists = TRUE; RestoreFormValues(); // Restore form values $_SESSION[EW_SESSION_MESSAGE] = "اين كاربر از قبل در سيستم ثبت شده است"; // Set user exist message } $rs->Close(); } if (!$bUserExists) { $members->SendEmail = TRUE; // Send email on add success if (AddRow()) { // Add record // Load user email $sReceiverEmail = $members->email->CurrentValue; if ($sReceiverEmail == "") { // Send to recipient directly $sReceiverEmail = EW_RECIPIENT_EMAIL; $sBccEmail = ""; } else { // Bcc recipient $sBccEmail = EW_RECIPIENT_EMAIL; } // Set up email content if ($sReceiverEmail <> "") { $Email = new cEmail; $Email->Load("txtregister.txt"); $Email->ReplaceSender(EW_SENDER_EMAIL); // Replace Sender $Email->ReplaceRecipient($sReceiverEmail); // Replace Recipient if ($sBccEmail <> "") $Email->AddBcc($sBccEmail); // Add Bcc $Email->ReplaceContent('', strval($members->username->CurrentValue)); $Email->ReplaceContent('', strval($members->password->CurrentValue)); $Email->ReplaceContent('', strval($members->name->CurrentValue)); $Email->ReplaceContent('', strval($members->lname->CurrentValue)); $Email->ReplaceContent('', strval($members->fname->CurrentValue)); $Email->ReplaceContent('', strval($members->oldnid->CurrentValue)); $Email->ReplaceContent('', strval($members->newnid->CurrentValue)); $Email->ReplaceContent('', strval($members->gender->CurrentValue)); $Email->ReplaceContent('', strval($members->marriage->CurrentValue)); $Email->ReplaceContent('', strval($members->birth_date->CurrentValue)); $Email->ReplaceContent('', strval($members->birth_place->CurrentValue)); $Email->ReplaceContent('', strval($members->sodour_place->CurrentValue)); $Email->ReplaceContent('', strval($members->province->CurrentValue)); $Email->ReplaceContent('', strval($members->city->CurrentValue)); $Email->ReplaceContent('', strval($members->email->CurrentValue)); $Email->ReplaceContent('', strval($members->website->CurrentValue)); $Email->ReplaceContent('', strval($members->address->CurrentValue)); $Email->ReplaceContent('', strval($members->zip->CurrentValue)); $Email->ReplaceContent('', strval($members->tel->CurrentValue)); $Email->ReplaceContent('', strval($members->fax->CurrentValue)); $Email->ReplaceContent('', strval($members->mobile->CurrentValue)); $Email->ReplaceContent('', strval($members->photo->CurrentValue)); $Email->ReplaceContent('', strval($members->theme->CurrentValue)); $Email->ReplaceContent('', strval($members->homepage->CurrentValue)); $sActivateLink = ew_FullUrl() . "?action=confirm"; $sActivateLink .= "&email=" . $members->email->CurrentValue; $sActivateLink .= "&code=" . TEAencrypt($members->email->CurrentValue, EW_RANDOM_KEY); $Email->ReplaceContent("", $sActivateLink); $Email->Send(); } $_SESSION[EW_SESSION_MESSAGE] = "عضويت شما با موفقيت انجام شد . لطفا براي فعال سازي اشتراك كاربري خود روي لينكي كه به آدرس ايميل شما ارسال شده است كليك كنيد!"; // Activate success Page_Terminate("login.php"); // Go to login page } else { RestoreFormValues(); // Restore form values } } } // Render row if ($members->CurrentAction == "F") { // Confirm page $members->RowType = EW_ROWTYPE_VIEW; // Render view } else { $members->RowType = EW_ROWTYPE_ADD; // Render add } RenderRow(); ?> block(EW_PAGE_ID, "general", 3); echo $block; } ?>

عضويت در سيستم

بازگشت به صفحه ورود به سيستم

"") { ?>

اخطار

CurrentAction == "F") { // Confirm page ?> username->CellAttributes() ?>> CurrentAction <> "F") { ?> username->EditAttributes() ?>> username->ViewAttributes() ?>>username->ViewValue ?> password->CellAttributes() ?>> CurrentAction <> "F") { ?> password->EditAttributes() ?>> password->ViewAttributes() ?>>password->ViewValue ?> password->CellAttributes() ?>> CurrentAction <> "F") { ?> password->EditAttributes() ?>> password->ViewAttributes() ?>>password->ViewValue ?> name->CellAttributes() ?>> CurrentAction <> "F") { ?>
name->ViewAttributes() ?>>name->ViewValue ?>
lname->CellAttributes() ?>> CurrentAction <> "F") { ?>
lname->ViewAttributes() ?>>lname->ViewValue ?>
email->CellAttributes() ?>> CurrentAction <> "F") { ?> email->EditAttributes() ?>> email->HrefValue <> "") { ?> email->ViewAttributes() ?>>email->ViewValue ?> email->ViewAttributes() ?>>email->ViewValue ?>
شناسه كاربري *
رمز عبور *
تائيد رمز عبور
نام (به فارسي) *
نام خانوادگي (به فارسي) *
آدرس ايميل *

CurrentAction <> "F") { ?>
Warning: CAPTCHA extension is enabled but PHP version on this server is " . phpversion() . " only. The extension requires PHP >= 4.3.2.

"; } ?>
Security Image

لطفا كد امنيتي را تايپ كنيد *

CurrentAction <> "F") { // Confirm page ?>

CurrentAction <> "F") { ?> block(EW_PAGE_ID, "general", 4); echo $block; } ?> Close(); // Go to url if specified if ($url <> "") { ob_end_clean(); header("Location: $url"); } exit(); } ?> CurrentFilter = $sFilter; $sSql = $members->SQL(); $conn->raiseErrorFn = 'ew_ErrorFn'; $rs = $conn->Execute($sSql); $conn->raiseErrorFn = ''; if ($rs === FALSE) return FALSE; if (!$rs->EOF) { $rs->Close(); $rsnew = array('activated' => "Y"); // Auto register return $conn->Execute($members->UpdateSQL($rsnew)); } else { $_SESSION[EW_SESSION_MESSAGE] = "ركوردي يافت نشد"; $rs->Close(); return FALSE; } } ?> CurrentAction == "F") { $members->photo->Upload->Index = $objForm->Index; if ($members->photo->Upload->UploadFile()) { // No action required } else { echo $members->photo->Upload->Message; exit(); } $members->photo->Upload->SaveToSession(); $members->photo->CurrentValue = $members->photo->Upload->FileName; } else { $members->photo->Upload->RestoreDbFromSession(); $members->photo->Upload->RestoreFromSession(); } } ?> birth_date->CurrentValue = "yyyy-mm-dd"; } ?> username->setFormValue($objForm->GetValue("x_username")); $members->password->setFormValue($objForm->GetValue("x_password")); $members->name->setFormValue($objForm->GetValue("x_name")); $members->lname->setFormValue($objForm->GetValue("x_lname")); $members->fname->setFormValue($objForm->GetValue("x_fname")); $members->oldnid->setFormValue($objForm->GetValue("x_oldnid")); $members->newnid->setFormValue($objForm->GetValue("x_newnid")); $members->gender->setFormValue($objForm->GetValue("x_gender")); $members->marriage->setFormValue($objForm->GetValue("x_marriage")); $members->birth_date->setFormValue($objForm->GetValue("x_birth_date")); $members->birth_date->CurrentValue = ew_UnFormatDateTime($members->birth_date->CurrentValue, 5); $members->birth_place->setFormValue($objForm->GetValue("x_birth_place")); $members->sodour_place->setFormValue($objForm->GetValue("x_sodour_place")); $members->province->setFormValue($objForm->GetValue("x_province")); $members->city->setFormValue($objForm->GetValue("x_city")); $members->email->setFormValue($objForm->GetValue("x_email")); $members->website->setFormValue($objForm->GetValue("x_website")); $members->address->setFormValue($objForm->GetValue("x_address")); $members->zip->setFormValue($objForm->GetValue("x_zip")); $members->tel->setFormValue($objForm->GetValue("x_tel")); $members->fax->setFormValue($objForm->GetValue("x_fax")); $members->mobile->setFormValue($objForm->GetValue("x_mobile")); $members->theme->setFormValue($objForm->GetValue("x_theme")); $members->homepage->setFormValue($objForm->GetValue("x_homepage")); } // Restore form values function RestoreFormValues() { global $members; $members->username->CurrentValue = $members->username->FormValue; $members->password->CurrentValue = $members->password->FormValue; $members->name->CurrentValue = $members->name->FormValue; $members->lname->CurrentValue = $members->lname->FormValue; $members->fname->CurrentValue = $members->fname->FormValue; $members->oldnid->CurrentValue = $members->oldnid->FormValue; $members->newnid->CurrentValue = $members->newnid->FormValue; $members->gender->CurrentValue = $members->gender->FormValue; $members->marriage->CurrentValue = $members->marriage->FormValue; $members->birth_date->CurrentValue = $members->birth_date->FormValue; $members->birth_date->CurrentValue = ew_UnFormatDateTime($members->birth_date->CurrentValue, 5); $members->birth_place->CurrentValue = $members->birth_place->FormValue; $members->sodour_place->CurrentValue = $members->sodour_place->FormValue; $members->province->CurrentValue = $members->province->FormValue; $members->city->CurrentValue = $members->city->FormValue; $members->email->CurrentValue = $members->email->FormValue; $members->website->CurrentValue = $members->website->FormValue; $members->address->CurrentValue = $members->address->FormValue; $members->zip->CurrentValue = $members->zip->FormValue; $members->tel->CurrentValue = $members->tel->FormValue; $members->fax->CurrentValue = $members->fax->FormValue; $members->mobile->CurrentValue = $members->mobile->FormValue; $members->theme->CurrentValue = $members->theme->FormValue; $members->homepage->CurrentValue = $members->homepage->FormValue; } ?> Row_Rendering(); // Common render codes for all row types // username $members->username->CellCssStyle = ""; $members->username->CellCssClass = ""; // password $members->password->CellCssStyle = ""; $members->password->CellCssClass = ""; // name $members->name->CellCssStyle = ""; $members->name->CellCssClass = ""; // lname $members->lname->CellCssStyle = ""; $members->lname->CellCssClass = ""; // fname $members->fname->CellCssStyle = ""; $members->fname->CellCssClass = ""; // oldnid $members->oldnid->CellCssStyle = ""; $members->oldnid->CellCssClass = ""; // newnid $members->newnid->CellCssStyle = ""; $members->newnid->CellCssClass = ""; // gender $members->gender->CellCssStyle = ""; $members->gender->CellCssClass = ""; // marriage $members->marriage->CellCssStyle = ""; $members->marriage->CellCssClass = ""; // birth_date $members->birth_date->CellCssStyle = ""; $members->birth_date->CellCssClass = ""; // birth_place $members->birth_place->CellCssStyle = ""; $members->birth_place->CellCssClass = ""; // sodour_place $members->sodour_place->CellCssStyle = ""; $members->sodour_place->CellCssClass = ""; // province $members->province->CellCssStyle = ""; $members->province->CellCssClass = ""; // city $members->city->CellCssStyle = ""; $members->city->CellCssClass = ""; // email $members->email->CellCssStyle = ""; $members->email->CellCssClass = ""; // website $members->website->CellCssStyle = ""; $members->website->CellCssClass = ""; // address $members->address->CellCssStyle = ""; $members->address->CellCssClass = ""; // zip $members->zip->CellCssStyle = ""; $members->zip->CellCssClass = ""; // tel $members->tel->CellCssStyle = ""; $members->tel->CellCssClass = ""; // fax $members->fax->CellCssStyle = ""; $members->fax->CellCssClass = ""; // mobile $members->mobile->CellCssStyle = ""; $members->mobile->CellCssClass = ""; // photo $members->photo->CellCssStyle = ""; $members->photo->CellCssClass = ""; // theme $members->theme->CellCssStyle = ""; $members->theme->CellCssClass = ""; // homepage $members->homepage->CellCssStyle = ""; $members->homepage->CellCssClass = ""; if ($members->RowType == EW_ROWTYPE_VIEW) { // View row // username $members->username->ViewValue = $members->username->CurrentValue; $members->username->CssStyle = "font-weight:bold;text-align:center;"; $members->username->CssClass = ""; $members->username->ViewCustomAttributes = "dir=\"ltr\""; // password $members->password->ViewValue = "********"; $members->password->CssStyle = ""; $members->password->CssClass = ""; $members->password->ViewCustomAttributes = ""; // name $members->name->ViewValue = $members->name->CurrentValue; $members->name->CssStyle = ""; $members->name->CssClass = ""; $members->name->ViewCustomAttributes = ""; // lname $members->lname->ViewValue = $members->lname->CurrentValue; $members->lname->CssStyle = ""; $members->lname->CssClass = ""; $members->lname->ViewCustomAttributes = ""; // fname $members->fname->ViewValue = $members->fname->CurrentValue; $members->fname->CssStyle = ""; $members->fname->CssClass = ""; $members->fname->ViewCustomAttributes = ""; // oldnid $members->oldnid->ViewValue = $members->oldnid->CurrentValue; $members->oldnid->ViewValue = ew_FormatNumber($members->oldnid->ViewValue, 0, -2, -2, -2); $members->oldnid->CssStyle = "text-align:center;"; $members->oldnid->CssClass = ""; $members->oldnid->ViewCustomAttributes = "dir=\"ltr\""; // newnid $members->newnid->ViewValue = $members->newnid->CurrentValue; $members->newnid->CssStyle = ""; $members->newnid->CssClass = ""; $members->newnid->ViewCustomAttributes = ""; // gender if (!is_null($members->gender->CurrentValue)) { switch ($members->gender->CurrentValue) { case "مرد": $members->gender->ViewValue = "مرد"; break; case "زن": $members->gender->ViewValue = "زن"; break; default: $members->gender->ViewValue = $members->gender->CurrentValue; } } else { $members->gender->ViewValue = NULL; } $members->gender->CssStyle = ""; $members->gender->CssClass = ""; $members->gender->ViewCustomAttributes = ""; // marriage if (!is_null($members->marriage->CurrentValue)) { switch ($members->marriage->CurrentValue) { case "مجرد": $members->marriage->ViewValue = "مجرد"; break; case "متاهل": $members->marriage->ViewValue = "متاهل"; break; default: $members->marriage->ViewValue = $members->marriage->CurrentValue; } } else { $members->marriage->ViewValue = NULL; } $members->marriage->CssStyle = ""; $members->marriage->CssClass = ""; $members->marriage->ViewCustomAttributes = ""; // birth_date $members->birth_date->ViewValue = $members->birth_date->CurrentValue; $members->birth_date->CssStyle = "text-align:center;"; $members->birth_date->CssClass = ""; $members->birth_date->ViewCustomAttributes = "dir=\"ltr\""; // birth_place $members->birth_place->ViewValue = $members->birth_place->CurrentValue; $members->birth_place->CssStyle = ""; $members->birth_place->CssClass = ""; $members->birth_place->ViewCustomAttributes = ""; // sodour_place $members->sodour_place->ViewValue = $members->sodour_place->CurrentValue; $members->sodour_place->CssStyle = ""; $members->sodour_place->CssClass = ""; $members->sodour_place->ViewCustomAttributes = ""; // province if (!is_null($members->province->CurrentValue)) { $sSqlWrk = "SELECT `province` FROM `provinces` WHERE `province` = '" . ew_AdjustSql($members->province->CurrentValue) . "'"; $rswrk = $conn->Execute($sSqlWrk); if ($rswrk) { if (!$rswrk->EOF) { $members->province->ViewValue = $rswrk->fields('province'); } $rswrk->Close(); } else { $members->province->ViewValue = $members->province->CurrentValue; } } else { $members->province->ViewValue = NULL; } $members->province->CssStyle = ""; $members->province->CssClass = ""; $members->province->ViewCustomAttributes = ""; // city if (!is_null($members->city->CurrentValue)) { $sSqlWrk = "SELECT `city` FROM `cities` WHERE `city` = '" . ew_AdjustSql($members->city->CurrentValue) . "'"; $rswrk = $conn->Execute($sSqlWrk); if ($rswrk) { if (!$rswrk->EOF) { $members->city->ViewValue = $rswrk->fields('city'); } $rswrk->Close(); } else { $members->city->ViewValue = $members->city->CurrentValue; } } else { $members->city->ViewValue = NULL; } $members->city->CssStyle = ""; $members->city->CssClass = ""; $members->city->ViewCustomAttributes = ""; // email $members->email->ViewValue = $members->email->CurrentValue; $members->email->CssStyle = "text-align:center;"; $members->email->CssClass = ""; $members->email->ViewCustomAttributes = "dir=\"ltr\""; // website $members->website->ViewValue = $members->website->CurrentValue; $members->website->CssStyle = "text-align:center;"; $members->website->CssClass = ""; $members->website->ViewCustomAttributes = "dir=\"ltr\""; // address $members->address->ViewValue = $members->address->CurrentValue; $members->address->CssStyle = ""; $members->address->CssClass = ""; $members->address->ViewCustomAttributes = ""; // zip $members->zip->ViewValue = $members->zip->CurrentValue; $members->zip->CssStyle = ""; $members->zip->CssClass = ""; $members->zip->ViewCustomAttributes = ""; // tel $members->tel->ViewValue = $members->tel->CurrentValue; $members->tel->CssStyle = "text-align:center;"; $members->tel->CssClass = ""; $members->tel->ViewCustomAttributes = "dir=\"ltr\""; // fax $members->fax->ViewValue = $members->fax->CurrentValue; $members->fax->CssStyle = ""; $members->fax->CssClass = ""; $members->fax->ViewCustomAttributes = ""; // mobile $members->mobile->ViewValue = $members->mobile->CurrentValue; $members->mobile->CssStyle = "text-align:center;"; $members->mobile->CssClass = ""; $members->mobile->ViewCustomAttributes = "dir=\"ltr\""; // photo if (!is_null($members->photo->Upload->DbValue)) { $members->photo->ViewValue = $members->photo->Upload->DbValue; $members->photo->ImageWidth = 70; $members->photo->ImageHeight = 0; $members->photo->ImageAlt = "عكس كاربر"; } else { $members->photo->ViewValue = ""; } $members->photo->CssStyle = ""; $members->photo->CssClass = ""; $members->photo->ViewCustomAttributes = ""; // theme if (!is_null($members->theme->CurrentValue)) { $sSqlWrk = "SELECT `theme` FROM `templates` WHERE `theme` = '" . ew_AdjustSql($members->theme->CurrentValue) . "'"; $rswrk = $conn->Execute($sSqlWrk); if ($rswrk) { if (!$rswrk->EOF) { $members->theme->ViewValue = $rswrk->fields('theme'); } $rswrk->Close(); } else { $members->theme->ViewValue = $members->theme->CurrentValue; } } else { $members->theme->ViewValue = NULL; } $members->theme->CssStyle = ""; $members->theme->CssClass = ""; $members->theme->ViewCustomAttributes = ""; // homepage $members->homepage->ViewValue = $members->homepage->CurrentValue; $members->homepage->CssStyle = ""; $members->homepage->CssClass = ""; $members->homepage->ViewCustomAttributes = ""; // username $members->username->HrefValue = ""; // password $members->password->HrefValue = ""; // name $members->name->HrefValue = ""; // lname $members->lname->HrefValue = ""; // fname $members->fname->HrefValue = ""; // oldnid $members->oldnid->HrefValue = ""; // newnid $members->newnid->HrefValue = ""; // gender $members->gender->HrefValue = ""; // marriage $members->marriage->HrefValue = ""; // birth_date $members->birth_date->HrefValue = ""; // birth_place $members->birth_place->HrefValue = ""; // sodour_place $members->sodour_place->HrefValue = ""; // province $members->province->HrefValue = ""; // city $members->city->HrefValue = ""; // email if (!is_null($members->email->CurrentValue)) { $members->email->HrefValue = ((!empty($members->email->ViewValue)) ? $members->email->ViewValue : $members->email->CurrentValue); if ($members->Export <> "") $members->email->HrefValue = ew_ConvertFullUrl($members->email->HrefValue); } else { $members->email->HrefValue = ""; } // website if (!is_null($members->website->CurrentValue)) { $members->website->HrefValue = ((!empty($members->website->ViewValue)) ? $members->website->ViewValue : $members->website->CurrentValue); if ($members->Export <> "") $members->website->HrefValue = ew_ConvertFullUrl($members->website->HrefValue); } else { $members->website->HrefValue = ""; } // address $members->address->HrefValue = ""; // zip $members->zip->HrefValue = ""; // tel $members->tel->HrefValue = ""; // fax $members->fax->HrefValue = ""; // mobile $members->mobile->HrefValue = ""; // photo if (!is_null($members->photo->Upload->DbValue)) { $members->photo->HrefValue = "ewbv50.php?fn=" . urlencode(ew_UploadPathEx(FALSE, EW_UPLOAD_DEST_PATH) . ((!empty($members->photo->ViewValue)) ? $members->photo->ViewValue : $members->photo->CurrentValue)); if ($members->Export <> "") $members->photo->HrefValue = ew_ConvertFullUrl($members->photo->HrefValue); } else { $members->photo->HrefValue = ""; } // theme $members->theme->HrefValue = ""; // homepage $members->homepage->HrefValue = ""; } elseif ($members->RowType == EW_ROWTYPE_ADD) { // Add row // username $members->username->EditCustomAttributes = "dir=\"ltr\""; $members->username->EditValue = ew_HtmlEncode($members->username->CurrentValue); // password $members->password->EditCustomAttributes = "dir=\"ltr\""; $members->password->EditValue = ew_HtmlEncode($members->password->CurrentValue); // name $members->name->EditCustomAttributes = ""; $members->name->EditValue = ew_HtmlEncode($members->name->CurrentValue); // lname $members->lname->EditCustomAttributes = ""; $members->lname->EditValue = ew_HtmlEncode($members->lname->CurrentValue); // fname $members->fname->EditCustomAttributes = ""; $members->fname->EditValue = ew_HtmlEncode($members->fname->CurrentValue); // oldnid $members->oldnid->EditCustomAttributes = "dir=\"ltr\""; $members->oldnid->EditValue = ew_HtmlEncode($members->oldnid->CurrentValue); // newnid $members->newnid->EditCustomAttributes = "dir=\"ltr\""; $members->newnid->EditValue = ew_HtmlEncode($members->newnid->CurrentValue); // gender $members->gender->EditCustomAttributes = ""; $arwrk = array(); $arwrk[] = array("مرد", "مرد"); $arwrk[] = array("زن", "زن"); $members->gender->EditValue = $arwrk; // marriage $members->marriage->EditCustomAttributes = ""; $arwrk = array(); $arwrk[] = array("مجرد", "مجرد"); $arwrk[] = array("متاهل", "متاهل"); $members->marriage->EditValue = $arwrk; // birth_date $members->birth_date->EditCustomAttributes = "dir=\"ltr\""; $members->birth_date->EditValue = ew_HtmlEncode($members->birth_date->CurrentValue); // birth_place $members->birth_place->EditCustomAttributes = ""; $members->birth_place->EditValue = ew_HtmlEncode($members->birth_place->CurrentValue); // sodour_place $members->sodour_place->EditCustomAttributes = ""; $members->sodour_place->EditValue = ew_HtmlEncode($members->sodour_place->CurrentValue); // province $members->province->EditCustomAttributes = ""; if ($members->province->getSessionValue() <> "") { $members->province->CurrentValue = $members->province->getSessionValue(); if (!is_null($members->province->CurrentValue)) { $sSqlWrk = "SELECT `province` FROM `provinces` WHERE `province` = '" . ew_AdjustSql($members->province->CurrentValue) . "'"; $rswrk = $conn->Execute($sSqlWrk); if ($rswrk) { if (!$rswrk->EOF) { $members->province->ViewValue = $rswrk->fields('province'); } $rswrk->Close(); } else { $members->province->ViewValue = $members->province->CurrentValue; } } else { $members->province->ViewValue = NULL; } $members->province->CssStyle = ""; $members->province->CssClass = ""; $members->province->ViewCustomAttributes = ""; } else { $sSqlWrk = "SELECT `province`, `province` FROM `provinces`"; $rswrk = $conn->Execute($sSqlWrk); $arwrk = ($rswrk) ? $rswrk->GetRows() : array(); if ($rswrk) $rswrk->Close(); array_unshift($arwrk, array("", "انتخاب كنيد")); $members->province->EditValue = $arwrk; } // city $members->city->EditCustomAttributes = ""; if ($members->city->getSessionValue() <> "") { $members->city->CurrentValue = $members->city->getSessionValue(); if (!is_null($members->city->CurrentValue)) { $sSqlWrk = "SELECT `city` FROM `cities` WHERE `city` = '" . ew_AdjustSql($members->city->CurrentValue) . "'"; $rswrk = $conn->Execute($sSqlWrk); if ($rswrk) { if (!$rswrk->EOF) { $members->city->ViewValue = $rswrk->fields('city'); } $rswrk->Close(); } else { $members->city->ViewValue = $members->city->CurrentValue; } } else { $members->city->ViewValue = NULL; } $members->city->CssStyle = ""; $members->city->CssClass = ""; $members->city->ViewCustomAttributes = ""; } else { $sSqlWrk = "SELECT `city`, `city`, `province` FROM `cities`"; $rswrk = $conn->Execute($sSqlWrk); $arwrk = ($rswrk) ? $rswrk->GetRows() : array(); if ($rswrk) $rswrk->Close(); array_unshift($arwrk, array("", "انتخاب كنيد", "")); $members->city->EditValue = $arwrk; } // email $members->email->EditCustomAttributes = "dir=\"ltr\""; $members->email->EditValue = ew_HtmlEncode($members->email->CurrentValue); // website $members->website->EditCustomAttributes = "dir=\"ltr\""; $members->website->EditValue = ew_HtmlEncode($members->website->CurrentValue); // address $members->address->EditCustomAttributes = ""; $members->address->EditValue = ew_HtmlEncode($members->address->CurrentValue); // zip $members->zip->EditCustomAttributes = "dir=\"ltr\""; $members->zip->EditValue = ew_HtmlEncode($members->zip->CurrentValue); // tel $members->tel->EditCustomAttributes = "dir=\"ltr\""; $members->tel->EditValue = ew_HtmlEncode($members->tel->CurrentValue); // fax $members->fax->EditCustomAttributes = "dir=\"ltr\""; $members->fax->EditValue = ew_HtmlEncode($members->fax->CurrentValue); // mobile $members->mobile->EditCustomAttributes = "dir=\"ltr\""; $members->mobile->EditValue = ew_HtmlEncode($members->mobile->CurrentValue); // photo $members->photo->EditCustomAttributes = ""; $members->photo->EditValue = $members->photo->CurrentValue; // theme $members->theme->EditCustomAttributes = ""; $sSqlWrk = "SELECT `theme`, `theme` FROM `templates`"; $rswrk = $conn->Execute($sSqlWrk); $arwrk = ($rswrk) ? $rswrk->GetRows() : array(); if ($rswrk) $rswrk->Close(); array_unshift($arwrk, array("", "انتخاب كنيد")); $members->theme->EditValue = $arwrk; // homepage $members->homepage->EditCustomAttributes = "dir=\"ltr\""; $members->homepage->EditValue = ew_HtmlEncode($members->homepage->CurrentValue); } elseif ($members->RowType == EW_ROWTYPE_EDIT) { // Edit row } elseif ($members->RowType == EW_ROWTYPE_SEARCH) { // Search row } // Call Row Rendered event $members->Row_Rendered(); } ?> CurrentUserID() <> "" && !$Security->IsAdmin()) { // Non system admin $bValidUser = $Security->IsValidUserID($members->id->CurrentValue); if (!$bValidUser) { $_SESSION[EW_SESSION_MESSAGE] = "دسترسي غير مجاز"; return FALSE; } } // Check for duplicate key $bCheckKey = TRUE; $sFilter = $members->SqlKeyFilter(); if (trim(strval($members->id->CurrentValue)) == "") { $bCheckKey = FALSE; } else { $sFilter = str_replace("@id@", ew_AdjustSql($members->id->CurrentValue), $sFilter); // Replace key value } if (!is_numeric($members->id->CurrentValue)) { $bCheckKey = FALSE; } if ($bCheckKey) { $rsChk = $members->LoadRs($sFilter); if ($rsChk && !$rsChk->EOF) { $_SESSION[EW_SESSION_MESSAGE] = "مقدار كليه اصلي تكراري است"; $rsChk->Close(); return FALSE; } } if ($members->username->CurrentValue <> "") { // Check field with unique index $sFilter = "(`username` = '" . ew_AdjustSql($members->username->CurrentValue) . "')"; $rsChk = $members->LoadRs($sFilter); if ($rsChk && !$rsChk->EOF) { $_SESSION[EW_SESSION_MESSAGE] = "مقدار كليد اصلي يا ايندكس تكراري است -- `username`, مقدار = " . $members->username->CurrentValue; $rsChk->Close(); return FALSE; } } if ($members->newnid->CurrentValue <> "") { // Check field with unique index $sFilter = "(`newnid` = " . ew_AdjustSql($members->newnid->CurrentValue) . ")"; $rsChk = $members->LoadRs($sFilter); if ($rsChk && !$rsChk->EOF) { $_SESSION[EW_SESSION_MESSAGE] = "مقدار كليد اصلي يا ايندكس تكراري است -- `newnid`, مقدار = " . $members->newnid->CurrentValue; $rsChk->Close(); return FALSE; } } if ($members->email->CurrentValue <> "") { // Check field with unique index $sFilter = "(`email` = '" . ew_AdjustSql($members->email->CurrentValue) . "')"; $rsChk = $members->LoadRs($sFilter); if ($rsChk && !$rsChk->EOF) { $_SESSION[EW_SESSION_MESSAGE] = "مقدار كليد اصلي يا ايندكس تكراري است -- `email`, مقدار = " . $members->email->CurrentValue; $rsChk->Close(); return FALSE; } } if ($members->mobile->CurrentValue <> "") { // Check field with unique index $sFilter = "(`mobile` = '" . ew_AdjustSql($members->mobile->CurrentValue) . "')"; $rsChk = $members->LoadRs($sFilter); if ($rsChk && !$rsChk->EOF) { $_SESSION[EW_SESSION_MESSAGE] = "مقدار كليد اصلي يا ايندكس تكراري است -- `mobile`, مقدار = " . $members->mobile->CurrentValue; $rsChk->Close(); return FALSE; } } $rsnew = array(); // Field username $members->username->SetDbValueDef($members->username->CurrentValue, ""); $rsnew['username'] =& $members->username->DbValue; // Field password $members->password->SetDbValueDef($members->password->CurrentValue, ""); $rsnew['password'] =& $members->password->DbValue; // Field name $members->name->SetDbValueDef($members->name->CurrentValue, ""); $rsnew['name'] =& $members->name->DbValue; // Field lname $members->lname->SetDbValueDef($members->lname->CurrentValue, ""); $rsnew['lname'] =& $members->lname->DbValue; // Field fname $members->fname->SetDbValueDef($members->fname->CurrentValue, NULL); $rsnew['fname'] =& $members->fname->DbValue; // Field oldnid $members->oldnid->SetDbValueDef($members->oldnid->CurrentValue, NULL); $rsnew['oldnid'] =& $members->oldnid->DbValue; // Field newnid $members->newnid->SetDbValueDef($members->newnid->CurrentValue, NULL); $rsnew['newnid'] =& $members->newnid->DbValue; // Field gender $members->gender->SetDbValueDef($members->gender->CurrentValue, ""); $rsnew['gender'] =& $members->gender->DbValue; // Field marriage $members->marriage->SetDbValueDef($members->marriage->CurrentValue, NULL); $rsnew['marriage'] =& $members->marriage->DbValue; // Field birth_date $members->birth_date->SetDbValueDef($members->birth_date->CurrentValue, ew_CurrentDate()); $rsnew['birth_date'] =& $members->birth_date->DbValue; // Field birth_place $members->birth_place->SetDbValueDef($members->birth_place->CurrentValue, ""); $rsnew['birth_place'] =& $members->birth_place->DbValue; // Field sodour_place $members->sodour_place->SetDbValueDef($members->sodour_place->CurrentValue, ""); $rsnew['sodour_place'] =& $members->sodour_place->DbValue; // Field province $members->province->SetDbValueDef($members->province->CurrentValue, NULL); $rsnew['province'] =& $members->province->DbValue; // Field city $members->city->SetDbValueDef($members->city->CurrentValue, NULL); $rsnew['city'] =& $members->city->DbValue; // Field email $members->email->SetDbValueDef($members->email->CurrentValue, ""); $rsnew['email'] =& $members->email->DbValue; // Field website $members->website->SetDbValueDef($members->website->CurrentValue, NULL); $rsnew['website'] =& $members->website->DbValue; // Field address $members->address->SetDbValueDef($members->address->CurrentValue, ""); $rsnew['address'] =& $members->address->DbValue; // Field zip $members->zip->SetDbValueDef($members->zip->CurrentValue, 0); $rsnew['zip'] =& $members->zip->DbValue; // Field tel $members->tel->SetDbValueDef($members->tel->CurrentValue, ""); $rsnew['tel'] =& $members->tel->DbValue; // Field fax $members->fax->SetDbValueDef($members->fax->CurrentValue, NULL); $rsnew['fax'] =& $members->fax->DbValue; // Field mobile $members->mobile->SetDbValueDef($members->mobile->CurrentValue, NULL); $rsnew['mobile'] =& $members->mobile->DbValue; // Field photo $members->photo->Upload->SaveToSession(); // Save file value to Session if (is_null($members->photo->Upload->Value)) { $members->photo->Upload->DbValue = NULL; } else { $members->photo->Upload->DbValue = ew_UploadFileNameEx(ew_UploadPathEx(TRUE, EW_UPLOAD_DEST_PATH), $members->photo->Upload->FileName); } $rsnew['photo'] =& $members->photo->Upload->DbValue; // Field theme $members->theme->SetDbValueDef($members->theme->CurrentValue, NULL); $rsnew['theme'] =& $members->theme->DbValue; // Field homepage $members->homepage->SetDbValueDef($members->homepage->CurrentValue, NULL); $rsnew['homepage'] =& $members->homepage->DbValue; // Call Row Inserting event $bInsertRow = $members->Row_Inserting($rsnew); if ($bInsertRow) { // Field photo if (!is_null($members->photo->Upload->Value)) ew_SaveFile(ew_UploadPathEx(TRUE, EW_UPLOAD_DEST_PATH), $rsnew['photo'], $members->photo->Upload->Value); if ($members->photo->DbValue <> "") @unlink(ew_UploadPathEx(TRUE, EW_UPLOAD_DEST_PATH) . $members->photo->DbValue); $conn->raiseErrorFn = 'ew_ErrorFn'; $AddRow = $conn->Execute($members->InsertSQL($rsnew)); $conn->raiseErrorFn = ''; } else { if ($members->CancelMessage <> "") { $_SESSION[EW_SESSION_MESSAGE] = $members->CancelMessage; $members->CancelMessage = ""; } else { $_SESSION[EW_SESSION_MESSAGE] = "انصراف از افزودن"; } $AddRow = FALSE; } if ($AddRow) { $members->id->setDbValue($conn->Insert_ID()); $rsnew['id'] =& $members->id->DbValue; // Call Row Inserted event $members->Row_Inserted($rsnew); WriteAuditTrailOnAdd($rsnew); } // Field photo $members->photo->Upload->RemoveFromSession(); // Remove file value from Session return $AddRow; } ?> "") $key .= EW_COMPOSITE_KEY_SEPARATOR; $key .= $rs['id']; // Write Audit Trail $filePfx = "log"; $curDate = krfdate(); $curTime = date("H:i:s"); $id = ew_ScriptName(); $user = CurrentUserID(); $action = "A"; $oldvalue = ""; foreach (array_keys($rs) as $fldname) { if ($members->fields[$fldname]->FldDataType <> EW_DATATYPE_BLOB) { // Ignore Blob Field $newvalue = ($members->fields[$fldname]->FldDataType == EW_DATATYPE_MEMO) ? "" : $rs[$fldname]; // Memo Field ew_WriteAuditTrail($filePfx, $curDate, $curTime, $id, $user, $action, $table, $fldname, $key, $oldvalue, $newvalue); } } } ?>