Jump to content

cpd

Members
  • Posts

    883
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by cpd

  1. In the long run if you repeatedly try to authenticate and use the protocol incorrectly from the same IP address you can get your IP address blacklisted.
  2. Did you append the subject to the $headers variable? $headers = "MIME-Version: 1.0" . $newLine; $headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine; $headers .= "To: $nameto <$to>" . $newLine; $headers .= "From: $namefrom <$from>" . $newLine; $headers.= "Subject: ".$subject. $newLine; On a side note, I don't think your using the protocol properly. For authentication I've been reading you should use the EHLO command as opposed to HELO and it should be before the AUTH command. I may be completely wrong because I haven't studied the protocol in depth as there's little point but from what I've read the authentication extension to SMTP uses EHLO instead of HELO and its executed in a different order to what you have. Read up on RFC 4954. Again, I'm not 100% because I haven't studied it enough, only skimmed through.
  3. fputs($smtpConnect, "To:$to\nFrom: $from\nSubject: $subject\n$headers\n\n $message\n.\n"); Looks like that's the problematic line. Even though $headers is being constructed you're putting From: in front already. You'll notice there is no $fromname there. Remove To/From from that line and append Subject: to the end of the $headers variable then remove the Subject: from that line and have: fputs($smtpConnect, "$headers\n\n $message\n.\n"); That should clear it up.
  4. I doubt its an issue because it works fine for me using that PHP version. Are you sure your not accidently running session_destroy somewhere?
  5. You realise if you execute the page that sets the WSuser it overwrites the variable because you've not put any checks in to test if its already set...
  6. You call the function by saying authSendEmail('cpd@domain.com', 'CPD', ...). Whats the argument you pass in replacement of 'CPD' here?
  7. I can't see why it would remove the session data. Have you tried var_dump($_SESSION) to see what it contains?
  8. Your going through the entire handshake here and that can be avoided if you use a library or something. PHPMailer is a good library. With regards to your specific issue you need to check what your passing as the $namefrom argument. There's nothing I can see after scanning the function that would alter it.
  9. A quick explanation on arrays. You can think of an array as many variables all wrapped up into one. For example: <?php $firstname1 = 'Joe'; $firstname2 = 'Tom'; echo $firstname1; echo $firstname2; // Can be easily simplified using an array $names = array(); $names[] = 'Joe'; $names[] = 'Tome'; foreach($names as $name) echo $name; ?> The [] on the end of the $names variable just increments the array index by 1. You could also do: <?php $names = array(); $names[0] = 'Joe'; $names[1] = 'Tome'; ?> This is almost the same but your setting the index manually. You can also use strings as indexes, as you want to, but it often infers the need of a multidimensional array - or more easily put: arrays within arrays. So if we we're to use firstname and lastname <?php $names[] = array("firstname" => "Joe", "lastname" => "Blogs"); $names[] = array("firstname" => "Tom", "lastname" => "Finn"); // The names array can be printed out using var_dump or print_r producing something similar to... array([0] = array( "firstname" = "Joe", "lastname" = "blogs" ), [1] = array( "firstname" = "Tom", "lastname" = "Finn" ) ) ?> You've effectively built a structure you can then cycle through using the foreach($names as $name) syntax. There are a tone of other examples on the net you can search for - probably slightly easier to understand as well. With regards to your specific question #2 I think you're actually asking 2 separate questions. 1) How do you add data to an array; 2) How can you take data input thats in the form of an array and add it to a query string. The first question is answered above. You can use $array[] = 'Value'; or $array['my_string_index'] = 'Value'. Similarly you can do $array[] = $row['field_name'] as the $row['field_name'] points to a value. 2. Building further on what PFMaBiSmAd said, the $_POST['option'] looks like: $_POST['option'][1] $_POST['option'][2] So its multidimensional and he has cycled through the second dimension using a foreach loop with foreach($_POST['option']...). The $key => $value allows you to access both the index and value so in the first cycle $key = 1 and $value equals the selected option by the end user. In the second cycle $key = 2 and so on. You can then in the foreach loop append the $value to a query string.
  10. Your setting the connection time-out as opposed to an execution time-out. How long it takes for a connection to establish is different to how long it takes for a response. The connection could be taking 0.5 seconds to be established whilst the server takes 7 seconds to actually deliver a response. If you were to use the CURL_TIMEOUT option I believe it'll then return false.
  11. And your escaping stuff you don't need to.
  12. Paste what you've done because you've got a redirect in there with a last option. Moreover, you've got unnecessary stuff in that file. RewriteCond %{HTTP_HOST} ^(www\.)?joytothewild\.com$ RewriteRule ^(.*)$ "http\:\/\/www\.joytothewildphotos\.com\/$1" [R=301,L] I'm not really sure what the deal with <Files> is but it looks like your denying the use of any htaccess files....
  13. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) $1.php [QSA,L]
  14. I honestly don't like the fact the website loads and you have to scroll down half way just to bring it into focus. I understand you've probably done it because of the background but why has someone come to your site? To see a massive pretty picture or read your resume and hire you?
  15. You've got to understand the query and its syntax are completely valid. Your issue does not lie with your code it lies with what your actually asking the DBMS for. For example. When you say $product = 'Coffee' your asking the database for all results where the product field has "Coffee" and the variation field has a 1 in it - this will return a single row from the images provided. If you have $product = 'Tea' your asking the database for all results where the product field has "Tea" and variation field has a 1 in it - this returns no data because there are no rows with "Tea" in it, the fact there are rows with variation = 1 is now irrelevant because the first criteria did not match. If however you said "WHERE product = 'Tea' OR variation = 1" you would have received 1 result again because there is a single row with variation = 1. The two criteria are independent of each other because you've replaced the AND with an OR. This explains why you receive no errors because the query is actually valid but there are no matches for what your asking so you get a result set with 0 records. Lesson is when using AND the criteria are dependent on each other unlike OR which makes them independent. An easy way to visually represent this is with parenthesis. $sql = "SELECT * FROM `test_tbl` WHERE (`field1` = 'Val1' AND `field2` = 'Val2) OR (`field3` = 'Val3' AND `field4` = 'Val4') OR `anythingField` = 'anything'"
  16. I've never heard of a file extension containing a variable, ever! (Someone please correct me if that's wrong, but I doubt it). Microsoft Agent file known as an Agent Character Animation file. Further details @http://www.fileinfo.com/extension/aca. And just because a piece of software can open a file it doesn't mean the file is associated with it. In-fact, file extensions are interpreted by the operating system with the files system defining the rules for how to identify the file extension which may well be disguised. Notepad for example can open almost anything, it doesn't mean anything is associated with it however.
  17. Whilst its a solution I really wouldn't go down the line xyph suggested. You could loose a chunk of data you need very easily. Its faster than Barands suggestion but has consequences.
  18. If you're getting an empty result set its because the "WHERE" clause matches nothing in the database. First confirm if $_POST['name'] actually contains the expected value, my suspicion is it doesn't.
  19. SELECT * FROM `fruits` WHERE `fruit` LIKE '%apples%bananas%' With a large amount of records this will probably get quite intensive though as it searches every record in the table.
  20. You said it yourself: "this can be done in many different ways". How I would approach a project may be completely different to how ChristianF approaches projects. Everyone can offer a method for tackling your problem/idea but its ultimately up to you. If we were to discuss the best approach you'd quickly end up with pages of posts debating the best ways to go about completing the task in question. If you want a starting point I'd recommend starting with the database and thinking about the entities (tables) and attributes (fields) you'll need. You start with the database because your code and its structure is dependent on it - to a degree. If you're using MySQL read up on normalisation - because MySQL is an RDBMS - through to the third form minimum and then consider your database structure (on paper). A bad database design will only cause mass amounts of problems when writing the application code. After your database you need to ask yourself questions like "Am I going to program procedurally or object oriented?"; if OO "Am I going to look into design patterns?"; "What design pattern or general architecture am I going to use?". Then begin thinking about the structure of your application, whether its completely independent from your main website (possibly answered in your definition of the task). There's a mass array of questions that need answering and your question is far to open-ended and generalised for you to ever receive a full answer here. Like you said in the beginning, this can be done in many different ways.
  21. I don't really understand what your asking to be honest. You want specific pages to have this javascript on? Or you want to remove it from pages? Its not particularly clear.
  22. What do you mean "manage dimensions of an array from MySQL"? That doesn't really make sense in itself unless your referring to the 1 dimensional array you can retrieve.
  23. You misunderstood my point. I thought you had enctype="multipart" which is invalid. Have you tried running var_dump($_POST);?
  24. There is no such enctype "multipart". Its "multipart/form-data", "text/plain" or another one that's really long and I can't remember but is default anyway.
  25. Okay first thing is first, you need to redesign your database. You don't have a new table for each sublink. All links should be held in a single tale. You merely need the following columns: menuID displayName link parentID (DEFAULT NULL) Any entry with a NULL parentID is a parent link. Anything with an ID is a child. This allows lots of children and its up to you how much you limit it - effectively a child link can also have many children and so on. Once you've done that, re-write your code and if you encounter any problems come back. At the minute your current design is a lost cause.
×
×
  • 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.