Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.6
Author Message
jazzfuser
Worker
Worker



Joined: Mar 30, 2006
Posts: 111

PostPosted: Tue Apr 29, 2008 10:38 am Reply with quote

I found a problem with my new server... Forms that worked on the old server, now do not work on the new.

Specifically, I had created a module that collected score information via user input, which then sent an email to the score keeper containing the data. Now, the email is sent, but the data is blank.

Where should I begin?
 
View user's profile Send private message
fkelly
Former Moderator in Good Standing



Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Tue Apr 29, 2008 10:57 am Reply with quote

What version of Nuke are you using. That would be a good starting point help us. If you are using Ravennuke 2.20 and up you can look in your database error log and see if you are kicking off any database errors. If you created the module yourself you can also put some echoes in ... echo out the form variables when they are posted and echo out the SQL statements to see if they are working right and getting the right data. Check the result variable for you SQL statements and see if it is returning true.
 
View user's profile Send private message Visit poster's website
jazzfuser







PostPosted: Tue Apr 29, 2008 11:14 am Reply with quote

7.6 patched to 3.1.

I am not accessing the db. It's really a very simple form...user input, spit out email with information supplied by the user.
 
fkelly







PostPosted: Tue Apr 29, 2008 11:25 am Reply with quote

So the form is posted to a php file that retrieves from the form variables via $_POST['xxx'} where xxx is a form variable. Put an echo in to see what is being returned in that post variable. You are either getting the data sent over from the form or you are not. If you are getting the data sent then the problem is with what you are sticking into your email.
 
jazzfuser







PostPosted: Tue Apr 29, 2008 11:38 am Reply with quote

I think it is echoing some data, for example, there is a variable that reads;

$Subject = " [SD Score] $Div: $CaptName - $HTN vs. $ATN\n";

When the email is sent, the [SD Score] and the - are present in the subject line of the mail, but the dynamic data is not. So, the email would look like this;
[SD Score] -

is that an echo? If not, could you share something simple I could cut and paste into the form to test real quick?
 
fkelly







PostPosted: Tue Apr 29, 2008 11:56 am Reply with quote

Your variables look to be $subject, $div, $captname, $htn and $atn. These should be passed over from the form. So, in the form you might have an input type="text" name="subject" for instance. In the php program that processes the form you might be doing something like $subject = $_POST['subject'];

So you could just echo out subject with something like
echo 'subject = ' . $subject;

and the same for the other variables. If you are trying to maintain a module and having difficulty with this level of PHP syntax it might be time to get a good PHP book.
 
jazzfuser







PostPosted: Tue Apr 29, 2008 12:19 pm Reply with quote

As I'm digging deeper into this, it's actually a java form embedded in a php module.

The main form uses <form action="score.php" method="post" name="Scores" id="Scores"> from Java, and file score.php collecting and processing the info uses
the following method to send

mail($EmailTo,$Subject,$App,"From: $email\n");

Do you think this is more likley configuration problem with the java install on the new server? If so, what sorts of settings should I be looking at there?
 
fkelly







PostPosted: Tue Apr 29, 2008 1:11 pm Reply with quote

maybe post the score.php here enclosed in a code block.
 
jazzfuser







PostPosted: Tue Apr 29, 2008 2:00 pm Reply with quote

Code:
<?

