Jump to content

dptr1988

Members
  • Posts

    372
  • Joined

  • Last visited

    Never

Everything posted by dptr1988

  1. Spam filters can make decisions based on very complicated reasons. And they all have different reasons. I know that my spam filters, bogofilter, is very sensitive to the email content and doesn't pay as much attention to the sender. How is this related to PHP?
  2. Ha!! I missed something. You have a call to exit(); 2 lines before the you try to send the 'index.php' location header.
  3. Well you've got it planned out pretty good! How much do you know? You can get the results from the form with the $_GET['form_name'] or $_POST['form_name'] variables, and replace 'form_name' with the name of your form. You can send mail with the mail() function http://us2.php.net/manual/en/reserved.variables.get.php http://us2.php.net/manual/en/reserved.variables.post.php http://us3.php.net/manual/en/function.mail.php
  4. Have you double checked the format of the numbers? Are they all the same format? What exactly is the problem that you are having? Any error messages?
  5. I forgot to mention that. The 'Location:' header requires a full URL including the 'http://' part.
  6. You SQL query is all messed up. Here is an example: <?php $name=$_post["search"]; $query = "SELECT * FROM `review` WHERE `author` LIKE '%{$name}%' OR `bookTitle` LIKE '%{$name}%' " . " OR `bookDescription` LIKE '%{$name}%' "; ?> Also you weren't assigning that query string to a variable. http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html
  7. In your sql query, you forgot to put a space between the field names and the 'FROM' key word Here is the corrected sql query. Notice the space at the end of the first line of the query. <?php $q = "SELECT username,userlevel,email,timestamp,fname,sname,address,city,county,postcode " . "FROM " . TBL_USERS . " ORDER BY userlevel DESC,username"; ?> You could have figured this out on your own if you would have printed out the sql query when you got the error message. People often make mistakes when creating sql queries, so the first thing you should do when you are having an SQL trouble, is echo the query and inspect it.
  8. You shouldn't be using session_register, it depends on register globals which is bad. Use session_start() at the begining of your page and the $_SESSION global variable instead. Example: <?php $_SESSION['myusername'] =$myusername; ?> Have you checked the username and password right before they go into the SQL query to check if they are still correct? IF you still cant figure it out, please echo your SQL query and post it here.
  9. You get that error becuase of an invalid SQL query or you don't have a Mysql connection. Check that your SQL queries are correct. Note: You can't select the username and password independantly, they you need to check the username and password simultainiously. Here is a tutorial about login systems: http://www.phpcodinghelp.com/article.php?article=user-login
  10. You can't use session_register() if you don't have register globals turned on. ( which you shouldn't do ). Rather then session_register, use the global $_SESSION variable. Example <?php $_SESSION['password'] = $password; $_SESSION['username'] = $username; ?> http://us3.php.net/session_register
  11. It should be like this: if (isset($_POST['formsubmitted']) AND $_POST['formsubmitted'] != "" )
  12. should be this <td align='left'><a href='mailto:" . $result['username'] . "'>" . $result['username'] . "</a></td> You were using double quotes in the href attribute when you should of been using single quotes or backslashing your double quotes. Also you forgot the end quote for the href attribute
  13. I'm on an expert on CSV format, but I think all you need to do is quote your fields, and then the program that reads the data will ignore the newlines that are inbetween quotes. So I don't think that there is a bug in the code, you just need to quote your data.
  14. Does your code expect register globals to be turned on? Register globals should NOT be turned on, and if you old code depends on it, and your new server doesn't have it turned it ( the better not!! ) then it would break your code.
  15. You could try using PHP's fputcsv, instead of writing your own function. http://us.php.net/fputcsv Here is example from the comments the fputcsv page on how you can use fputcsv to format your data. <?php // output up to 5MB is kept in memory, if it becomes bigger it will automatically be written to a temporary file $csv = fopen('php://temp/maxmemory:'. (5*1024*1024), 'r+'); fputcsv($csv, array('blah','blah')); rewind($csv); // put it all in a variable $output = stream_get_contents($csv); ?>
  16. Have looked at the HTML code that this script generates and verfied the URL is correct and that the image actually exists?
  17. You are not quoting the values in the WHERE clause They should be quoted like this: <?php $query = "SELECT * FROM users WHERE username = '" . ($_POST['username']) . "' AND password = '" . addslashes($_POST['password']) . "'"; $sql = mysql_query($query); ?>
  18. Unfortunately, you didn't copy my code. The line with $headers = 'From: postmaster@localhost' . "\r\n" should be $headers .= 'From: postmaster@localhost' . "\r\n" You are overwriting the $headers variable rather then appending to it.
  19. Have you tried looking at the echoed query as described in this message: http://www.phpfreaks.com/forums/index.php/topic,194387.msg875311.html#msg875311
  20. You were overwriting your $headers variable and eraseing the content type <?php ..... // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $message = 'Go to: <a href="http://localhost/rental.html">http://localhost/rental.html</a>' . 'You have being assigned a new case'; // You were overwriting the $header variable here. // I changed the '=' to '.=' $headers .= 'From: postmaster@localhost' . "\r\n" . 'Reply-To: postmaster@localhost' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); header("location:case_assigned.php"); ..... ?>
  21. the field name 'like' is still not quoted. It should be like this <?php $result = mysql_query("INSERT INTO users (id, first, username, password, second, address, email, job, salary, `like`, salarye, transport, contact) VALUES (`$id`, `$first`, `$username`, `$password`, `$second`, `$address`, `$email`, `$job`, `$salary`, `$like`, `$salarye`, `$transport`, `$contact`)") or die(mysql_error()); ?> It would be even better if you could rename the field 'like' to some other name. It is not a good idea to use mysql reserved words for field names
  22. The manual says that they are returned in the order that they are stored in the filesystem, which could be just about anything http://us.php.net/readdir You could read all of your filenames into an array and then sort the array with one of PHP's many array sorting functions http://us3.php.net/manual/en/function.sort.php
  23. Transferring scripts between servers (espcially if they are poorly written) usally requires carefull testing and modifications to the script. I don't think that there is anything wrong with your new server. You need to debug this script. Can you show us any error messages?
  24. If you ever want to use the friends list in a SQL query, definitely use MadTechie's method. If the friend's lists is just a like a string containing CSV friend ID's, that list will almost be useless in an SQL query. It will require a PHP script to retrieve it, decode it and then put it back in the SQL query.
  25. The real way to do that is to cut your 80 chars out, and look for all of the opening html tags, then add some closing tags in the reverse order that you found the opening tags. Or if you know which tags you will find in the text like p, a, b, etc, and you don't mind cheating ( really bad!! ), you always add those closing tags at the end of your substring. Then if there weren't any tags in the 80 char substring, you would have some extra closing tags ( could be really bad !! ) I'm sure somebody else can suggest a quick regexp search that will find the tags for you, but here is an example that will search for all of the opening tags and then tack on some closing tags to the end of your 80 char substring. This example should work for most simple formatting tags, but if there are some '<' or '>' characters that are not tags, it will probably make some mistakes WARNING: Not tested. May contain an occasional bug. <?php // substring with unclosed tags $haystack = '<p>This is the <a href="some_URL">first <b>paragraph'; $offset = 0; $end_tags = ""; while( ($offset = stripos($haystack, '<', $offset)) !== false) { $tag_name_end = stripos($haystack, ' ', $offset); $tag_end = stripos($haystack, '>', $offset); if ($tag_name_end === false OR $tag_end === false) { // Tag name is right at the 80 char border, so disregard it $haystack = substr($haystack, 0, $offset); break; } $offset++; $tag_name = substr($haystack, $offset, $tag_name_end - $offset); $end_tags .= "</" . $tag_name . ">"; $offset = $tag_end; } $haystack .= $end_tags; ?>
×
×
  • 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.