普通网友 2015-01-20 03:55
浏览 30

没有刷新寄存器表格

Closed. This question needs to be more focused. It is not currently accepting answers.
                </div>
            </div>
        </div>
                <hr class="my12 outline-none baw0 bb bc-powder-2">
            <div class="grid fw-nowrap fc-black-600">
                    <div class="grid--cell mr8">
                        <svg aria-hidden="true" class="svg-icon iconLightbulb" width="18" height="18" viewbox="0 0 18 18"><path d="M9.5.5a.5.5 0 0 0-1 0v.25a.5.5 0 0 0 1 0V.5zm5.6 2.1a.5.5 0 0 0-.7-.7l-.25.25a.5.5 0 0 0 .7.7l.25-.25zM1 7.5c0-.28.22-.5.5-.5H2a.5.5 0 0 1 0 1h-.5a.5.5 0 0 1-.5-.5zm14.5 0c0-.28.22-.5.5-.5h.5a.5.5 0 0 1 0 1H16a.5.5 0 0 1-.5-.5zM2.9 1.9c.2-.2.5-.2.7 0l.25.25a.5.5 0 1 1-.7.7L2.9 2.6a.5.5 0 0 1 0-.7z" fill-opacity=".4"></path><path opacity=".4" d="M7 16h4v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1v-1z" fill="#3F3F3F"></path><path d="M15 8a6 6 0 0 1-3.5 5.46V14a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1v-.54A6 6 0 1 1 15 8zm-4.15-3.85a.5.5 0 0 0-.7.7l2 2a.5.5 0 0 0 .7-.7l-2-2z" fill="#FFC166"></path></svg>
                    </div>
                <div class="grid--cell lh-md">
                    <p class="mb0">
                        <b>Want to improve this question?</b> Update the question so it focuses on one problem only by <a href="/posts/28037516/edit">editing this post</a>.
                    </p>
                    <p class="mb0 mt6">Closed <span title="2015-01-20 07:28:47Z" class="relativetime">5 years ago</span>.</p>
                </div>
            </div>
    </aside>

I have created a registration form and it works my only issues is I want to be able to hide the post info in the url if you click submit and the validation fails it does this

register.php?action=signup

is there a mod rewrite for this? so that the url remains

register.php

removing the ?action=signup

I have searched every where but have came up with nothing

php code for register page

                        <?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 * 

" .
                            "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>
";
                    }
                    $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


                    ?>
</div>
  • 写回答

1条回答 默认 最新

  • weixin_33720956 2015-01-20 04:00
    关注

    You can submit the information via POST. The way you are submitting the data across is from a GET HTTP request. The best thing to do is submit it over via post data. I am assuming your frontend call is using ajax for the form submission? if not and using a simple form change method to POST. If it is using ajax, I would need to know if you are using something like jquery or crafting the XHR request yourself, but if you are doing it that way I would assume you would know the difference.

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

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