$EmailTo = "support@theurl.com";
$Subject = " [SD Score] $Div: $CaptName - $HTN vs. $ATN\n";
$Name = "$FirstName\n";
$App = "Submitter's Last Name: $CaptName\nDivision: $Div\nGame Date: $EMonth/$EDay/$EYear\nLocation: $Location\nForfeit? $Forfeit\n\nHome Team Name: $HTN\nWOMEN'S DOUBLES\nScore: $HWD\nPlayer 1: $wdp1\nPlayer 2: $wdp2\nSubs: $wds - $swdp1 $swdp2\nMEN'S DOUBLES\nScore:   $HMD\nPlayer 1: $mdp1\nPlayer 2: $mdp2\nSubs: $mds - $smdp1 $smdp2\nWOMEN'S SINGLES\nScore: $HWS\nPlayer 1: $swp\nSub(s): $sws\nMEN'S SINGLES\nScore:   $HMS\nPlayer 1: $smp\nSub(s): $sms\nMIXED #5\nScore:     $HM5\nPlayer 1: $m5p1\nPlayer 2: $m5p2\nSubs: $m5s - $sm5p1 $sm5p2\nMIXED #6\nScore:     $HM6\nPlayer 1: $m6p1\nPlayer 2: $m6p2\nSubs: $m6s - $sm6p1 $sm6p2\nOVERTIME\nScore:     $HOT\nPlayer 1: $otp1\nPlayer 2: $otp2\nSubs: $ots - $sotp1 $sotp2\nSUPER TB\nScore:      $HST\nPlayer 1: $stbp1\nPlayer 2: $stbp2\nSubs: $stbs - $sstbp1 $sstbp2\nHOME TOTAL SCORE: $HF\n\nAway Team Name: $ATN\nWOMEN'S DOUBLES\nScore: $AWD\nPlayer 1: $awdp1\nPlayer 2: $awdp2\nSubs: $awds - $aswdp1 $aswdp2\nMEN'S DOUBLES\nScore:   $AMD\nPlayer 1: $amdp1\nPlayer 2: $amdp2\nSubs: $amds - $asmdp1 $asmdp2\nWOMEN'S SINGLES\nScore: $AWS\nPlayer 1: $awsp\nSub(s): $asws\nMEN'S SINGLES\nScore:   $AMS\nPlayer 1: $asmp\nSub(s): $asms\nMIXED #5\nScore:     $AM5\nPlayer 1: $am5p1\nPlayer 2: $am5p2\nSubs: $am5s - $asm5p1 $asm5p2\nMIXED #6\nScore:   $AM6\nPlayer 1: $am6p1\nPlayer 2: $am6p2\nSubs: $am6s - $asm6p1 $asm6p2\nOVERTIME\nScore:  $AOT\nPlayer 1: $aotp1\nPlayer 2: $aotp2\nSubs: $aots - $asotp1 $asotp2\nSUPER TB\nScore:  $AST\nPlayer 1: $astbp1\nPlayer 2: $astbp2\nSubs: $astbs - $asstbp1 $asstbp2\nAWAY TOTAL SCORE: $AF\n\nEmail: $email\nExtended Information:\n---Begin Comments---\n\n$extInfo\n\n---End Of Comments---\n\nIP Address: $REMOTE_ADDR";
mail($EmailTo,$Subject,$App,"From: $email\n");
?>
<html>
<link href="themes/DAJ_Glass/style/style.css" rel="stylesheet" type="text/css">
<body bgcolor="#DEDEE6">
<div align="center">
  <table width="100%" height="600"  border="0" cellpadding="3" cellspacing="0">
    <tr>
      <td bgcolor="#9999CC"><div align="center">
        <table width="250" border="0" cellpadding="3" cellspacing="0" bgcolor="#FFFFFF">
            <tr>
              <td><div align="left">Thank you for using this form to submit your scores.<br>
                <br>
                  <em>Your game details have been sent, and you should receive an email containing the information you provided .</em><br>
            Your scores should be applied to the standings within 48 hours.<br>
            Please &gt; <a href="index.php">Click Here&lt; </a>to return to our site.<b> </b></div></td>
            </tr>
              </table>
      </div></td>
    </tr>
  </table>
</div>
</body>
</html>
 
evaders99
Former Moderator in Good Standing



Joined: Apr 30, 2004
Posts: 3221

PostPosted: Tue Apr 29, 2008 2:15 pm Reply with quote

If that is the entire PHP file, then it is not passing variables correctly due to register_globals not being turned on. You could turn that on the server, but it is better recommended to use the $_POST variables and filter them before using them.

_________________
- Only registered users can see links on this board! Get registered or login! -

Need help? Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
jazzfuser







PostPosted: Tue Apr 29, 2008 2:43 pm Reply with quote

Thank you both, as fkelly recommended I need to brush up on my PHP. It sounds like I would have to, kind of, rewrite my entire form and I really don't have time as the season is ending I have captains trying to submit scores right away (before the end of the month). I'll turn on the register_globals for now, and then rewrite for next season.

Again, thanks so much! I'll post again with the result.
 
fkelly







PostPosted: Tue Apr 29, 2008 5:52 pm Reply with quote

It is not the form that needs to be rewritten but the php program that processes the form after it is submitted. And it is not that complicated, just do a $variable = $_POST['variable'] for each variable from your form that you want to use. You probably should also filter them as Evaders says. There are plenty of threads on filtering here that you can consult or get a book or look online.
 
jazzfuser







PostPosted: Wed Apr 30, 2008 10:31 am Reply with quote

I've clearly missing something. here's my amended script. The form sends, but no data sent...everything is blank. I'm sure it's something simple, but I'm too green to see it.

Code:
<?

