Some code that doesn't work, who can help?
Posted: Thu Jun 06, 2002 3:53 am
Why doesn't this code work?
We expect the fault is to be found between line 26 and 45!
This is the PGP code inside the PHP.
We are using Xitami webserver on Linux, PHP 4, PGP Freeware 7.0.3
We are using Flash MX to execute this script
If someone can help us, that would be great!
Cause I'm really stuck!
--------------------------------------------------------------------------------------
1 <?
2
3 /******************************************************
4 ** Provided by
5 ** http://gandalf.xs4all.nl
6 **
7 *******************************************************/
8
9 // Enter your email address here
10 $adminaddress = "rutger@gandalf.xs4all.nl";
11
12 // Enter the address of your website here MUST include http://www.
13 $siteaddress ="http://www.juwelier-oorebeek.nl";
14
15 // Enter your company name or site name here
16 $sitename = "Het JuweliersHuis Ed Oorebeek";
17
18 // Gets the date and time from your server
19 $date = date("m/d/Y H:i:s");
20
21 // Gets the IP Address
22 if ($REMOTE_ADDR == "") $ip = "no ip";
23 else $ip = getHostByAddr($REMOTE_ADDR);
24
25
26 function pgp_encrypt($keyring_location, $public_key_id, $plain_text) {
27
28 $key_id = EscapeShellArg($public_key_id);
29 putenv("PGPPATH=$keyring_location");
30
31 // encrypt the message
32 $pipe = popen("pgpe -r $key_id -af", "r");
33
34 fwrite($pipe, $plain_text);
35 $encrypted_text = '';
36 while($s = fgets($pipe, 1024)) {
37 // read from the pipe
38 $encrypted_text .= $s;
39 }
40 pclose($pipe);
41
42 return $encrypted_text;
43 }
44
45 $Nummer = pgp_encrypt("/webpages/locationharddisk", "to@domain.com", $Nummer);
46
47 //Process the form data!
48 // and send the information collected in the Flash form to Your nominated email address
49 IF ($action != ""):
50 mail("$adminaddress","Occasion klant via internet",
51 "$sitename \n
52 Voornaam: $fname
53 Achternaam: $lname
54 Creditkaart nr.: $Nummer
55 Op naam van: $kaartnaam
56 Verloop datum:
57 Maand: $maand
58 Jaar: $jaar
59 E-mail: $vemail
60 Artikelnr: $cname
61 Telefoonnr: $telno
62 Adres: $fadres
63 Postcode: $fpostcode
64 Woonplaats: $fplaats
65
66 Opmerking van de bezoeker:
67 ------------------------------
68 $comments
69 ------------------------------
70
71 Inlog Informatie :
72 ------------------------------
73 Using: $HTTP_USER_AGENT
74 Hostname: $ip
75 IP address: $REMOTE_ADDR
76 Date/Time: $date","FROM:$adminaddress");
77
78
79 //This sends a confirmation to your visitor
80 mail("$vemail","Dank u voor uw bezoek aan $sitename", "Geachte $fname,\n
81 Bedankt voor uw interesse in $sitename!\n
82 Uw order wordt zo spoedig mogelijk verwerkt.
83 Wij nemen contact met u op.\n
84 Met vriendelijke groeten,
85 $sitename
86 $siteaddress","FROM:$adminaddress");
87
88 //Confirmation is sent back to the Flash form that the process is complete
89 $sendresult = "Uw order is verzonden!";
90 $send_answer = "answer=";
91 $send_answer .= rawurlencode($sendresult);
92 echo "$send_answer";
93
94 ENDIF;
95 ?>
--------------------------------------------------------------------------------------
We expect the fault is to be found between line 26 and 45!
This is the PGP code inside the PHP.
We are using Xitami webserver on Linux, PHP 4, PGP Freeware 7.0.3
We are using Flash MX to execute this script
If someone can help us, that would be great!
Cause I'm really stuck!
--------------------------------------------------------------------------------------
1 <?
2
3 /******************************************************
4 ** Provided by
5 ** http://gandalf.xs4all.nl
6 **
7 *******************************************************/
8
9 // Enter your email address here
10 $adminaddress = "rutger@gandalf.xs4all.nl";
11
12 // Enter the address of your website here MUST include http://www.
13 $siteaddress ="http://www.juwelier-oorebeek.nl";
14
15 // Enter your company name or site name here
16 $sitename = "Het JuweliersHuis Ed Oorebeek";
17
18 // Gets the date and time from your server
19 $date = date("m/d/Y H:i:s");
20
21 // Gets the IP Address
22 if ($REMOTE_ADDR == "") $ip = "no ip";
23 else $ip = getHostByAddr($REMOTE_ADDR);
24
25
26 function pgp_encrypt($keyring_location, $public_key_id, $plain_text) {
27
28 $key_id = EscapeShellArg($public_key_id);
29 putenv("PGPPATH=$keyring_location");
30
31 // encrypt the message
32 $pipe = popen("pgpe -r $key_id -af", "r");
33
34 fwrite($pipe, $plain_text);
35 $encrypted_text = '';
36 while($s = fgets($pipe, 1024)) {
37 // read from the pipe
38 $encrypted_text .= $s;
39 }
40 pclose($pipe);
41
42 return $encrypted_text;
43 }
44
45 $Nummer = pgp_encrypt("/webpages/locationharddisk", "to@domain.com", $Nummer);
46
47 //Process the form data!
48 // and send the information collected in the Flash form to Your nominated email address
49 IF ($action != ""):
50 mail("$adminaddress","Occasion klant via internet",
51 "$sitename \n
52 Voornaam: $fname
53 Achternaam: $lname
54 Creditkaart nr.: $Nummer
55 Op naam van: $kaartnaam
56 Verloop datum:
57 Maand: $maand
58 Jaar: $jaar
59 E-mail: $vemail
60 Artikelnr: $cname
61 Telefoonnr: $telno
62 Adres: $fadres
63 Postcode: $fpostcode
64 Woonplaats: $fplaats
65
66 Opmerking van de bezoeker:
67 ------------------------------
68 $comments
69 ------------------------------
70
71 Inlog Informatie :
72 ------------------------------
73 Using: $HTTP_USER_AGENT
74 Hostname: $ip
75 IP address: $REMOTE_ADDR
76 Date/Time: $date","FROM:$adminaddress");
77
78
79 //This sends a confirmation to your visitor
80 mail("$vemail","Dank u voor uw bezoek aan $sitename", "Geachte $fname,\n
81 Bedankt voor uw interesse in $sitename!\n
82 Uw order wordt zo spoedig mogelijk verwerkt.
83 Wij nemen contact met u op.\n
84 Met vriendelijke groeten,
85 $sitename
86 $siteaddress","FROM:$adminaddress");
87
88 //Confirmation is sent back to the Flash form that the process is complete
89 $sendresult = "Uw order is verzonden!";
90 $send_answer = "answer=";
91 $send_answer .= rawurlencode($sendresult);
92 echo "$send_answer";
93
94 ENDIF;
95 ?>
--------------------------------------------------------------------------------------