module dosnt work..........................

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   module dosnt work..........................
SidewinderX
CZ Super Newbie
SidewinderX has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Aug 06, 2004
0.01 posts per day
Posts: 39
Points: 1,333
   
i created a php form email module..before i converted it to module format it worked with no problem now i get "Sorry, such file doesn't exist..."

the module kind of works but when i submit the forum i get "Sorry, such file doesn't exist..." im thinking it has something to do with <? $PHP_SELF ?> but if it does i dont know how to fix it...any ideas? here is my code

<?php
if (!eregi("modules.php", $PHP_SELF)) {
   die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
include("header.php");
$index = 0;
OpenTable();
        if ($_POST)
        {
            $company = $_POST['company'];
            $name = $_POST['name'];
            $email = $_POST['email'];
         $domain = $_POST['domain'];
         $plan = $_POST['plan'];
         $payment = $_POST['payment'];

            $message = "Web service request from $name\n\nCompany: $company\n\n Name: $name\n\n Email $email\n\n Domain Name: $domain\n\n Plan: $plan\n\n Payment: $payment";

            mail("sidewinderx@optonline.net", "Web Service Requested", $message);

            include ("purchace.html");
        }
        else
        {

        ?>

        Order Copper Plan<br>Pay per month<br><br>
<?php include("copper.html"); ?><br>
        <form action="<? $PHP_SELF ?>" method="post">
      <table width="319" border="1">
      <tr>
       <td width="159">Company Name</td>
       <td width="144">
        <input type="test" name="company">
      </td>
      </tr>
        <tr>
       <td>*Contact Name</td>
       <td><input type="text" name="name"></td>
        </tr>
        <tr>
       <td>*Email Address</td>
       <td><input type="text" name="email"></td>
        </tr>
        <tr>
       <td>*Domain Name</td>
       <td><input type="text" name="domain"><br>
         <font size="-7">(google.com)</font></td>
        </tr>
      </table>
      <input type="hidden" name="plan" value="Copper">
      <input type="hidden" name="payment" value="Once a month">   
        <p><input type="submit" value="Send!" /></p>
        </form>
<?php
}
?>
<?php      
CloseTable();
include("footer.php");
?>



Back to top Reply with quote
#2   
Telli
Site Admin
Occupation: Self Employed
Age: 46
Gender: Male
Fav. Sports Team: Detroit Red Wings
Website:
Status: Offline
Joined: May 26, 2003
1.03 posts per day
Posts: 8089
Points: 494,430
   
Do you have inside of a folder in your modules directory? Is it named index.php? You can change the $PHP_SELF to modules.php?name=$module_name. Since it isnt inside a function you won't have to global it.




_________________
The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee. Ezekiel 25:17
Back to top Reply with quote
#3   re: module dosnt work..........................
SidewinderX
CZ Super Newbie
SidewinderX has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Aug 06, 2004
0.01 posts per day
Posts: 39
Points: 1,333
   
hm...i tried your suggestion and it still dont work. i changed up the code up a litle bit, i created two files

the form (modules.php?name=Plans&file=copper_plan_order)
<?php
if (!eregi("modules.php", $PHP_SELF)) {
   die ("You can't access this file directly...");

}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
include("header.php");
$index = 0;
OpenTable();
?>

Order Copper Plan<br>Pay per month<br><br>
<?php include("copper.html"); ?><br>
        <form action="modules.php?name=Mail" method="post">
      <table width="319" border="1">
      <tr>
       <td width="159">Company Name</td>
       <td width="144">
        <input type="test" name="company">
      </td>
      </tr>
        <tr>
       <td>*Contact Name</td>
       <td><input type="text" name="name"></td>
        </tr>
        <tr>
       <td>*Email Address</td>
       <td><input type="text" name="email"></td>
        </tr>
        <tr>
       <td>*Domain Name</td>
       <td><input type="text" name="domain"><br>
         <font size="-7">(google.com)</font></td>
        </tr>
      </table>
      <input type="hidden" name="plan" value="Copper">
      <input type="hidden" name="payment" value="Once a month">   
        <p><input type="submit" value="Send!" /></p>
        </form>
<?php      
CloseTable();
include("footer.php");
?>

and then the other file that does all the work which is (modules.php?name=Mail)
<?php
if (!eregi("modules.php", $PHP_SELF)) {
   die ("You can't access this file directly...");

}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
include("header.php");
$index = 0;
OpenTable();         
       
$company = $_POST['company'];
$name = $_POST['name'];
$email = $_POST['email'];
$domain = $_POST['domain'];
$plan = $_POST['plan'];
$payment = $_POST['payment'];

// Compose simple text message:
$message = "Web service request from $name\n\nCompany: $company\n\n Name: $name\n\n Email $email\n\n Domain Name: $domain\n\n Plan: $plan\n\n Payment: $payment";

// Send message to [ Register or login to view links on this board. ]
mail("sidewinderx@optonline.net", "Web Service Requested", $message);

// Thank the generous user
include ("purchace.html");
         
CloseTable();
include("footer.php");
?>


The first file is a form what when you submit it, it submits to modules.php?name=Mail which DOES exist, all of the included files are there and when i point to each of the modules individually both work, but when i use the form to submit to it i still get Sorry, such file doesn't exist...


Back to top Reply with quote
#4   re: module dosnt work..........................
SidewinderX
CZ Super Newbie
SidewinderX has been a member for over 20 year's 20 Year Member
Status: Offline
Joined: Aug 06, 2004
0.01 posts per day
Posts: 39
Points: 1,333
   
anyone?



Back to top Reply with quote
#5   re: module dosnt work..........................
gotcha
CZ Newbie
 Codezwiz Site Donator
gotcha has been a member for over 19 year's 19 Year Member
usa.gif
Gender: Male
Website:
Status: Offline
Joined: Feb 22, 2005
0.00 posts per day
Posts: 11
Points: 1,117
   
your first file (the form) should be index.php.
your second file (form handler should be something like handle.php)
both in a folder named Mail

and in index.php, the form action needs to be changed from

<form action="modules.php?name=Mail" method="post">


to

<form action="modules.php?name=Mail&file=handle" method="post">


if you change the name of handle.php, also change the &file variable to the new filename minus .php


Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum