Form Input Help | Python

 
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI
View previous topic :: View next topic  
Author Message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Thu Apr 22, 2004 4:40 am    Post subject: Form Input Help | Python Reply with quote

Im working on my new project which is ::Virtual Host Creator::
Python version and I need some help from a few of the Python
programmers so that I can pass form input from a form to the
.py script that way I can get this new version up and running.

-------------------------------------------------------------------------------------

Current Code:

Code:
#! python
import cgi
form = cgi.FieldStorage()
main = form.getvalue('main')
domain1 = form.getvalue('domain1')
dir1 = form.getvalue('dir1')

print "Content-Type: text/html\n"
print "#! python<br>"
print "import os<br>"
print "host = os.environ['HTTP_HOST']<br>"
print "if host == '",domain1,"':<br>"
print "print 'Location: ",dir1,"\n'<br>"
print "else:<br>"
print "print 'Location: ",main,"\n'<br>"


The problem with this code is that when a user submits
their domain in the form , the code leaves spaces in
between their domain and causes the domain not to redirect :(

-------------------------------------------------------------------------------------

P.S. Who ever helps me in this next project
will be listed as credit in the ReadMe file!
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri Apr 23, 2004 2:43 pm    Post subject: Re: Form Input Help | Python Reply with quote

TRUSTpunk,

Replace
Code:
print "if host == '",domain1,"':<br>"

with
Code:
print "if host == '" + domain1 + "':<br>"

_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Fri Apr 23, 2004 5:48 pm    Post subject: Reply with quote

Ok thanks Aprelium , I will try that out! 8)

Edit: This didn't work , I have a good script
so im not going to worry about the spaces
because the python version is released.
Back to top View user's profile Send private message Visit poster's website
garyanderson
-


Joined: 08 Apr 2004
Posts: 40

PostPosted: Fri Apr 23, 2004 6:51 pm    Post subject: Reply with quote

trust why is all your code in quotes? what is this supposed to do.?
Back to top View user's profile Send private message Yahoo Messenger
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Sat Apr 24, 2004 3:05 am    Post subject: Reply with quote

It prints the form input along with the user submited
data to their browser so they can copy their code.
Back to top View user's profile Send private message Visit poster's website
garyanderson
-


Joined: 08 Apr 2004
Posts: 40

PostPosted: Sun Apr 25, 2004 12:04 am    Post subject: Reply with quote

have you fixed your problem or you sitll having problems. I've honestly never seen code like that. but if its wokring *shrug*
Back to top View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI All times are GMT + 1 Hour
Page 1 of 1

 
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


Powered by phpBB phpBB Group