| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		TRUSTAbyss -
 
  Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
  | 
		
			
				 Posted: Thu Apr 22, 2004 4:40 am    Post subject: Form Input Help | Python | 
				      | 
			 
			
				
  | 
			 
			
				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 | 
		
			           | 
		
	
	
		  | 
	
	
		aprelium -
 
  Joined: 22 Mar 2002 Posts: 6800
 
  | 
		
			
				 Posted: Fri Apr 23, 2004 2:43 pm    Post subject: Re: Form Input Help | Python | 
				      | 
			 
			
				
  | 
			 
			
				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 | 
		
			           | 
		
	
	
		  | 
	
	
		TRUSTAbyss -
 
  Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
  | 
		
			
				 Posted: Fri Apr 23, 2004 5:48 pm    Post subject:  | 
				      | 
			 
			
				
  | 
			 
			
				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 | 
		
			           | 
		
	
	
		  | 
	
	
		garyanderson -
 
  Joined: 08 Apr 2004 Posts: 40
 
  | 
		
			
				 Posted: Fri Apr 23, 2004 6:51 pm    Post subject:  | 
				      | 
			 
			
				
  | 
			 
			
				| trust why is all your code in quotes? what is this supposed to do.? | 
			 
		  | 
	
	
		| Back to top | 
		
			           | 
		
	
	
		  | 
	
	
		TRUSTAbyss -
 
  Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
  | 
		
			
				 Posted: Sat Apr 24, 2004 3:05 am    Post subject:  | 
				      | 
			 
			
				
  | 
			 
			
				It prints the form input along with the user submited
 
data to their browser so they can copy their code. | 
			 
		  | 
	
	
		| Back to top | 
		
			           | 
		
	
	
		  | 
	
	
		garyanderson -
 
  Joined: 08 Apr 2004 Posts: 40
 
  | 
		
			
				 Posted: Sun Apr 25, 2004 12:04 am    Post subject:  | 
				      | 
			 
			
				
  | 
			 
			
				| 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 | 
		
			           | 
		
	
	
		  | 
	
	
		 |