[req]Generate a webpage....(please read)

Status
Not open for further replies.

dsfreak

New Member
Messages
1,338
Reaction score
0
Points
0
I am offering 200 point to anyone that can do this for me.



See, what I want to do, is be able to have a form, that will, say, have name, email, and the persons question. On submission, I want the form to use a script to create a webpage using letters and numbers, in a random order.... Say 5 of total characters.


Basically, I want it to send the form info to a perl / cgi script, which will create a webpage, using a random combination of 5 letters and numbers, (eg. 8hj67.html), and put that data on there!

In example, the form would have: Email: (text field)
Name: (Text field)
Question(text field)
[Submit]

On the webpage, I would want it to say (Their name) asked the following question (the question).

Can anyone do this for me?
 

Chris S

Retired
Messages
2,055
Reaction score
1
Points
38
I could, but does it have to be perl/cgi

I can do it in PHP, I know that because I am currently using it in one of my scripts :naughty:

edit if so what do you want the pages named

like the submit page
 
Last edited:

Chris Z

Active Member
Messages
5,603
Reaction score
0
Points
36
i found a substitute for this. go to your cpanel and go to fantastico. site builders, there is this script called soholaunch pro edition, pick that, it will build you a webpage, and it will let you set up some forms, i'm not sure if you can email though
 

dsfreak

New Member
Messages
1,338
Reaction score
0
Points
0
PHP works too, forgot to add that.

The Sumbit page title: Ask a Question

(hopefully) the generated page: Question number (if possible), or, Question and Anwser.


Billy, I want this for a reason.

I don't want to release it, because it is a secret of mine, but forums would not work for it..
 

Jordan K

