Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Tue Jul 09, 2013 12:41 am 
Offline
Senior Member
User avatar

Joined: Wed Jun 26, 2013 1:53 am
Posts: 118
I have a PHP form with the following two files:

index.php:

Code:
<html>
<head>
<title>
WikiHub Request Wiki
</title>

</head>
<body>

<form action="submit.php" method="post">
  <fieldset>
     <label for="name">Your name:</label>
       <input type="text" name="name" size="45"/>
<br>
     <label for="email">Your email address:</label>
       <input type="text" name="email" size="50"/>
<br>
     <label for="wikiName">Name of your wiki:</label>
       <input type="text" name="wikiName" size="40"/>
<br>
     <label for="metaNS">Meta namespace:</label>
       <input type="text" name="metaNS" size="50"/>
         <span>This is the name of the page name prefix that is used for
            pages about your wiki.  Leave this blank if you want.</span>
<br>
     <label for="subdomain">Subdomain</label>
       <input type="text" name="subdomain" size="30"/>
         <span>.wikihub.ssu.lt</span>
<br>
     <label for="topic">Topic: Please describe the topic of your
                          wiki and what it will be about, or what
                          you plan to do with it.<br>Please write enough
                          to show us that this is a legitimate request
                          and not spam.</label><br>
       <textarea cols="70" rows="10" name="topic"></textarea>
  </fieldset>
<br>
  <fieldset align="center">
    <input type="submit" value="Submit"/>
  </fieldset>
</form>

</body>
</html>


submit.php

Code:
<html>
<head>
<title>
Form submitted
</title>

</head>
<body>
<?php

// Get information from form

$name = trim($_REQUEST['name']);
$email = trim($_REQUEST['email']);
$wikiName = trim($_REQUEST['wikiName']);
$metaNS = trim($_REQUEST['metaNS']);
$subdomain = trim($_REQUEST['subdomain']);
$topic = trim($_REQUEST['topic']);

// Send email

// Construct email

$emailText = '
A new wiki has been requested:

Requested by: '.$name.'
Contact email: '.$email.'
Name of requested wiki: '.$wikiName.'
Meta namespace: '.$metaNS.'
Subdomain: '.$subdomain.'
Topic:
'.$topic.'
';

// Information for email

$destinationEmail = 'xxxxxxxxxxxxx';
$emailSubject = 'WIKIHUB NEW WIKI REQUEST';
$emailHeader = 'From: wikihub@server.sturmkrieg.com';

mail( $destinationEmail, $emailSubject, $emailText, $emailHeader );

// Explain form on webpage

echo "
The form that you submitted contained:<br>
Your name: $name<br>
Your email address: $email<br>
Name of your wiki: $wikiName<br>
Meta namespace (if specified): $metaNS<br>
Domain of your wiki: $subdomain<!-- -->.wikihub.ssu.lt
Topic of your wiki:<br>$topic
";

?>
</body>
</html>


The Topic part keeps getting left out, both on submit.php and in the email.

_________________
Homepage www.sturmkrieg.com
Social network Gamernet
Development website Sashaweb Development
Imageboard img.sturmkrieg.com
WikiHub free wiki host Community Wiki


Top
   
PostPosted: Tue Jul 09, 2013 6:55 am 
Offline
Senior Member

Joined: Mon Jan 02, 2012 12:45 pm
Posts: 365
I don't see a problem. Perhaps you can try this?
http://stackoverflow.com/questions/8719 ... a-textarea


Top
   
PostPosted: Tue Jul 16, 2013 6:27 am 
Offline
Senior Newbie

Joined: Sat Jun 16, 2012 8:06 am
Posts: 7
Try $topic = trim($_POST['topic']); - my guess would have been a different field or cookie with the same name - $_REQUEST includes cookie data.

You should always try to be specific in PHP - this will reduce attack vectors. If you know the data is coming from a POST of a form use $_POST.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 5 guests


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

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group