www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 20

Thread: Perl syntax question

  1. #1
    Join Date
    Feb 2003
    Posts
    70

    Perl syntax question

    Anybody know what the Perl syntax would be to allow the characters "http://" to be the default value in the URL field on my form ( http://www.usedflutes.com/addpage.html ). Needs to be configured so that if someone chooses not to post a URL (field is optional), would strip the "http://" so that the field would post as empty?

    Many thanks is advance,

    -Bob

  2. #2
    Join Date
    Feb 2003
    Posts
    70
    The Perl script for the URL field to modify looks like this:

    if ( $FORM{'url'} ){
    print MAIL "$FORM{'url'} ";
    }

  3. #3
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    Code:
    delete $FORM{url} if $FORM{url} eq 'http://';
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  4. #4
    Join Date
    Feb 2003
    Posts
    70
    Thanks for trying Jeff, unfortunately the code doesn't work - 'http://' still came through...

    -Bob

  5. #5
    Join Date
    Feb 2003
    Posts
    70

  6. #6
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    Then either the value was not actually 'http://' or the code I gave was inserted to late in the program. If you consider the example:
    Code:
    $FORM{url} = 'http://';
    delete $FORM{url} if $FORM{url} eq 'http://';
    print $FORM{url};
    nothing will be printed.
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  7. #7
    Join Date
    Feb 2003
    Posts
    70
    Hi Jeff,

    >Then either the value was not actually 'http://' or the code I gave was inserted to late >in the program.

    The "http://" comes from the form http://www.usedflutes.com/addpage_URL.html so I don't think that was the problem. As for placement, I did put it up towards the beginning so not sure about that either.


    >If you consider the example:


    code:
    ------------------------------------------------------------------------
    $FORM{url} = 'http://';
    delete $FORM{url} if $FORM{url} eq 'http://';
    print $FORM{url};
    ------------------------------------------------------------------------
    nothing will be printed.

    OK, I'll try this and see. What I'm really looking for however, is to have the "http://" only stripped if there's nothing added to it. If someone adds to the http:// , then I want that UEL value to go through. Any ideas how to set that up?

    Thanks Jeff,

    -Bob

  8. #8
    Join Date
    Feb 2003
    Posts
    70
    Hi Jeff,
    OK - I just tried your new code, but no luck there either sorry to say. Maybe it'd help if you saw the script that I'm using?

    http://www.scriptarchive.com/downloa...guestbook%2Epl

    Thanks Jeff,

    -Bob

  9. #9
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    bobafifi
    As for placement, I did put it up towards the beginning
    That's a very broad statement and doesn't tell me a whole lot. It has to go somewhere after the parameters are parsed and before it is printed to GUEST.

    What I'm really looking for however, is to have the "http://" only stripped if there's nothing added to it. If someone adds to the http:// , then I want that UEL value to go through. Any ideas how to set that up?
    Yeah, what I already gave you.

    OK - I just tried your new code, but no luck there either sorry to say
    The new code I gave was merely an example and not meant to be the solution.

    Maybe it'd help if you saw the script that I'm using? http://www.scriptarchive.com/downlo...=guestbook%2Epl
    The scripts available at scriptarchive.com are buggy and insecure, and should NOT be used. Even Matt no longer recommends his scripts.
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  10. #10
    Join Date
    Feb 2003
    Posts
    70
    Hi Jeff,
    My apologies...
    I made the mistake of not slightly modifying your code so that it would be read right

    (needed to change {url} to {'url'} ) and it works! :-) Thanks!

    However, I've now got another problem with the code:
    I use the script to send me INSERT statements for the MySQL database that I use. Since the {'url'} field is completely deleted if your code is activated, I lose the {'url'} field value for the INSERT statement and so the MySQL insert fails:

    For example, this is formatted OK:


    INSERT INTO `MySQL` (`Title`, `Email`, `City`, `State`, `Country`, `URL`, `Date`,
    `Description`, `rid`) VALUES ('Test', 'bob', 'Seb', 'Ca', 'USA ', 'http://', 'Wednesday, February 19, 2003 ',
    'Sadasd', '')

    and this is not:

    INSERT INTO `MySQL` (`Title`, `Email`, `City`, `State`, `Country`, `URL`, `Date`,
    `Description`, `rid`) VALUES ('Test', 'bob', 'Seb', 'Ca', 'USA ', , 'Wednesday, February 19, 2003 ', 'Sadasd',
    '')


    Is it possible to delete the "http://" biz while still retaining the {'url'} value for the form?

    Thanks again Jeff,

    -Bob

  11. #11
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    bobafifi
    needed to change {url} to {'url'} ) and it works
    There must be something else that was changed because there is no difference between those two.

    Is it possible to delete the "http://" biz while still retaining the {'url'} value for the form?
    Code:
    $FORM{url} = '' if $FORM{url} eq 'http://';
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  12. #12
    Join Date
    Feb 2003
    Posts
    70
    Hi Jeff,
    <There must be something else that was changed because there is no difference between those two.

    Well yes, I did change the "eq" to "=" (eq consisitently failed to post) and provide curly braces before and after the code. Anyhow, I just installed your last code in a similar fashion which for some reason is also deleting the url completely - regardless of what text is in the url field. Not sure what's up, but that's what's happening.

    {

    $FORM{'url'} = '' if $FORM{'url'} = 'http://';

    }


    Thanks again Jeff for your help,

    -Bob

  13. #13
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    bobafifi
    Anyhow, I just installed your last code in a similar fashion which for some reason is also deleting the url completely - regardless of what text is in the url field
    That's because you changed eq to =, don't do that. The curly braces don't hurt it, but don't do anything either. If it still doesn't work then upload your modified script.
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  14. #14
    Join Date
    Feb 2003
    Posts
    70
    Hi Jeff,
    OK, I can't figure it out...
    If I leave the code 'as is,' code doesn't do anything - form processes as usual.
    If I change the 'eq' to '=,' then the code works but removes the {'url'} field completely.
    So anyhwow, here's the script:

    http://usedflutes.com/guestbook_modified.txt

    Thanks again Jeff,

    -Bob

  15. #15
    Join Date
    Nov 2002
    Location
    NY, USA
    Posts
    731
    ...where's the snippet I gave you in there?
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.32680 seconds
  • Memory Usage 3,005KB
  • Queries Executed 13 (?)
More Information
Template Usage (37):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (3)bbcode_code
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (15)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (15)postbit
  • (15)postbit_onlinestatus
  • (15)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (72):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates