Jump to content

fizix

Members
  • Posts

    50
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://eripp.com

Profile Information

  • Gender
    Not Telling

fizix's Achievements

Member

Member (2/5)

0

Reputation

  1. I'm afraid that wouldn't work for two reasons: 1. The address won't necessarily start with http://, it could be a relative address (sorry, should have specified that) 2. I only want to find strings that start with window.location=
  2. Hey all, I've been playing with this for a while and finally decided to ask the experts. I'm trying to match just the URL in the following strings: window.location="http://www.text.com"; window.location='http://www.text.com'; window.location="http://www.text.com" window.location='http://www.text.com' window.location=http://www.text.com; window.location=http://www.text.com This works for all of them except the last one: /window\.location\=["\']?(.*?)["\';]/i Is there any way to make a regex that works for all of them?
  3. fizix

    Need preg help

    Is your data changing at all? If not you shouldn't even be using regex; you could use strpos().
  4. It may be more efficient to read the whole string in to a PHP string and use square brackets to read each character, like so: $string = 'abcdef'; echo $string[0]; // a echo $string[3]; // d
  5. I use a function like this: function parsesearch($search) { $searches = split(" ", $search); $searchqty = count($searches); for($x=0;$x<$searchqty;$x++) { if(!isset($searchquery)) $searchquery = " WHERE (title_keys.title LIKE '%".$searches[$x]."%' OR ips.domain LIKE '%".$searches[$x]."%')"; else $searchquery .= " AND (title_keys.title LIKE '%".$searches[$x]."%' OR ips.domain LIKE '%".$searches[$x]."%')"; } return $searchquery; } You may need to tailor it to your needs but hopefully it gives you a starting point.
  6. Does the password look like a string of numbers and letters before you change it? If so it could be an MD5 hash (or other hash). If that's the case you'd need to first encode the password to MD5 with a website like this one: http://7thspace.com/webmaster_tools/online_md5_encoder.html
  7. Your query should look like this: $query = "SELECT tourname, lastname from events where tourname like '%$search%' or lastname like '%$search%' Note where I added the $ to or lastname like '%$search%'.
  8. Ok, I've got two tables: Table: ips +-----------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------+--------------+------+-----+---------+----------------+ | id | int(11) | | PRI | NULL | auto_increment | | connect | tinyint(1) | | | 0 | | | ip | bigint(20) | | | 0 | | | domain | varchar(100) | | | | | | title | varchar(250) | | | | | | time | int(11) | | MUL | 0 | | | title_key | int(2) | | | 0 | | +-----------+--------------+------+-----+---------+----------------+ 7 rows in set (0.00 sec) Table: title_keys +-------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+--------------+------+-----+---------+----------------+ | id | int(4) | | PRI | NULL | auto_increment | | title | varchar(250) | | | | | +-------+--------------+------+-----+---------+----------------+ 2 rows in set (0.00 sec) I'm trying to LEFT JOIN the two tables so that title.title_keys becomes the title when ips.title_key matches id.title_keys. In all other instances I'd like it to return ips.title. I've made sure that ips.title is always empty when ips.title_key is not 0. Here is my query: SELECT * FROM `ips` LEFT JOIN `title_keys` ON ips.title_key = title_keys.id However, when I echo mysql_result($recentfound,$x,"title") it only echoes the title from ips.title. I thought if ips.title was blank and title_keys.id matched ips.title_key it would echo title_keys.title. What am I doing wrong?
  9. That's a good idea. I think I'll do something similar such as storing a session variable with the ID of the search that they're currently looking at. Then if they view a different search I'll just reset that variable (and of course it will be reset when they log out).
  10. Ok, I thought this would be an easy one at first but it's turned in to something more complicated than I expected: I have a database that can be searched and I allow my users to save their searches. I want to allow them to view all the new results since they last ran the search. That part is easy... I just save the timestamp for the last time they ran the search to a 'lastrun' column is SQL and update 'lastrun' every time the search is run. However, I run in to problems with multi-page results... When they move to the next page it thinks that the search was run a few minutes or seconds ago so page 2 is blank. My question is: how can I tell when the user is done with his/her search so that I can update the 'lastrun' parameter?
  11. I don't want to create them sequentially but maybe if I assigned each process a group of IP addresses (say 2000 at a time) and then told it to select from that group at random and removed each address I tried from the group as I went it would still be quasi-random and they would all be unique...
  12. Yes, it needs to be random and unique. I'm basically generating a bunch of random IP addresses and I don't want to generate the same one twice. I can't keep a list of addresses I've already generated because I'll have multiple processes running at the same time and the database containing the addresses would get WAY too big WAY too quickly (trust me, I've already tried).
×
×
  • 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.