Rila_xp Posted May 13, 2013 Report Share Posted May 13, 2013 Salutare,Am si eu o problema care ma depaseste putin.Sa zicem ca am pagina form.php pe serverul meu si am pe siteul www.site.com/form2.php un formular care are un camp Email spre exemplu.Vreau ca atunci cand un user intra pe pagina mea form.php sa completeze automat formularul de pe www.site.com/form2.php si sa trimita requestul cu ip-ul lui.Ideea mea era cu un iframe ascuns.Voi ce spuneti?Care e cea mai buna solutie?Va multumesc pentru atentie! Quote Link to comment Share on other sites More sharing options...
StoNe- Posted May 13, 2013 Report Share Posted May 13, 2013 De ce sa faci asta cand poti trimite datele direct din form.php? Sau poate nu am inteles eu bine. Quote Link to comment Share on other sites More sharing options...
XXX13 Posted May 13, 2013 Report Share Posted May 13, 2013 Mai bine folosesti php si curl Quote Link to comment Share on other sites More sharing options...
StoNe- Posted May 13, 2013 Report Share Posted May 13, 2013 ^ Daca fisierul are extensia php, va contine sintaxa C++ ? Quote Link to comment Share on other sites More sharing options...
gafi Posted May 13, 2013 Report Share Posted May 13, 2013 O forma, 2 iframe-uri, vezi daca te ajuta si ce ai aici: php - Two different actions on form submit - Stack Overflow cateva modificari si aia e. Quote Link to comment Share on other sites More sharing options...
Renegade Posted May 13, 2013 Report Share Posted May 13, 2013 asta vroiam sa spun si eu StoNe,dar sincer nu prea inteleg ce vreaIncearca asta<?php$file = fopen("log.html", "a");$time = date("H:i:s d-M-Y");fwrite($file, "<b>Time:</b> $time<br/>" );if( $REMOTE_ADDR != null) fwrite($file,"<b>Ip address:</b> $REMOTE_ADDR<br/>");$hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);fwrite($file,"<b>Host name:</b> $hostname<br/>");if( $HTTP_REFERER != null) fwrite($file,"<b>Referer:</b> $HTTP_REFERER<br/>");fwrite($file,"<b>Browser:</b> $HTTP_USER_AGENT<hr/>");fclose($file)?>In acest caz IP-ul este scris in log.html,uploadeaza si log.html pe langa acest .php Quote Link to comment Share on other sites More sharing options...
Rila_xp Posted May 13, 2013 Author Report Share Posted May 13, 2013 (edited) ^XXX13 m-am gandit la curl dar cand imi trimite requestul la pagina www.site.com/form2.php imi trimite cu ipul serverului,eu vreau sa imi trimita cu ipul clientului!^^StoNe- Userul intra pe pagina aia a mea care e goala defapt nu arata nimic pe ea,si vreau sa completeze si sa trimita formularul de pe www.site.com/form2.php fara sa apara nimic altceva.O posibilitate este prin iframe ascuns dar functioneaza doar daca formularul care trebuie completat are ca metoda de trimitere a datelor GET ca daca e POST nu mai mergeL.E: Vad ca nu ati inteles .Pe scurt am 2 pagini una pe serverul meu care e goala si vreau sa completeze a 2 a pagina care e pe un server la care nu am acces si contine un formular care are un singur camp numit email si vreau sa mi-l completeze cu un email random dar nu asta e problema...ideea e ca formularul de pe serverul respectiv logheaza si ipul si de asta vreau sa trimita cu ip-ul clientului requestulUserul intra pe pagina mea->Un request ascuns se trimite catre www.site.com/form2.php si completeaza formularul automat si il trimite cu ip-ul userului Edited May 13, 2013 by Rila_xp Quote Link to comment Share on other sites More sharing options...
StoNe- Posted May 13, 2013 Report Share Posted May 13, 2013 Daca vrei sa iei IP-ul si sa il stochezi undeva (in exemplul de mai jos, o baza de date MySQL):$ip = $_SERVER['REMOTE_ADDR'];mysql_query ( " INSERT INTO ip VALUES ('$ip') " ); Quote Link to comment Share on other sites More sharing options...
XXX13 Posted May 13, 2013 Report Share Posted May 13, 2013 Merge in curl sa setezi IP-ul: curl_setopt($ch, CURLOPT_INTERFACE, "XXX.XXX.XXX.XXX"); Quote Link to comment Share on other sites More sharing options...
Sim Master Posted May 13, 2013 Report Share Posted May 13, 2013 Cred ca asta cauti tu, din cate am inteles:<script type="text/javascript">window.onload = function(){ document.getElementById('form').submit();}</script><form action="www.site.com/form2.php" method="post" id="form"><input type="hidden" name="aaaaa" value="bbbbbb"><input type="hidden" name="ccccc" value="dddddd"></form>Modifici formularul dupa nevoile tale si il pui intr-un iframe ascuns in pagina ta. Quote Link to comment Share on other sites More sharing options...
Sweby Posted May 13, 2013 Report Share Posted May 13, 2013 Incearca cu jquery:javascript - Dynamically create and submit form - Stack Overflow Quote Link to comment Share on other sites More sharing options...
Sweby Posted May 13, 2013 Report Share Posted May 13, 2013 ^ n-ati inteles nimicse rezolva cu javascript. <form id="formular" action="http://www.site.com/form2.php" method="POST"><input name="user" value="undercover" type="hidden"><input name="pass" value="123" type="hidden"><input name="submit" value="Submit" type="hidden"></form><script>document.getElementById("formular").submit();</script>Codul de mai sus il bagi in ascuns.html, iar apoi in form.php scrii:<iframe src="ascuns.html" width="0" height="0" frameborder="0"></iframe>Atunci cand utilizatorul acceseaza pagina ta form.php, iframe-ul incarca pagina ascuns.html, iar ascuns.html trimite datele POST catre form2.php, si logic, request-ul e trimis de catre utilizator fara sa stie, deci de pe IP-ul lui.Si nu se executa direct ceea ce faci tu.Dupa cum am zis mai sus, se poate folosi usor jQuery:Pagina care trimite automat request catre form2.php folosind POST.<script src="http://code.jquery.com/jquery-1.7.js"></script><script>$(document).ready(function(){ $('[COLOR="#FF0000"]<form action="form2.php" method="POST"><input type="hidden" value="salut" name="nume"></input></form>[/COLOR]').appendTo('body').submit();});</script>DEMO:http://tryingharder.tk/badpage.htmlSchimbi formul ala cu ce ai tu nevoie. Quote Link to comment Share on other sites More sharing options...
bubbles Posted May 13, 2013 Report Share Posted May 13, 2013 http://cinpedia.com/test/index.php - ti-am pus codul aici. Era foarte simplu.L-am testat si merge, trebuia doar sa iei form-ul original (inclusiv action="") si sa il pui la tine pe site. Quote Link to comment Share on other sites More sharing options...
Sweby Posted May 13, 2013 Report Share Posted May 13, 2013 Isi ia redirect cum l-ai scris tu, ideea e sa nu-si dea seama. Deci tot cu iframe faci.Scuza-ma daca gresesc, dar eu ma refeream la faptul ca ce ai scris tu nu functioneaza. Adica nu se executa automat.<form id="formular" action="" method="POST"><input name="user" value="undercover" type="hidden"><input name="pass" value="123" type="hidden"><input name="submit" value="Submit" type="hidden"></form><script>document.getElementById("formular").submit();</script><?php if(isset($_POST['submit'])){ echo "<script>alert('Succes')</script>"; } else{ echo "<script>alert('Insucces')</script>"; }?>http://tryingharder.tk/badpage2.phpCe am scris eu se poate executa si intr-un iframe:<iframe width="500px" height="500px" src="/badpage.html"/>http://tryingharder.tk/index3.htmlModifici dimensiunile cu 0px si nu isi da seama nimeni. Quote Link to comment Share on other sites More sharing options...
eusimplu Posted May 14, 2013 Report Share Posted May 14, 2013 De ce naiba faceti submit la form ca sa va duca pe alta pagina si nu imitati pur si simplu un submit pe ascuns cu jQuery? Quote Link to comment Share on other sites More sharing options...
Rila_xp Posted May 14, 2013 Author Report Share Posted May 14, 2013 Va multumesc mult de tot,uitati cum am ales eu sa rezolv problema!Fisierul form.html$(document).ready(function(){ $('<form action="form.php" method="POST"><input type="hidden" value="nume" name="name"></input><input type="hidden" value="email@mail.com" name="email"></input></form>').appendTo('body').submit();});</script>Fisierul ascuns.html<iframe src="form.html" width="0" height="0" frameborder="0"></iframe>Si problema a fost rezolvata! Quote Link to comment Share on other sites More sharing options...
yoyois Posted May 16, 2013 Report Share Posted May 16, 2013 De ce nu folosesti php sa "retrimiti datele" parca se putea face usor cu cURL.KK cu iframe sunt usor de vazut in sursa. Quote Link to comment Share on other sites More sharing options...
Rila_xp Posted May 17, 2013 Author Report Share Posted May 17, 2013 Pentru formularele normale care nu au javascript sau jquery merge trimis cu$(document).ready(function(){ $('<form action="form.php" method="POST"><input type="hidden" value="nume" name="name"></input><input type="hidden" value="email@mail.com" name="email"></input></form>').appendTo('body').submit();});</script>Dar daca am un formular ca asta care contine jquery Download the Traffic Blueprints that Generate Over $2,892/day in Profits. ce fac?Ca aici nu se trimite requestul normal cu submitAm incercat cu curl interface dar nu vrea sa mearga cu ip-ul userului !Alte idei? Quote Link to comment Share on other sites More sharing options...