Home > Back-end >  Questions about use idhttp submit dedecms backstage
Questions about use idhttp submit dedecms backstage

Time:10-08

I use the following code to form submission dedecms website backstage:
 
Sl. The Add (' gotopage=/'+ Edit59. Text +'/index. PHP ');
Sl. The Add (' dopost=login ');
Sl. The Add (' adminstyle=newdedecms');
Sl. The Add (' userid='+ Edit57. Text);
Sl. The Add (' PWD='+ Edit58. Text);
Sl. The Add (sm1 '=');
S:=dgHTTP. Post (' http://'+ txtWWW. Lines [I] +'/dede/login. PHP ', sl);
If pos (' successful login 's) & gt; 0 then
The begin
//login success came in here! Execute the following code returns when landing interface code
S:=dgHTTP. Get (' http://localhost/dede/index.php ');
Here s return code and landing interface, don't know what reason be?


, return to log in successfully after the POST, but after log in successfully, and Get back home, return code is landing interface, feel like cookies did not remember, but have set up: dgHTTP. AllowCookies:=true;
Use the code below to reset the cookies also not line:
 
SCookie:=';
For k:=0 to dgHTTP. Response. RawHeaders. Do the Count - 1
The begin
If UpperCase (Copy (dgHTTP. Response. RawHeaders [k], 1, 10))='SET - cookies then
The begin
SCookieTmp:=Trim (Copy (dgHTTP. Response. RawHeaders [k], 12, MAXINT));
SCookieTmp:=Copy (sCookieTmp, 1, Pos ('; ', sCookieTmp) - 1);
SCookie:=sCookie + sCookieTmp + '; ';
end;
end;
SCookie:=sCookie + 'menuitems=1 _1, 2 _1, 3 _1. ';
DgHTTP. Request. CustomHeaders. The Add (+ sCookie cookies:);


CodePudding user response:

Login successful code:
 


