www.webdeveloper.com
Results 1 to 4 of 4

Thread: unexpected T_IF error? Please Help

  1. #1
    Join Date
    Feb 2012
    Posts
    102

    Unhappy unexpected T_IF error? Please Help

    I am getting this unexpected T_IF Error on line 70 cant figure it out. Here is the code, the code below starts at line 65:

    PHP Code:

    if ($uid ==($_POST['mc_gross'] ==9.99
    // Generate the download key
    // A script to generate unique download keys for the purpose of protecting downloadable goods
    if (empty($_SERVER['REQUEST_URI'])) {
    $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
    }
    // Strip off query string so dirname() doesn't get confused
    $url preg_replace('/\?.*$/'''$_SERVER['REQUEST_URI']);
    $folderpath 'http://'.$_SERVER['HTTP_HOST'].'/'.ltrim(dirname($url), '/').'/';
    // Generate the unique download key
    $key uniqid(md5(rand()));
    //  echo "key: " . $key . "<br />";
    // Get the activation time
    $time date('U');
    //  echo "time: " . $time . "<br />";
    // Generate the email with link:
    // send user an email with a link to their digital download
    $to =  "SELECT email FROM orders WHERE transaction_id='$txn_id'";
    $subject "Your digital download is ready";
    mail($to"Thank you for your order. Here is your download key:"folderpath);
    //echo "<p><span class=\"box\">" . $folderpath . "download.php?id=" . $key . "</span></p>";
    // Write the key and activation time to the database as a new row
    $registerid mysql_query("INSERT INTO downloadkey (uniqueid,timestamp) VALUES(\"$key\",\"$time\")") or die(mysql_error());
    $r mysqli_query ($dbc);
    if (
    mysqli_affected_rows($dbc) != 1) {
    trigger_error('The download link could not be generated!');
    }                            
    }elseif (
    $uid ==($_POST['mc_gross'] ==14.99) {
    $ereader = array ('realfile1' 'realfile2' 'realfile3');
    foreach (
    $ereader);
    if(empty(
    $_SERVER['REQUEST_URI'])) {
    $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
    }
    // Strip off query string so dirname() doesn't get confused
    $url preg_replace('/\?.*$/'''$_SERVER['REQUEST_URI']);
    $folderpath 'http://'.$_SERVER['HTTP_HOST'].'/'.ltrim(dirname($url), '/').'/';
    // Generate the unique download key
    $key uniqid(md5(rand()));
    //  echo "key: " . $key . "<br />";
    // Get the activation time
    $time date('U');
    //  echo "time: " . $time . "<br />";
    // Generate the link
    echo "<p><span class=\"box\">" $folderpath "download.php?id=" $key "</span></p>";
    // Write the key and activation time to the database as a new row
    $registerid mysql_query("INSERT INTO downloadkey (uniqueid,timestamp) VALUES(\"$key\",\"$time\")") or die(mysql_error());
    $r mysqli_query ($dbc);
    if (
    mysqli_affected_rows($dbc) != 1) {
    trigger_error('The download link could not be generated!');
    }                            
    unset(
    $ereader); 
    I have a feeling I am not going about this in the right way so if anyone has any advise I would love to have it. My goal is to read the mc_gross value and create one key for a 9.99 value and three different keys for a 14.99 value. Is that possible using the code in this fashion or do I have to go back to the drawing board?

  2. #2
    Join Date
    Jul 2007
    Location
    Wisconsin
    Posts
    468
    looks like this might be the culprit:

    PHP Code:

    /* 

    this first IF ... you open the parenthesis, you open a second parenthesis for _POST == 9.99 (which doesn't really make sense in the first place...),
    close the second parenthesis... then start a new "if"

    You need to properly close out the IF syntax, then wrap it's contents with { }

    if ($uid ==($_POST['mc_gross'] ==9.99) ){
       // should this just be if ($_POST['mc_gross'] ==9.99) { } ?
    }
    */

    if ($uid ==($_POST['mc_gross'] ==9.99
    // Generate the download key 
    // A script to generate unique download keys for the purpose of protecting downloadable goods 
    if (empty($_SERVER['REQUEST_URI'])) { 
    $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME']; 

    Last edited by OctoberWind; 03-03-2012 at 08:02 PM.

  3. #3
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    22,335
    I suspect you'll want an opening "{" after that if statement, too?
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  4. #4
    Join Date
    Feb 2012
    Posts
    102
    Thanks guys Im surprised I missed that parenthasis. Do either of you think that the code I posted will accomplish my goal of creating a single unique download key for the 9.99 and three different download keys for 14.99? For some reason I dont think I am going about this the right way. Any advise the forum community has would be very helpful.

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.12066 seconds
  • Memory Usage 2,896KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (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
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (4)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)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 (70):
  • 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
  • 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