Bunkertor 7 Posted May 17, 2007 Report Share Posted May 17, 2007 (edited) Heh... atkal es :) Taisu skriptu, kas automaatiski paraadaas katras lapas fuuterii un lauj nosuutiit URLu draugam. Gandriiz sanaak, bet tomeer nesanaak Kods, kas atrodas fuuterii: <?php $url = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; echo " <form name=\"form\" method=\"post\" action=\"mailer.php\">"; echo "<input type=\"text\" name=\"urla\" value=\"$url\" size=\"30\"><br>"; echo "<input type=\"text\" name=\"recip\" value=\"Friends Email\" size=\"30\"><br>"; echo "<input type=\"text\" name=\"name\" value=\"Your Name\" size=\"30\"><br>"; echo "<input type=\"text\" name=\"email\" value=\"Your Email\" size=\"30\"><br>"; echo "<input type=\"submit\" name=\"submit\" value=\"submit\" size=\"10\"><br>"; echo "</form>"; ?> Ideja taada, ka skripts iebaazh formaa to URL, uz kura patlaban atrodas. Shis skripts straadaa, tad jau laikam vaina ir ieksh mailer.php: <?php $to = $recip; $subject = "Click it, mate"; $message = "Your friend $name says you must visit: URL: $urla Friends E-mail: $email"; mail($to, $subject, $message, "From: $name <$email>\nX-Mailer: PHP/" . phpversion()); header( "location: [url=http://www.mylocation.com/thanx.php"]http://www.mylocation.com/thanx.php"[/url] ); ?> Nesaprotu, kaapeec mailer.php negrib savaakt field neimus un izmantot tos kaa variables. Kad izmantoju so mailer skriptu vienkaarsaakaa izpildiijumaa, lai nosuutiitu meilu pats sev (uz defineetu e-mail adresi nevis uz $recip) viss straadaa. Buusu pateiciigs par ieteikumiem! Edited May 17, 2007 by Bunkertor 7 Link to comment Share on other sites More sharing options...
andrisp Posted May 17, 2007 Report Share Posted May 17, 2007 1) CODE nevis CODEBOX 2) Kāda jēga no tik daudziem echo un nejēdzīgām pēdiņu eskeipošanām ? Raksti HTML kodu ārpus PHP. 3) Izmanto $_POST masīvu. Tur būs visi mainīgie no formas. Šobrīd tu paļaujies uz register_globals = On. Link to comment Share on other sites More sharing options...
Val Posted May 17, 2007 Report Share Posted May 17, 2007 sākumā nepieciešams $to = $_POST['recip']; $name = $_POST['name'] utt. Link to comment Share on other sites More sharing options...
cucumber Posted May 17, 2007 Report Share Posted May 17, 2007 Ne vienmer ir labi izdomat riteni"phpmailer" Link to comment Share on other sites More sharing options...
andrisp Posted May 17, 2007 Report Share Posted May 17, 2007 cucumber, ne vienmēr tur, kur var iztikt ar pāris savām rindiņām, vajag taisīt overheadu ar kaut kādu smagnēju klasi. ;) Link to comment Share on other sites More sharing options...
Bunkertor 7 Posted May 17, 2007 Author Report Share Posted May 17, 2007 Ne vienmer ir labi izdomat riteni"phpmailer" Cucumber, tu kad beernu taisiisi, arii mekleesi kaadu, kas tavaa vietaa uztaisa? a? Priekshkam tad smadzenes? Es tagad ar konsultantu paliidziibu to skriptu pabeidzu un juutu gandariijumu... anyway, andrisip un Val - Paldies!!! Tagad skripts izskatas ta: <?php $to = $_POST['recip']; $to2 = "me@mydomain.com"; $urla = $_POST['urla']; $name = $_POST['name']; $email = $_POST['email']; $subject = "Message From $name"; $message = "Your friend $name thinks this link: $urla could be of your interest. The mail address of your friend is $email We appologise if you receive this e-mail by mistake. We care about your privacy and assure you are not added to any mailing list."; mail($to, $subject, $message, "From: $name <$email>\nX-Mailer: PHP/" . phpversion()); mail($to2, $subject, $message, "From: $name <$email>\nX-Mailer: PHP/" . phpversion()); header( "location: http://www.mylocation.com/thanx.php" ); ?> Kaa redzams, tur ir iesleepts arii mans e-mails. Pilna kontrole - es tagad zinashu visu par visiem :D Link to comment Share on other sites More sharing options...
v3rb0 Posted May 17, 2007 Report Share Posted May 17, 2007 Cucumber, tu kad beernu taisiisi, arii mekleesi kaadu, kas tavaa vietaa uztaisa? a? Priekshkam tad smadzenes? Es tagad ar konsultantu paliidziibu to skriptu pabeidzu un juutu gandariijumu... tu bērnu ar konsultanu palīdzību taisīsi ;) pirmajā reizē varbūt baigais prieks ka mail() f-ja sūta mailu, bet pēc laiciņa tas apniks, un tad labāk izmantosi phpmaileri (it sevišķi, ja multipart messages, ar attačmentu) - priekš kam to visu copy/paste 100 un vienu reizi, ja ir gatavs libs?. pietiks ko noņemties ar to lai tavu mailu lielie webmaili neliek pie spama, nevis kāpēc pats mails nesūtās. Link to comment Share on other sites More sharing options...
cucumber Posted May 17, 2007 Report Share Posted May 17, 2007 to: Bunkertor Tapec jau uzrakstiju Ne vienmer ir labi . Nu nez cik no skolas atceros bernus ar smadznes netaisija, bija cita kermena dala. ps. Es damaju nevajag uzreizs ta visu pienemt tuvu pie sirds, runat preti bez mazvai dirst viru Link to comment Share on other sites More sharing options...
Bunkertor 7 Posted May 17, 2007 Author Report Share Posted May 17, 2007 ps. Es damaju nevajag uzreizs ta visu pienemt tuvu pie sirds, runat preti bez mazvai dirst viru Baac nu tak... sorry. Glubokij poklon & izvinenija... Pie mums Tambovaa vienkaarshi humors taads. Bet par to citu kermena dalu tu vareetu noprecizeet :P Link to comment Share on other sites More sharing options...
Recommended Posts