Current location: Hot Scripts Forums » Programming Languages » Perl » removing id tags


removing id tags

Reply
  #1 (permalink)  
Old 10-09-07, 02:26 PM
digitalphoenix digitalphoenix is offline
New Member
 
Join Date: Oct 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
removing id tags

I am trying to send info from a form to an email address and I would like to remove the form id tags and "=" signs from the email... is there a way to modify the script so that these will not show in the email? all help is appreciated
Reply With Quote
  #2 (permalink)  
Old 10-09-07, 02:35 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
You will have to post your current code. This "id" thing makes no sense.
Reply With Quote
  #3 (permalink)  
Old 10-09-07, 02:53 PM
digitalphoenix digitalphoenix is offline
New Member
 
Join Date: Oct 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
<input type="text" size="20" name="first" id="first_names" value="" maxlength=50 />

</div>
</div>
<div class="ga-field" id="ga-last_name-fld"> <label for="last_name">Last
Name:<span class="ga-alert">*</span></label>
<div class="ga-fieldInput">
<input type="text" size="20" name="last" id="last_name" value="" maxlength=50 />

the blue text is what is in the html code... when it shows up in the email it looks like this:
first=
last=

i want to remove these artifacts from the email but dont know how to do it while maintaining the "id" information collecting part of the form.

o am kinda new to this so i hope that i am explaining this correctly
Reply With Quote
  #4 (permalink)  
Old 10-09-07, 02:58 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Can you post the code that sends the email? I don't see why these would be included anyway.
Reply With Quote
  #5 (permalink)  
Old 10-09-07, 03:11 PM
digitalphoenix digitalphoenix is offline
New Member
 
Join Date: Oct 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
i am using a script from bignosebird.com i did not write it myself:

Code:
$lockfile="/tmp/bnbform.lck";

   $SD=&sys_date;
   $ST=&sys_time;

   &decode_vars;

   &valid_page;

   if ($fields{'countfile'} ne "") { &get_number; }

   &valid_data;

   &write_data;

   if ($fields{'automessage'} ne "") { &answer_back; }

   if ($fields{'ok_url'} ne ""){
     print "Location: $fields{'ok_url'}\n\n"; exit;
   }
     else { &thank_you; }

##################################################################
sub write_data
{

   if ($fields{'submit_by'} ne "") {
       if (&valid_address == 0) {
          &bad_email;
          exit;
       }
   }
   
   if ($fields{'submit_by'} ne "" && $fields{'emailfile'} ne "") {
      open (EMF,">>$fields{'emailfile'}");
      print EMF "$fields{'submit_by'}\n";
      close (EMF);
   }

   if ($fields{'submit_to'} ne "") {
     $msgtext="";
     $msgtext .= "On $SD at $ST,\n";
   }

   if ($fields{'outputfile'} ne "") { 
      &get_the_lock; 
      open(OUT_FILE,">>$fields{'outputfile'}"); 
   }

   foreach $to_print (@sortlist) {
      if ($fields{'outputfile'} ne "")
       { print OUT_FILE "$fields{$to_print}\|"; }
      if ($fields{'submit_to'} ne "")
       { $msgtext .= "$to_print = $fields{$to_print}\n"; }
   }
   if ($fields{'outputfile'} ne "") {
     print OUT_FILE "$SD\|$ST\|\n";
     close(OUT_FILE);
ok..     &drop_the_lock;
   }

   foreach $to_get (@recipients) {
      $mailresult=&sendmail($fields{submit_by}, $fields{submit_by}, $to_get, $SMTP_SERVER, $fields{form_id}, $msgtext);
      if ($mailresult ne "1") {
       print "Content-type: text/html\n\n";
       print "MAIL NOT SENT. SMTP ERROR: $mailcodes{'$mailresult'}\n";
       exit
      }
    }
   foreach $to_cc (@bcc_tos) {
      $mailresult=&sendmail($fields{submit_by}, $fields{submit_by}, $to_cc, $SMTP_SERVER, $fields{form_id}, $msgtext);
      if ($mailresult ne "1") {
       print "Content-type: text/html\n\n";
       print "MAIL NOT SENT. SMTP ERROR: $mailcodes{'$mailresult'}\n";
       exit
      }
    }

}

##################################################################
sub decode_vars
 {
  $i=0;
  read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
  @pairs=split(/&/,$temp);
  foreach $item(@pairs) {
    ($key,$content)=split(/=/,$item,2);
    $content=~tr/+/ /;
    $content=~s/%(..)/pack("c",hex($1))/ge;
    $content=~s/\t/ /g;
    $content=~s/\0//g; #strip nulls
    $fields{$key}=$content;
    if ($key eq "data_order") {
       $content=~s/\012//g;
       $content=~s/\015//g;
       $content=~s/ //g;
       $content=~s/ //g;
       @sortlist=split(/,/,$content);
    }
    if ($key eq "required") {
       $content=~s/\012//g;
       $content=~s/\015//g;
       $content=~s/ //g;
       @mandatory=split(/,/,$content);
    }
    if ($key eq "submit_to") {
       $content=~s/\012//g;
       $content=~s/\015//g;
       $content=~s/ //g;
       @recipients=split(/,/,$content);
    }
    if ($key eq "bcc_to") {
       $content=~s/\012//g;
       $content=~s/\015//g;
       $content=~s/ //g;
       @bcc_tos=split(/,/,$content);
    }

   }
    if  (
     ( ($fields{automessage}=~ /^([-\/\w.]+)$/ || $fields{automessage} eq "") &&
      ($fields{countfile}=~ /^([-\/\w.]+)$/ || $fields{countfile} eq "") &&
      ($fields{emailfile}=~ /^([-\/\w.]+)$/ || $fields{emailfile} eq "") &&
      ($fields{outputfile}=~ /^([-\/\w.]+)$/ || $fields{outputfile} eq "") )
    ) {$donothing=0;}
    else {
       print "Content-type: text/html\n\n sorry, invalid characters...\n";
       exit;
    }
   if ($fields{automessage} ne "") {$fields{automessage} .= ".baut";}
   if ($fields{countfile} ne "") {$fields{countfile} .= ".bcnt";}
   if ($fields{emailfile} ne "") {$fields{emailfile} .= ".bemf";}
   if ($fields{outputfile} ne "") {$fields{outputfile} .= ".bout";}
}

Last edited by Nico; 10-09-07 at 03:15 PM.
Reply With Quote
  #6 (permalink)  
Old 10-09-07, 03:29 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
This is Perl, right? I moved this to the Perl section so someone here can help you out.
Reply With Quote
  #7 (permalink)  
Old 10-10-07, 03:36 PM
Drunken Perl Coder Drunken Perl Coder is offline
Wannabe Coder
 
Join Date: Aug 2006
Posts: 110
Thanks: 0
Thanked 0 Times in 0 Posts
bignosebird is probably the worst place you could ever get a perl script from, even worse than Matts Script Archives. But this is the way it is supposed to look:

first=

otherwise how will you know that the data is from the "first" form field? The "id" attributes should not even be getting into the script as those are used for other purposes.
__________________
Mods: Please do not edit my posts to add syntax highlighting. Thank you.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tags gigafare Script Requests 2 04-15-07 07:35 AM
exchange del.icio.us tags northbeach23 Traffic Exchange 0 12-21-06 11:39 PM
strip out xml tags with regex ddolddolee82 Perl 2 03-16-06 03:50 PM
How can I strip certain tags between certan points? Keith PHP 10 03-25-05 09:59 AM
removing specified html tags from text memon PHP 1 01-15-04 08:56 PM


All times are GMT -5. The time now is 04:47 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.