[B]tags dont work:([/B]
Messages
1,528
Reaction score
0
Points
0
billybob bo buck said:
dude, why don't you just get a forum!?!?!?

This has no relevancy to what he is asking, stop posting stupid stuff like this, read his entire post next time?
 

Chris S

Retired
Messages
2,055
Reaction score
1
Points
38
here it is

add.php
Code:
<html
<head>
<title>Ask a Question</title>
</head>
<body>
<form name="form1" method="post" action="question.php">
<table>
  <tr>
    <td>E-mail</td>
    <td><input name="email" type="text" id="email" value="somebody@somewhere.com" onfocus="if (this.value == 'somebody@somewhere.com') this.value = '';" onblur="if (this.value == '') this.value = 'somebody@somewhere.com'"></td>
  </tr> 
  <tr>
    <td>Name</td>
    <td><input name="name" type="text" id="name" value="John Doe" onfocus="if (this.value == 'John Doe') this.value = '';" onblur="if (this.value == '') this.value = 'John Doe'"></td>
  </tr>
  <tr>
    <td>Question</td>
    <td><input name="question" type="text" id="question" value="Question" onfocus="if (this.value == 'Question') this.value = '';" onblur="if (this.value == '') this.value = 'Question'"></td>
  </tr>
  <tr>
    <td colspan=2><center><input type=submit value=Submit></center></td>
  </tr>
</table>
</body>
</html>

question.php
Code:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$question = $_POST['question'];

$name = stripslashes($name);
$email = stripslashes($email);
$question = stripslashes($question);

$date = date("F j, Y");
$time = date("H:j:s");
$time1 = md5($time);
$time1 = sha1($time1);
$time1 = substr($time1, 0, 5)
$name1 = $time1.'.html';
$file_chmod = "created/$name1";
$file = fopen("created/$name1", "w+");
chmod($file_chmod, 0755);
if (($file) == 'True' OR '1'){

$message = "Email: $email <br> Name: $name <br> Question: $question<br> Time Created: $time";

$write_question = fwrite($file, $message);
}else{
echo "Whoops, the file wasn't created. Contact the administrator of the site";
}
fclose($file);
?>

that should work, if not post and the errors will get fixed
 
Last edited:

Chris S

Retired
Messages
2,055
Reaction score
1
Points
38
And it was early :-D But if you try it and it doesn't work, just post here and somebody will help with the errors
 

dsfreak

New Member
Messages
1,338
Reaction score
0
Points
0
Seems to work fine, but one problem..


It does not generate a webpage at all.

Note: No errors, it just opens up question.php, and it is blank.
 
Last edited:

Chris Z

Active Member
Messages
5,603
Reaction score
0
Points
36
FYI: Jordan K, you can just shut your mouth, cuz i did read his whole post, it just didn't make any sense to me why he wants a form script rather than just a forum, now i understand is that he wants to have a form submitted and then "_____ said this:" so, next time, don't assume what i did or didn't do! I read his WHOLE POST! :slap: :thefinger
 

Chris S

Retired
Messages
2,055
Reaction score
1
Points
38
the reason the last page is blank, is because i didn't echo anything on it. is the folder that you are writing to chmod to 775 or so

use this as the new question page

Code:
?php
$name = $_POST['name'];
$email = $_POST['email'];
$question = $_POST['question'];

$name = stripslashes($name);
$email = stripslashes($email);
$question = stripslashes($question);

$date = date("F j, Y");
$time = date("H:j:s");
$time1 = md5($time);
$time1 = sha1($time1);
$time1 = substr($time1, 0, 5)
$name1 = $time1.'.html';
$file_chmod = "created/$name1";
$file = fopen("created/$name1", "w+");
chmod($file_chmod, 0755);
if (($file) == 'True' OR '1'){

$message = "Email: $email <br> Name: $name <br> Question: $question<br> Time Created: $time";

$write_question = fwrite($file, $message);
if (($write_question) == 'True' OR '1'){
echo $message;
}else{
echo "Whoops, the file wasn't created. Contact the administrator of the site";
}
}else{
echo "Whoops, the file wasn't created. Contact the administrator of the site";
}
fclose($file);
?>
 
Last edited:

dsfreak

New Member
Messages
1,338
Reaction score
0
Points
0
Here is the basic setup:

(Search engine--For a seperate reason)
/anwsers/(where I have your script) chmod: 777
/anwsers/created/ chmod: 777

What might I be able to do?

Also, to Billy, you might want to learn respect for staff members. It sure might help.

Now, lets keep it ontopic, shall we?
 
Last edited:

Chris S

Retired
Messages
2,055
Reaction score
1
Points
38
did you try what i have above

give me a few minutes. I am working on science homework
 

dsfreak

New Member
Messages
1,338
Reaction score
0
Points
0
Still nothing comes up. Just blank page, and no new file... At all.


If you would like... I could give you the address, and you can see for yourself.
 

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
Try adding:

Code:
ini_set('error_reporting', E_ALL);
To the very top and running it. See if you get any errors.
 
Last edited:

dsfreak

New Member
Messages
1,338
Reaction score
0
Points
0
To my........dismay.

No, no errors come up then. Nothing at all seems to come up.
 

Chris S

Retired
Messages
2,055
Reaction score
1
Points
38
do you have <?php at the top. looking back at me code, I left off the '<' in the start
 

dsfreak

New Member
Messages
1,338
Reaction score
0
Points
0
Chris, I assure you I am not that new to PHP to not check for that...


Well, for all who want to know... I fixed it.

Thanks Chris, I will donate the point in just a few.

For all that want to know, here is what was wrong... So simple, haha.

PHP:
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$question = $_POST['question'];

$name = stripslashes($name);
$email = stripslashes($email);
$question = stripslashes($question);

$date = date("F j, Y");
$time = date("H:j:s");
$time1 = md5($time);
$time1 = sha1($time1);
$time1 = substr($time1, 0, 5);!<!<!<!<<!<!<!<!<!<!<!<!<!<!There was no ; here
$name1 = $time1.'.html';
$file_chmod = "created/$name1";
$file = fopen("created/$name1", "w+");
chmod($file_chmod, 0755);
if (($file) == 'True' OR '1'){

$message = "Email: $email <br> Name: $name <br> Question: $question<br> Time Created: $time";

$write_question = fwrite($file, $message);
if (($write_question) == 'True' OR '1'){
echo $message;
}else{
echo "Whoops, the file wasn't created. Contact the administrator of the site";
}
}else{
echo "Whoops, the file wasn't created. Contact the administrator of the site";
}
fclose($file);
?>

If you missed it... $time1 = substr($time1, 0, 5);!<!<!<!<<!<!<!<!<!<!<!<!<!<!There was no ; here
 
Last edited:

Bryon

I Fix Things
Messages
8,149
Reaction score
101
Points
48
There was a ";" missing, yet you did not get an error? That's a little weird.. Especially after setting the error reporting to show everything.
 
Status
Not open for further replies.
Top