need urgent help with this code!

Discussion in 'PHP' started by niravdave, Oct 12, 2008.

  1. #1
    i need urgent help. For some reason the code below
    <?php if ($success) { ?> is displayed in black. Can to you help me on figuring out whats wrong with the code below?

    I keep on getting the error

    Parse error: syntax error, unexpected T_ELSEIF in /home/content... on line 159

    help appreciated!


    <div>
    
    <?php if ($success) { ?>
    
    elseif ($_GET['type'] == "account" && $_GET['email'] && $_GET['codemd5'])
    	{
    
    	if($sef_urls) $adlink = "$script_url/{$vbasedir}account.html";
    	else $adlink = "$script_url/?view=account";
    
    	$sql = "UPDATE $t_members SET verified = '1' where MD5(email) = '$_GET[email]' AND
    				MD5(code) = '$_GET[codemd5]' AND
    				verified = '0'";
    	mysql_query($sql) or die(mysql_error());
    
    	if(mysql_affected_rows())
    		{
    		$success = 1;
    		$showlinkacc = 1;
    		
    		$title = $lang['EMAIL_VERIFIED'];
    		$msg = $lang['MESSAGE_EMAIL_VERIFIED_ACC'];
    		}
    	else
    		$err = $lang['ERROR_INVALID_ACTIVATION_LINK'];
    
    	unset($_GET['type'], $_GET['email'], $_GET['codemd5']);
    }
    //=============================================*/
    Code (markup):

     
    niravdave, Oct 12, 2008 IP
  2. mehdi

    mehdi Peon

    Messages:
    258
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    There are two problems... i marked it in Bold:

    <?php if ($success) { ?>

    elseif ($_GET['type'] == "account" && $_GET['email'] && $_GET['codemd5'])

    1. You closed php coding and forget to start. (?>)
    2. You are using elseif without closing your first IF statement.

    Correct Code:
    
    <div>
    
    [B]<?php if ($success) { 
    }[/B]
    elseif ($_GET['type'] == "account" && $_GET['email'] && $_GET['codemd5'])
    [B]	{[/B]
    
    	if($sef_urls) $adlink = "$script_url/{$vbasedir}account.html";
    	else $adlink = "$script_url/?view=account";
    
    	$sql = "UPDATE $t_members SET verified = '1' where MD5(email) = '$_GET[email]' AND
    				MD5(code) = '$_GET[codemd5]' AND
    				verified = '0'";
    	mysql_query($sql) or die(mysql_error());
    
    	if(mysql_affected_rows())
    		{
    		$success = 1;
    		$showlinkacc = 1;
    		
    		$title = $lang['EMAIL_VERIFIED'];
    		$msg = $lang['MESSAGE_EMAIL_VERIFIED_ACC'];
    		}
    	else
    		$err = $lang['ERROR_INVALID_ACTIVATION_LINK'];
    
    	unset($_GET['type'], $_GET['email'], $_GET['codemd5']);
    }
    //=============================================*/
    
    Code (markup):
     
    mehdi, Oct 12, 2008 IP
    niravdave likes this.
  3. niravdave

    niravdave Active Member

    Messages:
    675
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    88
    #3
    mehdi,

    people like you are stars of DP! thank you so much for taking out time to help me on this as it was very urgent. I really appreciate your help.

    Cheers
    nirav!

     
    niravdave, Oct 12, 2008 IP
  4. mehdi

    mehdi Peon

    Messages:
    258
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks man :)
     
    mehdi, Oct 12, 2008 IP
  5. ozairkhan

    ozairkhan Banned

    Messages:
    94
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    it is not possible here i am giving u a blog url that is on php it might be help u
    so visit learnerphp.blogspot.com
    best wishes
     
    ozairkhan, Oct 12, 2008 IP