Nicolas,

My mistake : Please read :

<form method=POST>

instead of <form method:POST>

on the following mail
--
Pierre Sahores
mobile : 06 03 95 77 70
www.sahores-conseil.com


Le 28 juil. 09 à 14:17, Pierre Sahores a écrit :

Nicolas,


Thank you Pierre, but I do not understand your example.

Where is the <?rev declaration?

How does the (rev?) function "sc_contact_report" get called? I see a
"contact_report", but no "sc_contact_report".

About the input type "submit", shouldn't there be a "<form
action="somefile.irev" method="post">" line somewhere?

Very confused...

--
Nicolas Cueto
Le 28 juil. 09 à 09:41, Pierre Sahores a écrit :


Hi Friends,

Nicolas,

You just need to insert a simple line of javascript in your "irev" script to call a "php" piece of code from it.

About a working example see : <http://www.woooooooords.com/contact.irev > where the reCAPTCHA part relies on 3 simple php sniplets and the rest of the page on irev.

In calling from a simple js snipplet directly inserted in your revTalk code the first php sniplet, you go outside of the rev loop of your process ; Then, the first php sniplet call the main php function (second php sniplet) you need to handle and have the return catched-back as your needed irev readable $_vars At this point, and it's up to you..., you can have a thirst php sniplet called from the second one, etc..., as long as you need to bind more php libs functions to the php part of your process.


Feel free to adapt the reCAPTCHA process working example as a starter point :


the irev form :


As usual, the <form method:POST> tag comes after the <body> tag of the page :



<link rel="stylesheet" type="text/css" href="Blog/ stylesheet_1.css" />

<fieldset>

<table>
<tr>
<td><label for="nom">Nom *</label></td>
<td><input class="textInput" type="text" name="nom" id="nom"></td>
</tr>
<tr>
<td><label for="entreprise">Entreprise *</label></td>
<td><input class="textInput" type="text" name="entreprise" id="entreprise"></td>
</tr>
<tr>
<td><label for="activite">Activité *</label></td>
<td><input class="textInput" type="text" name="activite" id="activite"></td>
</tr>
<tr>
<td><label for="adresse">Adresse</label></td>
<td><input class="textInput" type="text" name="adresse" id="adresse"></td>
</tr>
<tr>
<td><label for="ville">Ville</label></td>
<td><input class="textInput" type="text" name="ville" id="ville"></ td>
</tr>
<tr>
<td><label for="codepostal">Code postal</label></td>
<td><input class="textInput" type="text" name="codepostal" id="codepostal"></td>
</tr>
<tr>
<td><label for="email">Email *</label></td>
<td><input class="textInput" type="text" name="email" id="email"></ td>
</tr>     
<tr>
<td><label for="telephone">Téléphone *</label></td>
<td><input class="textInput" type="text" name="telephone" id="telephone"></td>
</tr>
<tr>
<td><label for="objet">Objet *</label></td>
<td><select size="1" name="objet" id="objet" style="font-size:11px; color:gray;">
<option selected>Choisir dans la liste</option>
<option value="in&#233;dits pour sites de jeux en ligne">lots inédits pour sites de jeux en ligne</option> <option value="in&#233;dits pour sites &agrave; vocation commerciale">lots inédits pour sites à vocation commerciale</option> <option value="in&#233;dits pour sites d'information">lots inédits pour sites d'information</option> <option value="in&#233;dits pour sites d'information locale">lots inédits pour sites d'information locale</option> <option value="in&#233;dits pour sites p&#233;dagogiques">lots inédits pour sites pédagogiques</option> <option value="in&#233;dits pour presse de jeux">lots inédits pour presse de jeux</option> <option value="in&#233;dits pour presse gratuite">lots inédits pour presse gratuite</option> <option value="in&#233;dits pour presse de loisirs">lots inédits pour presse de loisirs</option> <option value="in&#233;dits pour presse généraliste">lots inédits pour presse généraliste</option> <option value="in&#233;dits pour presse locale">lots inédits pour presse locale</option>
<option value="autre demande">autre demande</option>
</select></td>
</tr>     
<tr>
<td><label for="detail">Détail</label></td>
<td><textarea id="detail" name="detail" rows="3"></textarea></td>
</tr>
<tr><td colspan=2 height=20></td></tr>
<tr><td colspan=2 align=right>
<script type="text/javascript">include('./recaptchaloader.php')</ script>
</td></tr>
<tr><td colspan=2 height=12></td></tr>
<tr><td colspan=2 align=right>
<input type="submit" value="Envoyer" name="contact_report" class="bouton"> ## irev handled submit button
</td></tr></table>

</fieldset>

the </form> tag comes, as usual before the </body> tag

If you could'nt see them in my example, it's just because this one is only a component of the final page as you can see on the woooooooords.com site


the first .php sniplet used to bind the php $_vars to the irev handled submit button :

<?php

        require_once('recaptchatmp.php');
        
?>


the second .php sniplet :


<?php

require_once('recaptchalib.php');

// Get a key from http://recaptcha.net/api/getkey
$publickey = "your_revcaptcha_public_key_goes_there";
$privatekey = "your_revcaptcha_private_key_goes_there";

# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;

# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
      $resp = recaptcha_check_answer ($privatekey,
                                      $_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
}

echo recaptcha_get_html($publickey, $error);

?>


witch call the 'recaptchalib.php' as the thirst one, etc...


the submit button irev function handler


as this function is only a part of a .irev file witch centralise all the components of revTalk code used as the server's engine of the site, the example don't show that the <?rev is set on top of it alike this :

<?rev

function a
end a

function b
end b

function n
end n

etc...

until the sc_contact_report function code start line.

The sc_contact_report function is called by the submit button trought a main revTalk function witch read the $_vars incoming arrays to know how to dispatch the work in betwin all of the server side scripting functions available behind.


Hope to be a little less confusing ;-)

Don't hesite to ask more details off-list if needed.

Kind Regards,

Pierre


function sc_contact_report
        repeat for each key k in $_POST
if "lang_flag_mem" is not in k and "contact_report" is not in k and \ "recaptcha_challenge_field" is not in k and "recaptcha_response_field" is not in k
                then put k & ":" && $_POST[k] & cr & cr after aaa
        end repeat
        put $_POST[telephone] into phonectl
        filter phonectl with "*[0-9]*"
if $_POST[nom] is "" or $_POST[entreprise] is "" or $_POST[activite] is "" or phonectl is "" \
                or "@" is not in $_POST[email] or $_POST[objet] is ""
        then return "<fieldset class=contact><table>" & \
sc_info_alert2("Merci de renseigner l'ensemble des champs suivis du caract&#232;re" && quote & "*" & quote && \
                "avant de poursuivre.<br><br><br>") & "</table></fieldset>" & \
                "<table><tr><td height=40></td></tr></table>"
else if the num of words in $_POST[recaptcha_response_field] is not "2"
        then return "<fieldset class=contact><table>" & \
sc_info_alert2("Merci de raffraichir et de compl&#233;ter le challenge" && quote & "reCAPTCHA" & quote && \
                "avant de poursuivre.<br><br><br>") & "</table></fieldset>" & \
                "<table><tr><td height=40></td></tr></table>"
        else
set httpheaders to "Content-Type: application/x-www-form- urlencoded" & cr & cr
                post ("privatekey=your_revcaptcha_private_key_goes_there" & \
"&remoteip=" & $_server[remote_addr] & "&challenge=" & $_POST[recaptcha_challenge_field] & \ "&response=" & $_POST[recaptcha_response_field]) to url "http://api-verify.recaptcha.net/verify "
                if "true" is in it and "success" is in it then
get mail("s...@woooooooords.com","[CONTACT] Demande d'information services WOOOOOOOORDS.COM... [CONTACT]",aaa,"s...@woooooooords.com")
                        return "<fieldset class=contact><table>" & \
sc_info_alert("Cher(e)" && $_POST[nom] & ",<br><br>Votre demande d'information nous est bien parvenue." && \ "Elle sera examin&#233;e pour suites &agrave; donner sous 48h/ jours ouvrables.<br><br>Bien cordialement,<br><br>" & \ "Pierre-Jean Sahores<br>responsable de publication<br><br><br><br>",$_server[http_referer]) & "</table></ fieldset>" & \
                                "<table><tr><td height=40></td></tr></table>"
                else
                        return "<fieldset class=contact><table>" & \
sc_info_alert2("Merci de raffraichir et de compl&#233;ter le challenge" && quote & "reCAPTCHA" & quote && \
                                "avant de poursuivre.<br><br><br>") & 
"</table></fieldset>" & \
                                "<table><tr><td height=40></td></tr></table>"
                end if
        end if
end sc_contact_report



Hope this can help you to setup your irev driven php process

Kind Regards,

Pierre

--
Pierre Sahores
mobile : 06 03 95 77 70
www.sahores-conseil.com


Le 28 juil. 09 à 07:59, Bernard Devlin a écrit :

Years ago Pierre Sahores built an application server based on Rev. He used Apache/PHP as the front end, then used socket connections between
PHP and Rev so that a long-running Rev process could interact with
databases, and return the results via PHP to Apache.

There is a lot to recommend in his design.  He has a tutorial (in
french and english) here:
http://www2.sahores-conseil.com/insead/index_en.html

I can imagine you may not need the whole infrastructure he had in
mind, but getting the Apache/PHP/Rev stuff to work sounds like it
might be what you want, and from what I remember when I followed his
tutorial a couple of years ago, it was all straightforward.

Bernard

On Tue, Jul 28, 2009 at 4:07 AM, Nicolas Cueto<nicon...@gmail.com> wrote:
After much testing and frustation, I've discovered that the on-rev
server is unable to read the $_POST array when sent by WAP/WML- based
Japanese cellphones to an .irev script.

As a workaround, I've make a .php script that can read in $_POST. The
next step is using php to forward the $_POST data to an .irev or
rev-cgi script -- assuming of course that such a thing is possible.
But, I really want to avoid having to learn (any more!) php, so am
instead posting this somewhat off-topic request for help.

Has someone tried to use php to relay data to .irev/rev-cgi?

Thanks.

--
Nicolas Cueto
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution



--
Pierre Sahores
mobile : 06 03 95 77 70
www.sahores-conseil.com







_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to