DedeCMS prompt information & lt;/title> <br/><meta HTTP - equiv="content-type" Content="text/HTML. Charset=gb2312 "/& gt; <br/><Base target='love/& gt; <br/><style> Div {line - height: 160%; }</style> </head> <br/><='0' body leftmargin topmargin='0' bgcolor='# FFFFFF' & gt; <br/><Center> <br/><script> <br/>Var pgo=0; <br/>The function JumpUrl () {<br/>If (pgo==0) {location='/dede/index. PHP'; Pgo=1; } <br/>} <br/>Document. Write (" & lt; Br/& gt; <Div style="width: 450 px; Padding: 0 px; Border: # 1 px solid DADADA; '> <Div style='padding: 6 px; font-size:12px; Border - bottom: 1 px solid # DADADA; Background: # DBEEBD url (/plus/img/WBG. GIF) '; '> <B> DedeCMS prompt information! </b> </div>" ); <br/>Document. Write (" & lt; Div style='height: 130 px; The font - size: 10 pt; Background: # FFFFFF '& gt; <Br/& gt;" ); <br/>Document. Write (" a successful login, are turning to management management homepage!" ); <br/>Document. Write (" & lt; Br/& gt; <A href='https://bbs.csdn.net/dede/index.php' & gt; If your browser have no reaction, please click here... </a> <Br/& gt; </div>" ); <br/>SetTimeout (' JumpUrl () ', 1000); </script> <br/></center> <br/></body> <br/></html> <br/></pre> <br/><br/><br/>And then request the background main interface code: <br/><pre> <br/><! PUBLIC DOCTYPE HTML "-////W3C DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" & gt; <br/><html xmlns="http://www.w3.org/1999/xhtml"> <br/><head> <br/><meta HTTP - equiv="content-type" Content="text/HTML. Charset=gb2312 "& gt; <br/><title> Weave the dream content management system V57_GBK_SP1 & lt;/title> <br/><The link href="https://bbs.csdn.net/topics/css/base.css" rel="stylesheet" type="text/CSS"/& gt; <br/><The link href="https://bbs.csdn.net/topics/css/login.css" rel="stylesheet" type="text/CSS"/& gt; <br/><script SRC="https://bbs.csdn.net/include/js/jquery/jquery.js" language="javascript" type="text/javascript" & gt; </script> <br/><The script type="text/javascript" & gt; <br/>$=jQuery; <br/>The function changeAuthCode () {<br/>Var num=new Date (). GetTime (); <br/>Var rand=Math. Round (Math. The random () * 10000); <br/>Num=num + rand. <br/>$(' # ver_code). CSS (' visibility ', 'visible'); <br/>If ($(" # vdimgck ") [0]) {<br/>$(" # vdimgck ") [0]. SRC="https://bbs.csdn.net/include/vdimgck.php? The tag="+ num. <br/>} <br/>return false; <br/>} <br/></script> <br/></head> <br/><body> <br/><Div id="login - box" & gt; <br/><Div & gt; <A href="https://bbs.csdn.net/index.php" target="_blank" title="return to the home page" & gt; Return to homepage & lt;/a> </div> <br/><Div class='safe - tips & gt; Your management directory contains the name of the default name dede, suggest to modify it as other name in the FTP, would that be more safe! </div> <Div & gt; <br/><The form name="form1" method="post" action="login. PHP & gt;" <br/><Input type="hidden" name="gotopage" value="https://bbs.csdn.net/dede/index.php"/& gt; <br/><Input type="hidden" name="dopost" value="https://bbs.csdn.net/topics/login"/& gt; <br/><Input name='adminstyle type="hidden" value=' https://bbs.csdn.net/topics/newdedecms'/& gt; <br/><Dl> <br/><Dt> User name: & lt;/dt> <br/><Dd> <Input type="text" name="userid"/& gt; </dd> <br/><Dt> Compact & amp; nbsp; & nbsp; Code: & lt;/dt> <br/><Dd> <Input type="password" name="PWD"/& gt; </dd> <br/><Dt> & nbsp; </dt> <br/><Dd> <The button type="submit" name="sm1" onclick=". This form. Submit ();"> Login & lt;/button> </dd> <br/></dl> <br/></form> <br/></div> <br/><Div & gt; Powered by<A href="http://www.dedecms.com" title="DedeCMS website" & gt; <Strong> DedeCMSV57_GBK_SP1 & lt;/strong> </a> & Copy; 2004-2011 & lt; A href="http://www.desdev.cn" target="_blank" & gt; DesDev</a> Inc., & lt;/div> <br/></div> <br/><Div & gt; <Loginad iframe name="" SRC=" https://bbs.csdn.net/topics/login.php? nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/Backend/56854.html" target="_blank" style="color:#999">https//www.codepudding.com/Backend/56854.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/Backend/56853.html'>Delphi Xe3 development in Mac OSX</a></div> <div class="detail-arr-right">Next:<a href='/Backend/56855.html'>Seek expert help, Delphi run SetEntriesInAcl function error problem</a></div> </div> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="hot-tags neitags"> <ul> <li><i class="iconfont icon-x-tags"></i> Tags:  </li> <a href='/e/tags/?tagname=Network+communication%2Fdistributed+development' target='_blank'>Network communication/distributed development</a> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="xiangguan"> <ul class="msg msghead"> <li class="tbname">Related</li> </ul> <ul> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="flinks"> <ul> <li><i class="iconfont icon-x-tags"></i> Links:  </li> <li class="liflinks"><a target="_blank" href="/" title="CodePudding">CodePudding</a></li> </ul> </div> </div> </div> </div> <div class="footer"> <p><span style="font-size:16px;color:#666;font-weight: bold">About Us:</span>  <a href="https://www.codepudding.com/contact.html">Contact Us</a>      <a href="https://www.codepudding.com/service.html">Terms of Service</a>      <a href="https://www.codepudding.com/privacy.html"> Privacy Policy</a></p> <p class="foot_info">Copyright © 2010-2023,Powered By <a href="/" target="_blank">CodePudding</a> </p> </div> <script type="text/javascript" src="/skin/code/tianhu.js"></script> </body></html>