不刷新登记表

No refresh register form

我已经创建了一个注册表单,它可以正常工作我唯一的问题是我希望能够在 url 中隐藏 post 信息,如果您单击提交并且验证失败,它会执行此操作

register.php?action=注册

是否有 mod 重写? 这样 url 仍然是

register.php

删除 ?action=signup

我找遍了所有地方,但一无所获

php 注册页面代码

                        <?php
                    //Error reporting @1-8F636958
                    error_reporting(E_ALL | E_STRICT);
                    //End Error reporting

                    //Include Common Files @1-EDC1CE42
                    define("RelativePath", ".");
                    define("PathToCurrentPage", "/");
                    define("FileName", "NewPage1.php");
                    include_once(RelativePath . "/Common.php");
                    include_once(RelativePath . "/Template.php");
                    include_once(RelativePath . "/Sorter.php");
                    include_once(RelativePath . "/Navigator.php");
                    //End Include Common Files

                    class clsRecordusers { //users Class @2-9BE1AF6F

                    //Variables @2-9E315808

                        // Public variables
                        public $ComponentType = "Record";
                        public $ComponentName;
                        public $Parent;
                        public $HTMLFormAction;
                        public $PressedButton;
                        public $Errors;
                        public $ErrorBlock;
                        public $FormSubmitted;
                        public $FormEnctype;
                        public $Visible;
                        public $IsEmpty;

                        public $CCSEvents = "";
                        public $CCSEventResult;

                        public $RelativePath = "";

                        public $InsertAllowed = false;
                        public $UpdateAllowed = false;
                        public $DeleteAllowed = false;
                        public $ReadAllowed   = false;
                        public $EditMode      = false;
                        public $ds;
                        public $DataSource;
                        public $ValidatingControls;
                        public $Controls;
                        public $Attributes;

                        // Class variables
                    //End Variables

                    //Class_Initialize Event @2-627C035C
                        function clsRecordusers($RelativePath, & $Parent)
                        {

                            global $FileName;
                            global $CCSLocales;
                            global $DefaultDateFormat;
                            $this->Visible = true;
                            $this->Parent = & $Parent;
                            $this->RelativePath = $RelativePath;
                            $this->Errors = new clsErrors();
                            $this->ErrorBlock = "Record users/Error";
                            $this->DataSource = new clsusersDataSource($this);
                            $this->ds = & $this->DataSource;
                            $this->InsertAllowed = true;
                            if($this->Visible)
                            {
                                $this->ComponentName = "users";
                                $this->Attributes = new clsAttributes($this->ComponentName . ":");
                                $CCSForm = explode(":", CCGetFromGet("ccsForm", ""), 2);
                                if(sizeof($CCSForm) == 1)
                                    $CCSForm[1] = "";
                                list($FormName, $FormMethod) = $CCSForm;
                                $this->EditMode = ($FormMethod == "Edit");
                                $this->FormEnctype = "application/x-www-form-urlencoded";
                                $this->FormSubmitted = ($FormName == $this->ComponentName);
                                $Method = $this->FormSubmitted ? ccsPost : ccsGet;
                                $this->btn_register = new clsButton("btn_register", $Method, $this);
                                $this->username = new clsControl(ccsTextBox, "username", "Soldier", ccsText, "", CCGetRequestParam("username", $Method, NULL), $this);
                                $this->username->Required = true;
                                $this->user_email = new clsControl(ccsTextBox, "user_email", "User Email", ccsText, "", CCGetRequestParam("user_email", $Method, NULL), $this);
                                $this->user_email->Required = true;
                                $this->user_birthdate = new clsControl(ccsTextBox, "user_birthdate", "User Birthdate", ccsText, "", CCGetRequestParam("user_birthdate", $Method, NULL), $this);
                                $this->user_birthdate->Required = true;
                            }
                        }
                    //End Class_Initialize Event

                    //Initialize Method @2-052CBF13
                        function Initialize()
                        {

                            if(!$this->Visible)
                                return;

                            $this->DataSource->Parameters["urluid"] = CCGetFromGet("uid", NULL);
                        }
                    //End Initialize Method

                    //Validate Method @2-B7C6592D
                        function Validate()
                        {
                            global $CCSLocales;
                            $Validation = true;
                            $Where = "";
                            $Validation = ($this->username->Validate() && $Validation);
                            $Validation = ($this->user_email->Validate() && $Validation);
                            $Validation = ($this->user_birthdate->Validate() && $Validation);
                            $this->CCSEventResult = CCGetEvent($this->CCSEvents, "OnValidate", $this);
                            $Validation =  $Validation && ($this->username->Errors->Count() == 0);
                            $Validation =  $Validation && ($this->user_email->Errors->Count() == 0);
                            $Validation =  $Validation && ($this->user_birthdate->Errors->Count() == 0);
                            return (($this->Errors->Count() == 0) && $Validation);
                        }
                    //End Validate Method

                    //CheckErrors Method @2-E8847328
                        function CheckErrors()
                        {
                            $errors = false;
                            $errors = ($errors || $this->username->Errors->Count());
                            $errors = ($errors || $this->user_email->Errors->Count());
                            $errors = ($errors || $this->user_birthdate->Errors->Count());
                            $errors = ($errors || $this->Errors->Count());
                            $errors = ($errors || $this->DataSource->Errors->Count());
                            return $errors;
                        }
                    //End CheckErrors Method

                    //Operation Method @2-6BA9892D
                        function Operation()
                        {
                            if(!$this->Visible)
                                return;

                            global $Redirect;
                            global $FileName;

                            $this->DataSource->Prepare();
                            if(!$this->FormSubmitted) {
                                $this->EditMode = $this->DataSource->AllParametersSet;
                                return;
                            }

                            if($this->FormSubmitted) {
                                $this->PressedButton = "btn_register";
                                if($this->btn_register->Pressed) {
                                    $this->PressedButton = "btn_register";
                                }
                            }
                            $Redirect = $FileName . "?" . CCGetQueryString("QueryString", array("ccsForm"));
                            if($this->Validate()) {
                                if($this->PressedButton == "btn_register") {
                                    if(!CCGetEvent($this->btn_register->CCSEvents, "OnClick", $this->btn_register) || !$this->InsertRow()) {
                                        $Redirect = "";
                                    }
                                }
                            } else {
                                $Redirect = "";
                            }
                            if ($Redirect)
                                $this->DataSource->close();
                        }
                    //End Operation Method

                    //InsertRow Method @2-C62BC29D
                        function InsertRow()
                        {
                            $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeInsert", $this);
                            if(!$this->InsertAllowed) return false;
                            $this->DataSource->username->SetValue($this->username->GetValue(true));
                            $this->DataSource->user_email->SetValue($this->user_email->GetValue(true));
                            $this->DataSource->user_birthdate->SetValue($this->user_birthdate->GetValue(true));
                            $this->DataSource->Insert();
                            $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterInsert", $this);
                            return (!$this->CheckErrors());
                        }
                    //End InsertRow Method

                    //Show Method @2-AE9867B3
                        function Show()
                        {
                            global $CCSUseAmp;
                            $Tpl = CCGetTemplate($this);
                            global $FileName;
                            global $CCSLocales;
                            $Error = "";

                            if(!$this->Visible)
                                return;

                            $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeSelect", $this);


                            $RecordBlock = "Record " . $this->ComponentName;
                            $ParentPath = $Tpl->block_path;
                            $Tpl->block_path = $ParentPath . "/" . $RecordBlock;
                            $this->EditMode = $this->EditMode && $this->ReadAllowed;
                            if($this->EditMode) {
                                if($this->DataSource->Errors->Count()){
                                    $this->Errors->AddErrors($this->DataSource->Errors);
                                    $this->DataSource->Errors->clear();
                                }
                                $this->DataSource->Open();
                                if($this->DataSource->Errors->Count() == 0 && $this->DataSource->next_record()) {
                                    $this->DataSource->SetValues();
                                    if(!$this->FormSubmitted){
                                        $this->username->SetValue($this->DataSource->username->GetValue());
                                        $this->user_email->SetValue($this->DataSource->user_email->GetValue());
                                        $this->user_birthdate->SetValue($this->DataSource->user_birthdate->GetValue());
                                    }
                                } else {
                                    $this->EditMode = false;
                                }
                            }

                            if($this->FormSubmitted || $this->CheckErrors()) {
                                $Error = "";
                                $Error = ComposeStrings($Error, $this->username->Errors->ToString());
                                $Error = ComposeStrings($Error, $this->user_email->Errors->ToString());
                                $Error = ComposeStrings($Error, $this->user_birthdate->Errors->ToString());
                                $Error = ComposeStrings($Error, $this->Errors->ToString());
                                $Error = ComposeStrings($Error, $this->DataSource->Errors->ToString());
                                $Tpl->SetVar("Error", $Error);
                                $Tpl->Parse("Error", false);
                            }
                            $CCSForm = $this->EditMode ? $this->ComponentName . ":" . "Edit" : $this->ComponentName;
                            $this->HTMLFormAction = $FileName . "?" . CCAddParam(CCGetQueryString("QueryString", ""), "ccsForm", $CCSForm);
                            $Tpl->SetVar("Action", !$CCSUseAmp ? $this->HTMLFormAction : str_replace("&", "&amp;", $this->HTMLFormAction));
                            $Tpl->SetVar("HTMLFormName", $this->ComponentName);
                            $Tpl->SetVar("HTMLFormEnctype", $this->FormEnctype);
                            $this->btn_register->Visible = !$this->EditMode && $this->InsertAllowed;

                            $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeShow", $this);
                            $this->Attributes->Show();
                            if(!$this->Visible) {
                                $Tpl->block_path = $ParentPath;
                                return;
                            }

                            $this->btn_register->Show();
                            $this->username->Show();
                            $this->user_email->Show();
                            $this->user_birthdate->Show();
                            $Tpl->parse();
                            $Tpl->block_path = $ParentPath;
                            $this->DataSource->close();
                        }
                    //End Show Method

                    } //End users Class @2-FCB6E20C

                    class clsusersDataSource extends clsDBlocalhost {  //usersDataSource Class @2-5EDEDCFF

                    //DataSource Variables @2-8A9D7D42
                        public $Parent = "";
                        public $CCSEvents = "";
                        public $CCSEventResult;
                        public $ErrorBlock;
                        public $CmdExecution;

                        public $InsertParameters;
                        public $wp;
                        public $AllParametersSet;

                        public $InsertFields = array();

                        // Datasource fields
                        public $username;
                        public $user_email;
                        public $user_birthdate;
                    //End DataSource Variables

                    //DataSourceClass_Initialize Event @2-56B8B1F7
                        function clsusersDataSource(& $Parent)
                        {
                            $this->Parent = & $Parent;
                            $this->ErrorBlock = "Record users/Error";
                            $this->Initialize();
                            $this->username = new clsField("username", ccsText, "");

                            $this->user_email = new clsField("user_email", ccsText, "");

                            $this->user_birthdate = new clsField("user_birthdate", ccsText, "");


                            $this->InsertFields["soldier"] = array("Name" => "soldier", "Value" => "", "DataType" => ccsText, "OmitIfEmpty" => 1);
                            $this->InsertFields["user_email"] = array("Name" => "user_email", "Value" => "", "DataType" => ccsText, "OmitIfEmpty" => 1);
                            $this->InsertFields["user_birthdate"] = array("Name" => "user_birthdate", "Value" => "", "DataType" => ccsText, "OmitIfEmpty" => 1);
                        }
                    //End DataSourceClass_Initialize Event

                    //Prepare Method @2-DC2F5FB8
                        function Prepare()
                        {
                            global $CCSLocales;
                            global $DefaultDateFormat;
                            $this->wp = new clsSQLParameters($this->ErrorBlock);
                            $this->wp->AddParameter("1", "urluid", ccsInteger, "", "", $this->Parameters["urluid"], "", false);
                            $this->AllParametersSet = $this->wp->AllParamsSet();
                            $this->wp->Criterion[1] = $this->wp->Operation(opEqual, "uid", $this->wp->GetDBValue("1"), $this->ToSQL($this->wp->GetDBValue("1"), ccsInteger),false);
                            $this->Where = 
                                 $this->wp->Criterion[1];
                        }
                    //End Prepare Method

                    //Open Method @2-B071412E
                        function Open()
                        {
                            $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildSelect", $this->Parent);
                            $this->SQL = "SELECT * \n\n" .
                            "FROM users {SQL_Where} {SQL_OrderBy}";
                            $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteSelect", $this->Parent);
                            $this->query(CCBuildSQL($this->SQL, $this->Where, $this->Order));
                            $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteSelect", $this->Parent);
                        }
                    //End Open Method

                    //SetValues Method @2-1C83BB75
                        function SetValues()
                        {
                            $this->username->SetDBValue($this->f("soldier"));
                            $this->user_email->SetDBValue($this->f("user_email"));
                            $this->user_birthdate->SetDBValue($this->f("user_birthdate"));
                        }
                    //End SetValues Method

                    //Insert Method @2-D2F97CD9
                        function Insert()
                        {
                            global $CCSLocales;
                            global $DefaultDateFormat;
                            $this->CmdExecution = true;
                            $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeBuildInsert", $this->Parent);
                            $this->InsertFields["soldier"]["Value"] = $this->username->GetDBValue(true);
                            $this->InsertFields["user_email"]["Value"] = $this->user_email->GetDBValue(true);
                            $this->InsertFields["user_birthdate"]["Value"] = $this->user_birthdate->GetDBValue(true);
                            $this->SQL = CCBuildInsert("users", $this->InsertFields, $this);
                            $this->CCSEventResult = CCGetEvent($this->CCSEvents, "BeforeExecuteInsert", $this->Parent);
                            if($this->Errors->Count() == 0 && $this->CmdExecution) {
                                $this->query($this->SQL);
                                $this->CCSEventResult = CCGetEvent($this->CCSEvents, "AfterExecuteInsert", $this->Parent);
                            }
                        }
                    //End Insert Method

                    } //End usersDataSource Class @2-FCB6E20C

                    //Initialize Page @1-2A4101A9
                    // Variables
                    $FileName = "";
                    $Redirect = "";
                    $Tpl = "";
                    $TemplateFileName = "";
                    $BlockToParse = "";
                    $ComponentName = "";
                    $Attributes = "";

                    // Events;
                    $CCSEvents = "";
                    $CCSEventResult = "";
                    $TemplateSource = "";

                    $FileName = FileName;
                    $Redirect = "";
                    $TemplateFileName = "NewPage1.html";
                    $BlockToParse = "main";
                    $TemplateEncoding = "UTF-8";
                    $ContentType = "text/html";
                    $PathToRoot = "./";
                    $PathToRootOpt = "";
                    $Scripts = "|";
                    $Charset = $Charset ? $Charset : "utf-8";
                    //End Initialize Page

                    //Before Initialize @1-E870CEBC
                    $CCSEventResult = CCGetEvent($CCSEvents, "BeforeInitialize", $MainPage);
                    //End Before Initialize

                    //Initialize Objects @1-1F103AC9
                    $DBlocalhost = new clsDBlocalhost();
                    $MainPage->Connections["localhost"] = & $DBlocalhost;
                    $Attributes = new clsAttributes("page:");
                    $Attributes->SetValue("pathToRoot", $PathToRoot);
                    $MainPage->Attributes = & $Attributes;

                    // Controls
                    $users = new clsRecordusers("", $MainPage);
                    $MainPage->users = & $users;
                    $users->Initialize();
                    $ScriptIncludes = "";
                    $SList = explode("|", $Scripts);
                    foreach ($SList as $Script) {
                        if ($Script != "") $ScriptIncludes = $ScriptIncludes . "<script src=\"" . $PathToRoot . $Script . "\" type=\"text/javascript\"></script>\n";
                    }
                    $Attributes->SetValue("scriptIncludes", $ScriptIncludes);

                    $CCSEventResult = CCGetEvent($CCSEvents, "AfterInitialize", $MainPage);

                    if ($Charset) {
                        header("Content-Type: " . $ContentType . "; charset=" . $Charset);
                    } else {
                        header("Content-Type: " . $ContentType);
                    }
                    //End Initialize Objects

                    //Initialize HTML Template @1-28F2FDD6
                    $CCSEventResult = CCGetEvent($CCSEvents, "OnInitializeView", $MainPage);
                    $Tpl = new clsTemplate($FileEncoding, $TemplateEncoding);
                    if (strlen($TemplateSource)) {
                        $Tpl->LoadTemplateFromStr($TemplateSource, $BlockToParse, "UTF-8");
                    } else {
                        $Tpl->LoadTemplate(PathToCurrentPage . $TemplateFileName, $BlockToParse, "UTF-8");
                    }
                    $Tpl->SetVar("CCS_PathToRoot", $PathToRoot);
                    $Tpl->block_path = "/$BlockToParse";
                    $CCSEventResult = CCGetEvent($CCSEvents, "BeforeShow", $MainPage);
                    $Attributes->SetValue("pathToRoot", "");
                    $Attributes->Show();
                    //End Initialize HTML Template

                    //Execute Components @1-0C9864E9
                    $users->Operation();
                    //End Execute Components

                    //Go to destination page @1-810C207B
                    if($Redirect)
                    {
                        $CCSEventResult = CCGetEvent($CCSEvents, "BeforeUnload", $MainPage);
                        $DBlocalhost->close();
                        header("Location: " . $Redirect);
                        unset($users);
                        unset($Tpl);
                        exit;
                    }
                    //End Go to destination page

                    //Show Page @1-E3A8594F
                    $users->Show();
                    $Tpl->block_path = "";
                    $Tpl->Parse($BlockToParse, false);
                    if (!isset($main_block)) $main_block = $Tpl->GetVar($BlockToParse);
                    $main_block = CCConvertEncoding($main_block, $FileEncoding,             $TemplateEncoding);
                    $CCSEventResult = CCGetEvent($CCSEvents, "BeforeOutput", $MainPage);
                    if ($CCSEventResult) echo $main_block;
                    //End Show Page

                    //Unload Page @1-4215F8E1
                    $CCSEventResult = CCGetEvent  ($CCSEvents, "BeforeUnload", $MainPage);
                    $DBlocalhost->close();
                    unset($users);
                    unset($Tpl);
                    //End Unload Page


                    ?>

您可以通过POST提交信息。您提交数据的方式来自 GET HTTP 请求。最好的办法是通过 post 数据提交。我假设您的前端调用使用 ajax 进行表单提交?如果不是,则使用简单的表单更改方法 POST。如果它使用 ajax,我需要知道您是在使用类似 jquery 的东西还是自己制作 XHR 请求,但如果您这样做,我想您会知道其中的区别。

<form action="action_page.php" method="POST">