Jump to content

woolyg

Members
  • Posts

    254
  • Joined

  • Last visited

    Never

Everything posted by woolyg

  1. Hi all, Can anyone help me with this one? I have a list of email addresses in a variable. There could be 5, there could be 500, and they're all mixed around in no certain order.. $mailing_list = "mail1@mail.net, mail2@mail.net, mail3@mail.net, mail4@mail.net"; $arr = explode(", ",$mailing_list); is there a way to print $arr, specifically leaving out one of the email addresses? Say if I wanted to print everything in the $mailing_list contents EXCEPT mail2@mail.net, how would I go about it? All help appreciated. Woolyg
  2. Cool, Thanks Michal - I'll go about learning now...- woolyg.
  3. Michal, I'm implementing exactly the code you set out, but what I'm finding when an email is removed from the middle of a list, it's removing the comma straight after it, which is fine, but it's also removing the comma at the very end of the list, which is kinda fooling with my population coding. Is there a way to remove only the mail & the comma, without touching anything else? eg mail5@mail.net, - Cheers, Woolyg
  4. Michal, That is one beautiful piece of code! Thank you so much - I wouldn't have known how to do this prior to now. I'll mark this one down for my records.. Have yourself a great day. Woolyg!
  5. Hi all, I have a field that contains the email addresses of all subscribers to a topic. Like this |-----------|------| | Topic ID | Email | |-----------|------| | 23 | mail1@mail.net, mail2@mail.net, mail3@mail.net| |-----------|------| | 24 | mail4@mail.net, mail5@mail.net, mail6@mail.net| What syntax would I use to remove only mail5@mail.net from the Email field of Topic ID 24, and keep the other info in the field? All help appreciated, Woolyg.
  6. Hi, I'm trying to put together a script that will search the contents of just one field, specified by its row ID. I'm using: SELECT mailing_list, MATCH(mailing_list) AGAINST ('$emailaddress,' IN BOOLEAN MODE) AS score FROM table WHERE MATCH(mailing_list) AGAINST ('$emailaddress,' IN BOOLEAN MODE) AND row_id='$row_id' So from the code above, I wanna search the field 'mailing_list' where the row_id is of a certain value. But the result is returning information from other rows - it seems to be ignoring the AND row_id=$row_id bit.. Is there a way to use the search string above to have it search just the ONE field, in the ONE row? All help appreciated, woolyg.
  7. OK, thanks for letting me know about the CPU usage! I don't fully understand what you mean to do with the information - do you mean to create new fields for mail_id1, mail_id2 etc? That will not work, as it's not known how many mail addresses will be added to the list, it could be 1, it could be 100.. How do you reckon I should do it? Thanks for your input so far.. Cheers, Woolyg
  8. Hi all, I'm populating a field in MYSQL that collects email addresses for a certain topic and saves them like this: mail1@mail.com|emailaddress2@mail.com|email3@email.com - Basically what I'd like to do is explode the data, and set up a mailer from PHP that informs each of the addresses individually that there has been an update to the topic. I *don't* want each of the mail addresses to be visible to all the recipients on the list, so simply inserting the data into the TO: field won't do, because then all the addresses are visible, causing security concerns. I tried doing this: <?php //Send a mail to the mailing list $get_mailing_list = mysql_query("SELECT mailing_list FROM table WHERE post_id='$post_id'"); $runget_mailing_list = mysql_fetch_assoc($get_mailing_list); $mailing_list = $runget_mailing_list['mailing_list']; while($rad=explode('|',$mailing_list)){ $reciever=$rad['mailing_list']; $subject = " Reply to a posting"; $message = " A reply has been posted to a posting you are tracking. Have a look here : [url of reply] No need to reply to this email. Thanks! "; $from = "myemail@site.com"; $headers = "From: $from"; mail($reciever,$subject,$message,$headers); } ?> ..but something happened server-side when it tried to carry out the command and brought the CPU usage up to 100%. Has anyone done this before, or could you give me any pointers? All info appreciated. Woolyg.
  9. Here's another bit of info I'd love to clear up: I've got a PHP page that takes POST input from a form on a previous page. Code here: <?php $username1 = $_POST['username']; $username = mysql_real_escape_string($username1); $info_title1 = $_POST['info_title']; $info_title = mysql_real_escape_string($info_title1); extract($_POST); function check_field1($info_title) { if(!preg_match("/[^a-zA-Z0-9\.\-\Ä\ä\Ö\ö\Ü\ü\'\?\!\*\#\@\$\%\(\)\=\\\\ ]+$/s",$info_title)) return TRUE; else return FALSE; } $error=0; // check up variable /* get it checking */ if(!check_field1($info_title)) { $error1 = "-- You have entered a disallowed character in the Info Title. Please try again. --<br>"; $error++; // $error=$error+1; } //Enter data if($error == 0){ $query = "INSERT INTO table (username, info_title) ". "VALUES ('$username', '$info_title')"; mysql_query($query) or die('Error, query failed : ' . mysql_error()); } else { echo "That didn't work"; } ?> My question is as follows: If I have allowed the apostrophe character and the backslash character from my preg_match definition, will the mysql_real_escape_string still work OK in preventing injection? Thanks, Woolyg.
  10. Thanks, I've been reading up on it and it seems that this'll be the way to go. Quick Q regardinging safeguarding agains injection - does it help if you limit input character maximum on the form object? Just something I'd like to know. Cheers, Wool.
  11. Hey all. I'm building a new site right now and would like to test its vulnerability to injection, in stages. Would any of you more experienced users be interested in attempting to inject into my DB from forms on my site, in a controlled atmosphere? Send me a private message if you'd like to help and I'll explain what stage I'm at, and what I aim to gain by doing the testing. Any help appreciated, Woolyg.
  12. Cool, thanks for the input everyone. I'm going to go back and bang my head off it for a while. I'll come back with any issues! - woolyg.
  13. Nope. I've been careful to identify them differently..
  14. Hi all, In a PHP file 'main.php' I have <?php include 'header.php'; include 'login.php'; include 'body.php'; include 'footer.php'; ?> Login.php has a form on it to allow the user to log in to the site. Body.php has a form on it to allow a user to post a message. What I'm finding is that the 'submit' button on 'body.php' actually calls the form from 'login.php'. Does PHP have issues when there are 2 separate forms doing 2 saperate things displayed on the same page - is there anything I need to look out for? Any observations appreciated. - woolyg.
  15. Hi, I'm starting to look into a basic search on a table: SELECT field1, field2, field3, DISTINCT MATCH(field1, field2, field3) AGAINST ('keyword' IN BOOLEAN MODE) as score FROM table WHERE MATCH(field1, field2, field3) AGAINST ('keyword' IN BOOLEAN MODE) order by score DESC ..but if I enter more than one word in the keyword bit, some results are replicated (ie, return 2 rows of exactly the same info, but different scores). Is there a way to only return unique rows per result set? Any help appreciated. Woolyg.
  16. Ahh. Thanks very much hunna03 - I see the light! Cheers - Woolyg.
  17. I'm not sure this relates to what I wanna do - I'm not changing the date of 'now' - I need to change the displayed time of a date that is being pulled from a database query..
  18. Hi, I have data that's output from my db in the form Sunday 9th September 2007 21:29:22. I'm getting it by using <?php $timestamp= $row['timestamp']; echo date('l jS F Y H:i:s', strtotime($timestamp)); ?> I'd like to add 19 hours to it, but have no idea how to. Anyone help? Cheers, Woolyg
  19. Thanks for the input all, it's great that there are multiple ways of doing this. Thanks for the pointer on mime types too! Cheers, Woolyg.
  20. Hi all, I am writing a file upload script, but only want the file types to be jpg, gif or png. I want the script to basically say "If this file type is not a jpg, gif or png, then echo a rejection" I'm using (and it's not working) <?php if($fileType != 'jpg', 'gif', 'png'){ echo "Wrong file type"; } else { echo "Right file type"; } ?> Anyone got any idea how to define more than one value into the IF statement, above? All help appreciated, Woolyg.
  21. Quick one - is it possible to return the table name in a result set? Say if I wanted to get ID, Name, Surname, and the *name* of the table USERS to be displayed within the results, could it be done? Cheers, Woolyg
  22. Hi all, Ive got 2 tables, both of which have exactly the same field names, but different data in the tables. I want to get name 3 fields in my mySQL query, and get data to display from both tables: Table 1: ------------------------------------------------- | House_Name | House_Desc | Date_Added | ------------------------------------------------- | MyHouse | Lovely | 27-08-2006 | | YourHouse | NotLovely | 17-06-2007 | ------------------------------------------------- Table 2: ------------------------------------------------- | House_Name | House_Desc | Date_Added | ------------------------------------------------- | OldHouse | Horrid | 07-08-2006 | | NewHouse | Warm | 02-06-2007 | ------------------------------------------------- I would like to set up a query with the result showing 3 fields, sorted by date: RESULT: ------------------------------------------------- | House_Name | House_Desc | Date_Added | ------------------------------------------------- | NewHouse | Warm | 02-06-2007 | | YourHouse | NotLovely | 17-06-2007 | | OldHouse | Horrid | 07-08-2006 | | MyHouse | Lovely | 27-08-2006 | Can anyone help? The result set I'm getting is basically the two tables side by side, depending on which join type I use. I'd like to combine the results into 3 neat fields... Cheers, Woolyg
×
×
  • 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.