$EmailTo = "support@url.com, $email";
$Subject = $_POST['"[SD Score] $Div: $CaptName - $HTN vs. $ATN"'];
$Name = $_POST['"$FirstName"'];
$App = $_POST['Submitter Last Name: $CaptName\nDivision: $Div\nGame Date: $EMonth/$EDay/$EYear\nLocation: $Location\nForfeit? $Forfeit\n\nHome Team Name: $HTN\nWOMENS DOUBLES\nScore: $HWD\nPlayer 1: $wdp1\nPlayer 2: $wdp2\nSubs: $wds - $swdp1 $swdp2\nMENS DOUBLES\nScore:   $HMD\nPlayer 1: $mdp1\nPlayer 2: $mdp2\nSubs: $mds - $smdp1 $smdp2\nWOMENS SINGLES\nScore: $HWS\nPlayer 1: $swp\nSub(s): $sws\nMENS SINGLES\nScore:   $HMS\nPlayer 1: $smp\nSub(s): $sms\nMIXED #5\nScore:     $HM5\nPlayer 1: $m5p1\nPlayer 2: $m5p2\nSubs: $m5s - $sm5p1 $sm5p2\nMIXED #6\nScore:     $HM6\nPlayer 1: $m6p1\nPlayer 2: $m6p2\nSubs: $m6s - $sm6p1 $sm6p2\nOVERTIME\nScore:     $HOT\nPlayer 1: $otp1\nPlayer 2: $otp2\nSubs: $ots - $sotp1 $sotp2\nSUPER TB\nScore:      $HST\nPlayer 1: $stbp1\nPlayer 2: $stbp2\nSubs: $stbs - $sstbp1 $sstbp2\nHOME TOTAL SCORE: $HF\n\nAway Team Name: $ATN\nWOMENS DOUBLES\nScore: $AWD\nPlayer 1: $awdp1\nPlayer 2: $awdp2\nSubs: $awds - $aswdp1 $aswdp2\nMENS DOUBLES\nScore:   $AMD\nPlayer 1: $amdp1\nPlayer 2: $amdp2\nSubs: $amds - $asmdp1 $asmdp2\nWOMEN SINGLES\nScore: $AWS\nPlayer 1: $awsp\nSub(s): $asws\nMENS SINGLES\nScore:   $AMS\nPlayer 1: $asmp\nSub(s): $asms\nMIXED #5\nScore:     $AM5\nPlayer 1: $am5p1\nPlayer 2: $am5p2\nSubs: $am5s - $asm5p1 $asm5p2\nMIXED #6\nScore:   $AM6\nPlayer 1: $am6p1\nPlayer 2: $am6p2\nSubs: $am6s - $asm6p1 $asm6p2\nOVERTIME\nScore:  $AOT\nPlayer 1: $aotp1\nPlayer 2: $aotp2\nSubs: $aots - $asotp1 $asotp2\nSUPER TB\nScore:  $AST\nPlayer 1: $astbp1\nPlayer 2: $astbp2\nSubs: $astbs - $asstbp1 $asstbp2\nAWAY TOTAL SCORE: $AF\n\nEmail: $email\nExtended Information:\n---Begin Comments---\n\n$extInfo\n\n---End Of Comments---\n\nIP Address: $REMOTE_ADDR"'];
mail($EmailTo,$Subject,$App,"From: $email\n");
?>
 
fkelly







PostPosted: Wed Apr 30, 2008 10:40 am Reply with quote

$_POST needs to be the name of a field on your form. The syntax should be $_POST['name']. I'm not sure if the double quotes would do any harm, probably not, but you don't need or want them in there confusing things. It looks like you are trying to concatenate a lot of things in that $app variable. I would put one form field into one variable at a time. Then concatenate the variables later. I'd also echo out the variables as they are being read in from the form so you can see that you are getting what you'd expect. Also, if you put things like variable names within single quotes they are going to be taken literally ... in other words you will be $CaptName\nDivision: in your variable rather than the contents of it.
 
jazzfuser







PostPosted: Wed Apr 30, 2008 10:52 am Reply with quote

Thank you, and to be sure I understand -

$App should be replaced with something like;

$Cap = "Submitter's Name" $_POST['CaptName'];
$Div = "Division" $_POST['Div'];
etc...

In the mail function it would look like mail($Cap,$Div,etc..);

is this correct?
 
fkelly







PostPosted: Wed Apr 30, 2008 1:43 pm Reply with quote

$app can be used in the mail function. But you need to build it up through string concatenation from its constituent parts. Look up string concatenation in the PHP manual. You could say for instance $cap = 'submitters name' . $_POST['Captname']; and it would concatenate those two "things" together ... the literal string 'submitters name' and whatever is in the POST variable that comes from a field in the form with that name.

This CAN be done in one swell foop of a concatenation but it is much more prone to error that way. You are better off (IMHO) putting the $_POST variable into individual variables (and filtering them as you do), then assembling them into $app with a separate concatenation step. That way you can test by means of echoes each individual step to make sure you are doing it right.
 
jazzfuser







PostPosted: Wed Apr 30, 2008 7:25 pm Reply with quote

I'll have a look at the manual and hopefully get a clearer picture. Some of the example scripts I've been browsing are difficult to understand, and when I run them, even they fail...*sigh*...tough being a newb.

I appreciate your patience.
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.6

View next topic
View previous topic
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 can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©