Jump to content

asmith

Members
  • Posts

    967
  • Joined

  • Last visited

Posts posted by asmith

  1. No.

     

    To say it simple,

    When accessing a site url like:

    example.com

     

    The actually directory we are visiting it normally something like this:

     

    /www/index.php

    or

    /pubilc_html/index.php

     

    The www/ or public_html/ is called document root.

     

    If a file is stored outside of it, The location would look something like this:

     

    /file.ext or /folder/file.ext

    nobody can access the outside of your document root.

     

    In other words, A folder before the example.com would be ../example.com which no one can access.

  2. You have to send the username the user typed to the comments.php also.

     

    Since you are asking about his username in the first form, So you CAN have it in the second form (Which user picks the comments).

    All you need to do is define the username in the second form, So just something to grab in the comments.php

     

    This can be a good example for you to learn the hidden inputs.

     

    Here: (Where your second form starts)

    echo '

      <form action="comment.php" method="post">

      <h2>POSITIVE Intro Comments</h2>

      <h5>Pick one.</h5>';

     

    add this line after it:

    <input type="hidden" name="username" value="'.$fname.'" />

     

    now in comments.php, the username will be :  $_POST['username']

    and so on accordingly:

     

    echo str_replace('$fname', $_POST['username'], $row);

    But I don't know what is your $row. the way you have coded, I doubt the $row variable will be your db line.

     

     

    [Also, is there a way I can get the combined sentences on comment.php to go into an editable textarea that the user can finalize?]

     

    There is always a way. :)

    Same as what you did in generate_comment. You can put a checkbox next to each comment in the comments or so.

    don't confuse yourself with many tasks though, One by one.

  3. ok I tried you code and it worked here. (I hadmodified your code a bit)

     

    since we are at this point,

    There are lotta ways you can improve performance too.

     

    But for now:

    1. for the closing part you have :

    <input type="radio" name="closing_sentence" value="<?php $ow['comment'] ?>" />

     

    Notice you have missed the letter r there.

     

    2. did you add [] at the end of your body_sentence name? like this:

    <input type="radio" name="body_sentence[]" value="<?php $row['comment'] ?>" />

     

    3. Why you are coding html/php into each other? the readabilty is horrible XD Look at this code:

     

    <?php
    
    //DB connection
    mysql_connect("localhost", "kharkhar", "mangul") or die(mysql_error());
    mysql_select_db("test") or die(mysql_error());
    
    if (isset($_POST['submit']))
    {
    if (!$_POST['fname'] | !$_POST['lname'] | !$_POST['sex'] | !$_POST['level'])
    	die('You did not complete all of the required fields');
    
    
    $fname=$_POST['fname'];
    $lname=$_POST['lname'];
    
    if($_POST['sex']=="male")
    {
    	$pos="his";
    	$pro="he";
    }
    
    if($_POST['sex']=="female")
    {
    	$pos="her";
    	$pro="she";
    }
    
    echo '
    <form action="comment.php" method="post">
    <h2>POSITIVE Intro Comments</h2>
    <h5>Pick one.</h5>';
    
    $result = mysql_query("SELECT * FROM comments WHERE type='intro'");
    while($row = mysql_fetch_array($result))
    {
    	echo '<input type="radio" name="intro_sentence" value="'.$row['comment'].'" />';
    	echo $row['comment'] ;
    	echo '<br />';
    }
    
    $result = mysql_query("SELECT * FROM comments WHERE type='body'");
    
    echo '
    <h2>Body Comments</h2>
    <h5>Pick as many as are appropriate. Try for three.</h5>';
    
    
    while($row = mysql_fetch_array($result))
    {
    	echo '<input type="checkbox" name="body_sentence[]" value="'.$row['comment'].'" />';
    	echo $row['comment'] ;
    	echo "<br />";
    }
    
    $result = mysql_query("SELECT * FROM comments WHERE type='closing'");
    
    echo '
    <h2>POSITIVE Closing Comments</h2>
    <h5>Pick one.</h5>';
    
    
    while($row = mysql_fetch_array($result))
    {
    	echo '<input type="radio" name="closing_sentence" value="'.$row['comment'].'" />';
    	echo $row['comment'] ;
    	echo "<br />";
    }
    
    echo '
    <br /> <br />
    <input type="submit" name="submit" value="Generate Comment" />
    </form>';
    }
    else
    {
    echo '
    <form action="'.$_SERVER['PHP_SELF'].'" method="post">
    <tr><td>Student\'s First Name:</td><td>
    <input type="text" name="fname" size="15">
    </td></tr>
    <tr><td>Student\'s Last Name:</td><td>
    <input type="text" name="lname">
    </td></tr> <br /> <br />
    <tr><td>Level:</td><td>
    <input type="text" name="level" size="10">
    </td></tr> <br /> <br />
    <tr><td>Gender:</td><td> <br /><br />
    <input type="radio" name="sex" value="male" /> Male
    <br />
    <input type="radio" name="sex" value="female" /> Female
    </td></tr> <br />
    
    <tr><th colspan=2><input type="submit" name="submit" value="Go!"></th></tr> </table>
    </form>';
    
    }
    ?>
    

  4. Don't get the continue; meaning wrong ^^

     

    The continue;  SKIPS the current loop, not continuing it.

    and you dont' need for loop anymore since you are pointing to an specific key of the $parts.

     

    So you need to do this:

    if ($parts[2] == 0)

          continue;

  5. If you are getting the $variables by

    global $stat_01_handle, $answer_result;

     

    Why are sending them again to the function?  :

    function stat_01($stat_01_handle, $answer_result)

     

     

    remove the function parameters:

    function stat_01()

     

    But still use the globals:

    function stat_01() {

    global $stat_01_handle, $answer_result;

     

  6. 1. All the send data through the method post are stored in a variable called $_POST.

    So in comments.php,  $_POST['intro_sentence'] will be your intro sentence.

    Same goes for $_POST['closing_sentence']

     

    But won't work for $_POST['body_sentence']. Cause it is a checkbox and the way it is been coded in generate_comment.php can't send multiple data to that. the solution would be :

     

    <?php
    
    while($row = mysql_fetch_array($result))
    {
    ?>
    <input type="checkbox" name="body_sentence[]" value="<?php $row['comment'] ?>" />
    <?php
    
    echo $row['comment'] ;
    echo "<br />";
    }
    

     

    Notice the name="body_sentence[]"

     

    Now in the comments.php your body sentence will be stored in an array:

     

    $_POST['body_sentence']

     

    And body sentences can be accessed like this:

     

    $_POST['body_sentence'][0]

    $_POST['body_sentence'][1]

    $_POST['body_sentence'][2]

    .

    .

    .

     

    2.I'm not sure I have get you right, 

    Have you stored in the database something like this:

    It has been a very productive session for $fname.

    ??

     

    Then if you want to change $fname to "bobby" for example:

    you can go:

     

    <?php
    echo str_replace('$fname', 'bobby', DB_LINE);
    ?>
    

    where DB_LINE is the variable which habe stored your specific line in db.

     

     

  7. <?php
    // Created BY Adam Khoury @ www.developphp.com
    
    // let's initialize vars to be printed to page in the HTML section so our script does not return errors 
    // they must be initialized in some server environments
    $errorMsg = "";
    $username = "";
    $firstname = "";
    $lastname = "";
    $country = "";
    $state = "";
    $city = "";
    $zip = "";
    $website = "";
    $youtube = "";
    $email1 = "";
    $email2 = "";
    $pass1 = "";
    $pass2 = "";
    
    // This code runs only if the form submit button is pressed
    if (isset ($_POST['firstname'])){
       
       /* Example of cleaning variables in a loop
       $vars = "";
       foreach ($_POST as $key => $value) {
           $value = stripslashes($value);
           $vars .= "$key = $value<br />";
        }
        print "$vars";
        exit();
       */
        $username = $_POST['username'];
         $firstname = $_POST['firstname'];
        $lastname = $_POST['lastname'];
         $country = $_POST['country'];
         $state = $_POST['state'];
         $city = $_POST['city'];
         $zip = $_POST['zip'];
         $website = $_POST['website'];
         $youtube = $_POST['youtube'];
         $email1 = $_POST['email1'];
         $email2 = $_POST['email2'];
         $pass1 = $_POST['pass1'];
         $pass2 = $_POST['pass2'];
         $humancheck = $_POST['humancheck'];
    
        $username = stripslashes($username);
         $firstname = stripslashes($firstname);
        $lastname = stripslashes($lastname);
         $state = stripslashes($state);
         $city = stripslashes($city);
         $zip = stripslashes($zip);
         $website = stripslashes($website);
         $youtube = stripslashes($youtube);
         $email1 = stripslashes($email1); 
         $pass1 = stripslashes($pass1); 
         $email2 = stripslashes($email2);
         $pass2 = stripslashes($pass2); 
    
        $username = strip_tags($username);
         $firstname = strip_tags($firstname);
        $lastname = strip_tags($lastname);
         $state = strip_tags($state);
         $city = strip_tags($city);
        $zip = strip_tags($zip);
         $website = strip_tags($website);
         $youtube = strip_tags($youtube);
         $email1 = strip_tags($email1);
         $pass1 = strip_tags($pass1);
         $email2 = strip_tags($email2);
         $pass2 = strip_tags($pass2);
    
         // Connect to database
         include_once "scripts/connect_to_mysql.php";
         $emailCHecker = mysql_real_escape_string($email1);
        $emailCHecker = eregi_replace("`", "", $emailCHecker);
        
        $usernameCHecker = mysql_real_escape_string($username);
        $usernameCHecker = eregi_replace("`", "", $usernameCHecker);
         // Database duplicate e-mail and user name check setup for use below in the error handling if else conditionals
         $sql_email_check = mysql_query("SELECT email FROM myMembers WHERE email='$emailCHecker'");
         $email_check = mysql_num_rows($sql_email_check);
        
        $sql_username_check = mysql_query("SELECT username FROM myMembers WHERE email='$usernameCHecker'");
        $username_check = mysql_num_rows($sql_username_check);
    
         // Error handling for missing data
         if ((!$username) || (!$firstname) || (!$lastname) || (!$country) || (!$state) || (!$city) || (!$zip) || (!$email1) || (!$email2) || (!$pass1) || (!$pass2)) { 
    
         $errorMsg = 'ERROR: You did not submit the following required information:<br /><br />';
      
          if(!$username){
          $errorMsg .= ' * User Name<br />';
        }
         if(!$firstname){ 
           $errorMsg .= ' * First Name<br />';
         } 
        if(!$lastname){ 
           $errorMsg .= ' * Last Name<br />';
         } 
         if(!$country){ 
           $errorMsg .= ' * Country<br />';
         }    
        if(!$state){ 
           $errorMsg .= ' * State or Provice<br />';      
         }
        if(!$city){ 
           $errorMsg .= ' * City<br />';        
         } 
        if(!$zip){ 
           $errorMsg .= ' * Postal or Zip Code<br />';        
         }       
        if(!$email1){ 
           $errorMsg .= ' * Email Address<br />';      
         }
        if(!$email2){ 
           $errorMsg .= ' * Confirm Email Address<br />';        
         }    
        if(!$pass1){ 
           $errorMsg .= ' * Login Password<br />';      
         }
        if(!$pass2){ 
           $errorMsg .= ' * Confirm Login Password<br />';        
         }    
       
         } else if ($email1 != $email2) {
                  $errorMsg = 'ERROR: Your Email fields below do not match<br />';
         } else if ($pass1 != $pass2) {
                  $errorMsg = 'ERROR: Your Password fields below do not match<br />';
         } else if ($humancheck != "") {
                  $errorMsg = 'ERROR: The Human Check field must be cleared to be sure you are human<br />';       
         } else if ($email_check > 0) { 
                  $errorMsg = "<u>ERROR:</u><br />Your Email address is already in use inside our database. Please use another.<br />"; 
        } else if ($username_check > 0) {
                $errorMsg = "<u>ERROR:</u><br />Your User Name is already in use inside our database. Please use another.<br> />";
         
        } else { // Error handling is ended, process the data and add member to database
         ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
       
        $username = mysql_real_escape_string($username);
        $firstname = mysql_real_escape_string($firstname);
        $lastname = mysql_real_escape_string($lastname);
         $state = mysql_real_escape_string($state);
         $city = mysql_real_escape_string($city);
        $zip = mysql_real_escape_string($zip);
         $website = mysql_real_escape_string($website);
        $youtube = mysql_real_escape_string($youtube);
         $email1 = mysql_real_escape_string($email1);
         $pass1 = mysql_real_escape_string($pass1);
        
        $username = eregi_replace("`", "", $username);
        $firstname = eregi_replace("`", "", $firstname);
        $lastname = eregi_replace("`", "", $lastname);
        $state = eregi_replace("`", "", $state);
        $city = eregi_replace("`", "", $city);
        $zip = eregi_replace("`", "", $zip);
        $website = eregi_replace("`", "", $website);
        $youtube = eregi_replace("`", "", $youtube);
        $email1 = eregi_replace("`", "", $email1);
        $pass1 = eregi_replace("`", "", $pass1);
    
         $website = eregi_replace("http://", "", $website);
        $youtube = eregi_replace("http://www.youtube.com/user/", "", $youtube); 
        
         // Add MD5 Hash to the password variable
         $db_password = md5($pass1); 
    
         // Add user info into the database table for the main site table(audiopeeps.com)
         $sql = mysql_query("INSERT INTO myMembers (username, firstname, lastname, country, state, city, zip, email, password, sign_up_date, website, youtube) 
         VALUES('$username','$firstname','$lastname','$country','$state','$city','$zip','$email1','$db_password', now(),'$website','$youtube')")  
         or die (mysql_error());
    
         $id = mysql_insert_id();
        
        // Create directory(folder) to hold each user's files(pics, MP3s, etc.)      
         mkdir("members/$id", 0755);   
    
        //!!!!!!!!!!!!!!!!!!!!!!!!!    Email User the activation link    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        $to = "$email1";
                                   
        $from = "system@localhost";
        $subject = "Complete yourdomain registration";
        //Begin HTML Email Message
        $message = "Hi $firstname,
    
       Complete this step to activate your login identity at iHost.
    
       Click the line below to activate when ready.
    
       http://localhost/ihost/root/activation.php?id=$id&sequence=$db_password
       If the URL above is not an active link, please copy and paste it into your browser address bar
    
       Login after successful activation using your:  
       E-mail Address: $email1 
       Password: $pass1
    
       See you on the site!";
       
       //end of message
       $headers  = "From: $from\r\n";
        $headers .= "Content-type: text\r\n";
    
        mail($to, $subject, $message, $headers);
       
       $msgToUser = "<h2>One Last Step - Activate through Email</h2><h4>OK $firstname, one last step to verify your email identity:</h4><br />
       In a moment you will be sent an Activation link to your email address.<br /><br />
       <br />
       <strong><font color=\"#990000\">VERY IMPORTANT:</font></strong> 
       If you check your email with your host providers default email application, there may be issues with seeing the email contents.  If this happens to you and you cannot read the message to activate, download the file and open using a text editor. If you still cannot see the activation link, contact site admin and briefly discuss the issue.<br /><br />
       ";
    
    
       include_once 'msgToUser.php'; 
    
       exit();
    
       } // Close else after duplication checks
    
    } else { // if the form is not posted with variables, place default empty variables
         
         $errorMsg = "Fields marked with an [ * ] are required";
          $username = "";
         $firstname = "";
         $lastname = "";
         $country = "";
         $state = "";
         $city = "";
         $zip = "";
         $website = "";
         $youtube = "";
         $email1 = "";
         $email2 = "";
         $pass1 = "";
         $pass2 = "";
    }
    
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <meta name="Description" content="Register to yourdomain" />
    <meta name="Keywords" content="register, yourdomain" />
    <meta name="rating" content="General" />
    <title>iHost</title>
    <link href="style/main.css" rel="stylesheet" type="text/css" />
    <link rel="icon" href="http://www.yourdomain.com/favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="http://www.yourdomain.com/favicon.ico" type="image/x-icon" />
    <style type="text/css">
    <!--
    body {
       margin-top: 0px;
    }
    -->
    </style></head>
    
    <body>
    <?php include_once("header.php"); ?>
    <table width="904" align="center" cellspacing="0">
      <tr>
        <td width="758">
          <blockquote>
            <h2><br />
              Create Your Account            </h2>
          </blockquote>
          <table width="600" align="center" cellpadding="5">
            <form action="register.php" method="post" enctype="multipart/form-data">
              <tr>
                <td width="125" class="style7"><div align="center"><strong>Please Do First →</strong></div></td>
                <td width="447" bgcolor="#FFFFFF">Add <a href="mailto:admin@yourdomain.com"><u>system@localhost</u></a> to your email white list or safe sender list now, or else you might not get the activation email that is necessary for logging in successfully. </td>
              </tr>
              <tr>
                <td colspan="2"><font color="#FF0000"><?php print "$errorMsg"; ?></font></td>
              </tr>
              <tr>
                <td align="right" class="alignRt">User Name:<span class="brightRed">*</span></td>
                <td><input name="username" type="text" class="formFields" id="username" value="<?php print "$username"; ?>" size="32" maxlength="20" /></td>
              </tr>               
              <tr>
                <td align="right" class="alignRt">First Name:<span class="brightRed">*</span></td>
                <td><input name="firstname" type="text" class="formFields" id="firstname" value="<?php print "$firstname"; ?>" size="32" maxlength="20" /></td>
              </tr>
              <tr>
                <td align="right" class="alignRt">Last Name:<span class="brightRed">*</span></td>
                <td><input name="lastname" type="text" class="formFields" id="lastname" value="<?php print "$lastname"; ?>" size="32" maxlength="20" /></td>
              </tr>                   
              <tr>
                <td align="right" class="alignRt">Country:<span class="brightRed">*</span></td>
                <td>
                  <select name="country" class="formFields">
                    <option value="<?php print "$country"; ?>"><?php print "$country"; ?></option>
                    <option value="United States of America" selected="selected">United States of America</option>
                    <option value="Afghanistan">Afghanistan</option>
                    <option value="Albania">Albania</option>
                    <option value="Algeria">Algeria</option>
                    <option value="American Samoa">American Samoa</option>
                    <option value="Andorra">Andorra</option>
                    <option value="Angola">Angola</option>
                    <option value="Anguilla">Anguilla</option>
                    <option value="Antigua and Barbuda">Antigua and Barbuda</option>
                    <option value="Argentina">Argentina</option>
                    <option value="Armenia">Armenia</option>
                    <option value="Aruba">Aruba</option>
                    <option value="Australia">Australia</option>
                    <option value="Austria">Austria</option>
                    <option value="Azerbaijan">Azerbaijan</option>
                    <option value="Bahamas">Bahamas</option>
                    <option value="Bahrain">Bahrain</option>
                    <option value="Bangladesh">Bangladesh</option>
                    <option value="Barbados">Barbados</option>
                    <option value="Belarus">Belarus</option>
                    <option value="Belgium">Belgium</option>
                    <option value="Belize">Belize</option>
                    <option value="Benin">Benin</option>
                    <option value="Bermuda">Bermuda</option>
                    <option value="Bhutan">Bhutan</option>
                    <option value="Bolivia">Bolivia</option>
                    <option value="Bonaire">Bonaire</option>
                    <option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option>
                    <option value="Botswana">Botswana</option>
                    <option value="Brazil">Brazil</option>
                    <option value="British Indian Ocean Ter">British Indian Ocean Ter</option>
                    <option value="Brunei">Brunei</option>
                    <option value="Bulgaria">Bulgaria</option>
                    <option value="Burkina Faso">Burkina Faso</option>
                    <option value="Burundi">Burundi</option>
                    <option value="Cambodia">Cambodia</option>
                    <option value="Cameroon">Cameroon</option>
                    <option value="Canada">Canada</option>
                    <option value="Canary Islands">Canary Islands</option>
                    <option value="Cape Verde">Cape Verde</option>
                    <option value="Cayman Islands">Cayman Islands</option>
                    <option value="Central African Republic">Central African Republic</option>
                    <option value="Chad">Chad</option>
                    <option value="Channel Islands">Channel Islands</option>
                    <option value="Chile">Chile</option>
                    <option value="China">China</option>
                    <option value="Christmas Island">Christmas Island</option>
                    <option value="Cocos Island">Cocos Island</option>
                    <option value="Columbia">Columbia</option>
                    <option value="Comoros">Comoros</option>
                    <option value="Congo">Congo</option>
                    <option value="Cook Islands">Cook Islands</option>
                    <option value="Costa Rica">Costa Rica</option>
                    <option value="Cote D'Ivoire">Cote D'Ivoire</option>
                    <option value="Croatia">Croatia</option>
                    <option value="Cuba">Cuba</option>
                    <option value="Curacao">Curacao</option>
                    <option value="Cyprus">Cyprus</option>
                    <option value="Czech Republic">Czech Republic</option>
                    <option value="Denmark">Denmark</option>
                    <option value="Djibouti">Djibouti</option>
                    <option value="Dominica">Dominica</option>
                    <option value="Dominican Republic">Dominican Republic</option>
                    <option value="East Timor">East Timor</option>
                    <option value="Ecuador">Ecuador</option>
                    <option value="Egypt">Egypt</option>
                    <option value="El Salvador">El Salvador</option>
                    <option value="Equatorial Guinea">Equatorial Guinea</option>
                    <option value="Eritrea">Eritrea</option>
                    <option value="Estonia">Estonia</option>
                    <option value="Ethiopia">Ethiopia</option>
                    <option value="Falkland Islands">Falkland Islands</option>
                    <option value="Faroe Islands">Faroe Islands</option>
                    <option value="Fiji">Fiji</option>
                    <option value="Finland">Finland</option>
                    <option value="France">France</option>
                    <option value="French Guiana">French Guiana</option>
                    <option value="French Polynesia">French Polynesia</option>
                    <option value="French Southern Ter">French Southern Ter</option>
                    <option value="Gabon">Gabon</option>
                    <option value="Gambia">Gambia</option>
                    <option value="Georgia">Georgia</option>
                    <option value="Germany">Germany</option>
                    <option value="Ghana">Ghana</option>
                    <option value="Gibraltar">Gibraltar</option>
                    <option value="Great Britain">Great Britain</option>
                    <option value="Greece">Greece</option>
                    <option value="Greenland">Greenland</option>
                    <option value="Grenada">Grenada</option>
                    <option value="Guadeloupe">Guadeloupe</option>
                    <option value="Guam">Guam</option>
                    <option value="Guatemala">Guatemala</option>
                    <option value="Guinea">Guinea</option>
                    <option value="Guyana">Guyana</option>
                    <option value="Haiti">Haiti</option>
                    <option value="Hawaii">Hawaii</option>
                    <option value="Honduras">Honduras</option>
                    <option value="Hong Kong">Hong Kong</option>
                    <option value="Hungary">Hungary</option>
                    <option value="Iceland">Iceland</option>
                    <option value="India">India</option>
                    <option value="Indonesia">Indonesia</option>
                    <option value="Iran">Iran</option>
                    <option value="Iraq">Iraq</option>
                    <option value="Ireland">Ireland</option>
                    <option value="Isle of Man">Isle of Man</option>
                    <option value="Israel">Israel</option>
                    <option value="Italy">Italy</option>
                    <option value="Jamaica">Jamaica</option>
                    <option value="Japan">Japan</option>
                    <option value="Jordan">Jordan</option>
                    <option value="Kazakhstan">Kazakhstan</option>
                    <option value="Kenya">Kenya</option>
                    <option value="Kiribati">Kiribati</option>
                    <option value="Korea North">Korea North</option>
                    <option value="Korea South">Korea South</option>
                    <option value="Kuwait">Kuwait</option>
                    <option value="Kyrgyzstan">Kyrgyzstan</option>
                    <option value="Laos">Laos</option>
                    <option value="Latvia">Latvia</option>
                    <option value="Lebanon">Lebanon</option>
                    <option value="Lesotho">Lesotho</option>
                    <option value="Liberia">Liberia</option>
                    <option value="Libya">Libya</option>
                    <option value="Liechtenstein">Liechtenstein</option>
                    <option value="Lithuania">Lithuania</option>
                    <option value="Luxembourg">Luxembourg</option>
                    <option value="Macau">Macau</option>
                    <option value="Macedonia">Macedonia</option>
                    <option value="Madagascar">Madagascar</option>
                    <option value="Malaysia">Malaysia</option>
                    <option value="Malawi">Malawi</option>
                    <option value="Maldives">Maldives</option>
                    <option value="Mali">Mali</option>
                    <option value="Malta">Malta</option>
                    <option value="Marshall Islands">Marshall Islands</option>
                    <option value="Martinique">Martinique</option>
                    <option value="Mauritania">Mauritania</option>
                    <option value="Mauritius">Mauritius</option>
                    <option value="Mayotte">Mayotte</option>
                    <option value="Mexico">Mexico</option>
                    <option value="Midway Islands">Midway Islands</option>
                    <option value="Moldova">Moldova</option>
                    <option value="Monaco">Monaco</option>
                    <option value="Mongolia">Mongolia</option>
                    <option value="Montserrat">Montserrat</option>
                    <option value="Morocco">Morocco</option>
                    <option value="Mozambique">Mozambique</option>
                    <option value="Myanmar">Myanmar</option>
                    <option value="Nambia">Nambia</option>
                    <option value="Nauru">Nauru</option>
                    <option value="Nepal">Nepal</option>
                    <option value="Netherland Antilles">Netherland Antilles</option>
                    <option value="Netherlands">Netherlands</option>
                    <option value="Nevis">Nevis</option>
                    <option value="New Caledonia">New Caledonia</option>
                    <option value="New Zealand">New Zealand</option>
                    <option value="Nicaragua">Nicaragua</option>
                    <option value="Niger">Niger</option>
                    <option value="Nigeria">Nigeria</option>
                    <option value="Niue">Niue</option>
                    <option value="Norfolk Island">Norfolk Island</option>
                    <option value="Norway">Norway</option>
                    <option value="Oman">Oman</option>
                    <option value="Pakistan">Pakistan</option>
                    <option value="Palau Island">Palau Island</option>
                    <option value="Palestine">Palestine</option>
                    <option value="Panama">Panama</option>
                    <option value="Papua New Guinea">Papua New Guinea</option>
                    <option value="Paraguay">Paraguay</option>
                    <option value="Peru">Peru</option>
                    <option value="Philippines">Philippines</option>
                    <option value="Pitcairn Island">Pitcairn Island</option>
                    <option value="Poland">Poland</option>
                    <option value="Portugal">Portugal</option>
                    <option value="Puerto Rico">Puerto Rico</option>
                    <option value="Qatar">Qatar</option>
                    <option value="Reunion">Reunion</option>
                    <option value="Romania">Romania</option>
                    <option value="Russia">Russia</option>
                    <option value="Rwanda">Rwanda</option>
                    <option value="St Barthelemy">St Barthelemy</option>
                    <option value="St Eustatius">St Eustatius</option>
                    <option value="St Helena">St Helena</option>
                    <option value="St Kitts-Nevis">St Kitts-Nevis</option>
                    <option value="St Lucia">St Lucia</option>
                    <option value="St Maarten">St Maarten</option>
                    <option value="St Pierre and Miquelon">St Pierre and Miquelon</option>
                    <option value="St Vincent and Grenadines">St Vincent and Grenadines</option>
                    <option value="Saipan">Saipan</option>
                    <option value="Samoa">Samoa</option>
                    <option value="Samoa American">Samoa American</option>
                    <option value="San Marino">San Marino</option>
                    <option value="Sao Tome and Principe">Sao Tome and Principe</option>
                    <option value="Saudi Arabia">Saudi Arabia</option>
                    <option value="Senegal">Senegal</option>
                    <option value="Seychelles">Seychelles</option>
                    <option value="Serbia and Montenegro">Serbia and Montenegro</option>
                    <option value="Sierra Leone">Sierra Leone</option>
                    <option value="Singapore">Singapore</option>
                    <option value="Slovakia">Slovakia</option>
                    <option value="Slovenia">Slovenia</option>
                    <option value="Solomon Islands">Solomon Islands</option>
                    <option value="Somalia">Somalia</option>
                    <option value="South Africa">South Africa</option>
                    <option value="Spain">Spain</option>
                    <option value="Sri Lanka">Sri Lanka</option>
                    <option value="Sudan">Sudan</option>
                    <option value="Suriname">Suriname</option>
                    <option value="Swaziland">Swaziland</option>
                    <option value="Sweden">Sweden</option>
                    <option value="Switzerland">Switzerland</option>
                    <option value="Syria">Syria</option>
                    <option value="Tahiti">Tahiti</option>
                    <option value="Taiwan">Taiwan</option>
                    <option value="Tajikistan">Tajikistan</option>
                    <option value="Tanzania">Tanzania</option>
                    <option value="Thailand">Thailand</option>
                    <option value="Togo">Togo</option>
                    <option value="Tokelau">Tokelau</option>
                    <option value="Tonga">Tonga</option>
                    <option value="Trinidad and Tobago">Trinidad and Tobago</option>
                    <option value="Tunisia">Tunisia</option>
                    <option value="Turkey">Turkey</option>
                    <option value="Turkmenistan">Turkmenistan</option>
                    <option value="Turks and Caicos Is">Turks and Caicos Is</option>
                    <option value="Tuvalu">Tuvalu</option>
                    <option value="Uganda">Uganda</option>
                    <option value="Ukraine">Ukraine</option>
                    <option value="United Arab Emirates">United Arab Emirates</option>
                    <option value="United Kingdom">United Kingdom</option>
                    <option value="United States of America">United States of America</option>
                    <option value="Uruguay">Uruguay</option>
                    <option value="Uzbekistan">Uzbekistan</option>
                    <option value="Vanuatu">Vanuatu</option>
                    <option value="Vatican City State">Vatican City State</option>
                    <option value="Venezuela">Venezuela</option>
                    <option value="Vietnam">Vietnam</option>
                    <option value="Virgin Islands (Brit)">Virgin Islands Brit</option>
                    <option value="Virgin Islands (USA)">Virgin Islands USA</option>
                    <option value="Wake Island">Wake Island</option>
                    <option value="Wallis and Futana Is">Wallis and Futana Is</option>
                    <option value="Yemen">Yemen</option>
                    <option value="Zaire">Zaire</option>
                    <option value="Zambia">Zambia</option>
                    <option value="Zimbabwe">Zimbabwe</option>
                  </select>
                </td>
              </tr>
              <tr>
                <td align="right" class="alignRt">State/Province:<span class="brightRed">*</span></td>
                <td><input name="state" type="text" class="formFields" id="state" value="<?php print "$state"; ?>" size="32" maxlength="36" /></td>
              </tr>
              <tr>
                <td align="right" class="alignRt">City:<span class="brightRed">*</span></td>
                <td><input name="city" type="text" class="formFields" id="city" value="<?php print "$city"; ?>" size="32" maxlength="36" /></td>
              </tr>
              <tr>
                <td align="right" class="alignRt">Postal / Zip Code:<span class="brightRed">*</span></td>
                <td><input name="zip" type="text" class="formFields" id="zip" value="<?php print "$zip"; ?>" size="32" maxlength="24" /></td>
              </tr>
              <tr>
                <td align="right" class="alignRt">Website:</td>
                <td><strong>http://</strong>
                <input name="website" type="text" class="formFields" id="website" value="<?php print "$website"; ?>" size="40" maxlength="88" /></td>
              </tr>
              <tr>
                <td align="right" class="alignRt">Youtube Channel:</td>
                <td><strong>http://www.youtube.com/user/</strong>
                <input name="youtube" type="text" class="formFields" id="youtube" value="<?php print "$youtube"; ?>" size="32" maxlength="88" /></td>
              </tr>         
              <tr>
                <td align="right" class="alignRt">Email Address:<span class="brightRed">*</span></td>
                <td><input name="email1" type="text" class="formFields" id="email1" value="<?php print "$email1"; ?>" size="32" maxlength="48" /></td>
              </tr>
              <tr>
                <td align="right" class="alignRt">Confirm Email:<span class="brightRed">*</span></td>
                <td><input name="email2" type="text" class="formFields" id="email2" value="<?php print "$email2"; ?>" size="32" maxlength="48" /></td>
              </tr>
              <tr>
                <td align="right" class="alignRt">Create Password:<span class="brightRed">*</span></td>
                <td><input name="pass1" type="password" class="formFields" id="pass1" maxlength="16" />
                  <span class="textSize_9px"><span class="greyColor">Alphanumeric Characters Only</span></span></td>
              </tr>
              <tr>
                <td align="right" class="alignRt">Confirm Password:<span class="brightRed">*</span></td>
                <td><input name="pass2" type="password" class="formFields" id="pass2" maxlength="16" />
                <span class="textSize_9px"><span class="greyColor">Alphanumeric Characters Only</span></span></td>
              </tr>
              <tr>
                <td align="right" class="alignRt"><br />
                  Human Check: <span class="brightRed">*</span></td>
                <td><br />
                  <input name="humancheck" type="text" class="formFields" id="humancheck" value="Please remove all of this text" size="38" maxlength="32" />
                  </td>
              </tr>
              <tr>
                <td> </td>
                <td><p><br />
                  <input type="submit" name="Submit3" value="Submit Form" />
                </p></td>
              </tr>
            </form>
          </table>
          <br />
          <br /></td>
        <td width="180" valign="top"><?php include_once "right_AD_template.php"; ?></td>
      </tr>
    </table>
    <?php include_once("footer.php"); ?>
    </body>
    </html>
    
    

  8. Yes:

     

    <?php
    while (!feof($file_handle) ) {
    
    $fieldNumbers = 0;
    foreach ($parts as $theField)
         if ($theField == '')
              $fieldNumbers++;
    
    if ($fieldNumbers == count($parts))
         continue;
    
    $sql="INSERT INTO smail (deliveryDate, psNumber, numItems,
    volume, customerName, address1, address2, address3)
    VALUES
    ('$datestore','$parts[2]','$parts[3]','$parts[7]','$parts[1]','$parts[4]','$parts[5]','$parts[6]')";
    
    mysql_query($sql);
    
    }
    ?>
    

     

    I set a counter to count how many fields are empty. The counter is $fieldNumbers

    After counting them, I checked to see if the number of empty fields ($fieldNumbers) is equal to the number of fields (count($parts)), If they were equal then it will skip the current loop. (continue;)

  9. Did you try it?

     

    If you are looking for 6, That query won't give you results when there are numbers which contain 6 in them. That's this query :

     

    $uquery = mysql_query("select userid,username,membergroupids from user WHERE membergroupids

    LIKE '%YOUR NUMBER%'") or die(mysql_error());

     

    FIND_IN_SET will actually search between the comas to find your number.

  10. Do this modify:

     

    <?
    while (!feof($file_handle) ) {
    
    foreach ($parts as $theField)
         if ($theField == '')
              continue;
    
    $sql="INSERT INTO smail (deliveryDate, psNumber, numItems,
    volume, customerName, address1, address2, address3)
    VALUES
    ('$datestore','$parts[2]','$parts[3]','$parts[7]','$parts[1]','$parts[4]','$parts[5]','$parts[6]')";
    
    mysql_query($sql);
    
    }
    ?>
    

     

    Notcie as the foreach part, If goes through each of your $parts variable and if one of them was totally empty if will ignore that loop and goes to next.

     

    if there will be times that one of the field CAN be empty and you still wanna record other values, You can modify the foreach part to set conditions on how to set it for the ignore.

  11. Here's The Query that will solve your problem, As long as you seprate your values with coma:

     

    $uquery = mysql_query("select userid,username,membergroupids from user WHERE FIND_IN_SET('YOUR NUMBER', membergroupids)") or die(mysql_error());

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.