www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] Error: T_VARIABLE

  1. #1
    Join Date
    Aug 2012
    Location
    Programming
    Posts
    21

    resolved [RESOLVED] Error: T_VARIABLE

    Hiya, I have this error on my script and I don't know what it is. Here's the code: It says I have an error on line 7

    PHP Code:
    <?php

    //Site Name
    $sitename blogpress.webege.com

    //Site Email
    $siteemail demo@blogpress.webege.com

    define
    ('IN_SCRIPT'true);
    // Start a session
    session_start();

    //Connect to the MySQL Database
    include '../common.php';

    //this function will display error messages in alert boxes, used for login forms so if a field is invalid it will still keep the info
    //use error('foobar');
    function error($msg) {
        
    ?>
        <html>
        <head>
        <title>Forgot Password - Blogpress</title>
        <script language="JavaScript">
        <!--
            alert("<?=$msg?>");
            history.back();
        //-->
        </script>
        <script type="text/javascript">

          var _gaq = _gaq || [];
          _gaq.push(['_setAccount', 'UA-35775907-1']);
          _gaq.push(['_trackPageview']);

          (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
          })();

        </script>
        </head>
        <body>
        <style>
        #navigation {
            font-family: Arial, Helvetica, sans-serif;
            background: url(nav-bg.png) no-repeat;
            width: 961px;
            margin-left: -13px;
            height: 68px;
            padding: 0 0 0 25px;
            position: relative;
        }

        #navigation ul {
        }

        #navigation li {
            float: left;
            position: relative;
        }

        #navigation li a {
            float: left;
            display: block;
            color: #fff;
            font-size: 14px;
            text-decoration: none;
            padding: 19px 14px;
            margin: 0 4px 0 0;
            border: 0;
            outline: 0;
        }

        #navigation li a:hover,
        #navigation li#active a {
            color: #ccc;
            background: #1a344b;
        }
        #content {
            min-height: 450px;
            padding: 15px 25px 25px;
            background: #fff;
            text-align: center;
        }
        body {
            background: #778899;
        }
        </style>
        </body>
        </html>
        <?
        exit;
    }

    //This functions checks and makes sure the email address that is being added to database is valid in format. 
    function check_email_address($email) {
      // First, we check that there's one @ symbol, and that the lengths are right
      if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
        // Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
        return false;
      }
      // Split it into sections to make life easier
      $email_array = explode("@", $email);
      $local_array = explode(".", $email_array[0]);
      for ($i = 0; $i < sizeof($local_array); $i++) {
         if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
          return false;
        }
      }  
      if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
        $domain_array = explode(".", $email_array[1]);
        if (sizeof($domain_array) < 2) {
            return false; // Not enough parts to domain
        }
        for ($i = 0; $i < sizeof($domain_array); $i++) {
          if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
            return false;
          }
        }
      }
      return true;
    }


    if (isset($_POST['submit'])) {
        
        if ($_POST['forgotpassword']=='') {
            error('Please Fill in Email.');
        }
        if(get_magic_quotes_gpc()) {
            $forgotpassword = htmlspecialchars(stripslashes($_POST['forgotpassword']));
        } 
        else {
            $forgotpassword = htmlspecialchars($_POST['forgotpassword']);
        }
        //Make sure it's a valid email address, last thing we want is some sort of exploit!
        if (!check_email_address($_POST['forgotpassword'])) {
              error('Email Not Valid - Must be in format of name@domain.tld');
        }
        // Lets see if the email exists
        $sql = "SELECT COUNT(*) FROM users WHERE user_email = '$forgotpassword'";
        $result = mysql_query($sql)or die('Could not find member: ' . mysql_error());
        if (!mysql_result($result,0,0)>0) {
            error('Email Not Found!');
        }

        //Generate a RANDOM MD5 Hash for a password
        $random_password=md5(uniqid(rand()));
        
        //Take the first 8 digits and use them as the password we intend to email the user
        $emailpassword=substr($random_password, 0, 8);
        
        //Encrypt $emailpassword in MD5 format for the database
        $newpassword = md5($emailpassword);
        
            // Make a safe query
               $query = sprintf("UPDATE `users` SET `user_password` = '%s' 
                              WHERE `user_email` = '$forgotpassword'",
                        mysql_real_escape_string($newpassword));
                        
                        mysql_query($query)or die('Could not update members: ' . mysql_error());

    //Email out the infromation
    $subject = "Your New Password"; 
    $message = "Your new password is as follows:
    ---------------------------- 
    Password: $emailpassword
    ---------------------------- 
    Please make note this information has been encrypted into our database 

    This email was automatically generated."; 
                           
              if(!mail($forgotpassword, $subject, $message,  "FROM: $sitename <$siteemail>")){ 
                 die ("Sending Email Failed, Please Contact Site Admin! ($siteemail)"); 
              }else{ 
                    error('New Password Sent!.');
             } 
            
        }
        
    else {
    ?>
          <form name="forgotpasswordform" action="" method="post">
            <table border="0" cellspacing="0" cellpadding="3" width="100%">
              <caption>
              <div>Forgot Password</div>
              </caption>
              <tr>
                <td>Email Address:</td>
                <td><input name="forgotpassword" type="text" value="" id="forgotpassword" /></td>
              </tr>
              <tr>
                <td colspan="2" class="footer"><input type="submit" name="submit" value="Submit" class="mainoption" /></td>
              </tr>
            </table>
          </form>
          <?
    }
    ?>

  2. #2
    Join Date
    Aug 2012
    Location
    Programming
    Posts
    21
    I found out the answer

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.17228 seconds
  • Memory Usage 2,877KB
  • 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
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (2)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)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