Jump to content

Manixat

Members
  • Posts

    164
  • Joined

  • Last visited

Manixat's Achievements

Regular Member

Regular Member (3/5)

17

Reputation

  1. Really useful, thanks! Even though in the comments section it is said that this function can return various values which may evaluate to true even if the domain is nonexistent, I tried it myself and didn't experience this issue!
  2. Hello, I'm concerned about the security of this code because I am not really familiar with shell and OS stuff. I needed to add this function because filter_var wasn't enough to filter bullshit emails out like john@crack.house. I need to verify domain existence and I grabbed a hold of this function from eHow, which is a pretty trustworthy site, but I need to be 100% sure before using it. Are there any possible issues with this function: function checkDomainAvailability($domain) { if(preg_match('/[;\&\|\>\<]/', $domain)) exit; //Could be a hack attempt exec("whois " . escapeshellarg($domain), $output); //:CAREFUL: $result = implode("\n", $output); return (strpos($result, 'No match') !== false); } Thank you in advance! EDIT: I just noticed that this won't work on windows. Is there any cross-OS command I can use?
  3. it is exactly what I've done and the page is scrolling fine until it gets to this little thumbnail where it scrolls in pictures ( not smoothly ) and after it's gone it continues to scroll like it's supposed to
  4. Hey freaks, I have this section of my site where users get to upload one big a** photo which causes a big issue when it is being displayed in a 256x256 img object. The photos vary from 1680x1050 up to 2560x1600. Is there any way I can display those photos as small thumbnails, without actually creating thumbnails, without having scroll-lag ?
  5. Ofcourse by the laws of the universe, after I posted this thread I tried to do the replace before I escape the string and it worked. Apparantly when a string is escaped \n is not \n anymore.
  6. Hello freaks, I have a textarea for writing comments where users can input many new lines and I'm trying to clean those lines but nothing seems to be working. I went all over all google results and tried every example both with preg replace and str replace and nothing seems to work. What I'm doing is first escaping the comment string then trim(preg_replace()). Am I doing the order wrong or idk what might be wrong. I tried like at least 20 syntaxes and none worked, and that's when I write a comment like "asd asd" if I write a comment like "asd " then the new lines are gone in the display of the comment but are still saved in the database which I do not want ...
  7. . Exactly! Voila finally nailed it, it still kinda returns 2 columns but it doesn't really matter cuz they're the same. Here's the final working query if anyone needs it in future SELECT * FROM (SELECT `sender` FROM `friendships` WHERE `recipient`='x' UNION SELECT `recipient` FROM `friendships` WHERE `sender`='x') as dgd INNER JOIN (SELECT `sender` FROM `friendships` WHERE `recipient`='y' UNION SELECT `recipient` FROM `friendships` WHERE `sender`='y') as dgd2 ON dgd.sender = dgd2.sender
  8. Ok I have gotten it to a point where things are starting to work out. I have a new question: How can I form a table of only the friends of a certain user with one column ? It would look something like this: SELECT * FROM (SELECT `sender` FROM `friendships` WHERE `recipient`='X') AS f1, (SELECT `recipient` FROM `friendships` WHERE `sender`='X') AS f2 but instead of splitting it into 2 columns I want to return all records in a single column?
  9. Still gives me the same error, as well as this: SELECT * FROM SELECT `sender`,`recipient` FROM `friendships` WHERE (`sender`='4' OR `recipient`='4') AS f1 JOIN SELECT `sender`,`recipient` FROM `friendships` WHERE (`sender`='6' OR `recipient`='6') AS f2 Also tried this, which turned out no good as well SELECT * FROM (SELECT `sender`,`recipient` FROM `friendships` WHERE (`sender`='4' OR `recipient`='4') AS f1 JOIN SELECT `sender` as snd,`recipient` as rcp FROM `friendships` WHERE (snd='6' OR rcp='6') AS f2)
  10. Hello great minds, I turn to you yet again. Table: sender recipient 1 2 1 3 1 4 2 3 2 4 2 5 In my poor attempts to overwhelm the impossible, for me, endeavor to return the mutual friends of users X and Y I have gotten to the point where hope is my only option. Anyhow if I wanted to get a hold of the mutual friends I thought I had to get both users' friends and compare them. This is what I've got and as you might have already figured it is no good: SELECT * FROM ((SELECT `sender`,`recipient` FROM `friendships` WHERE (`sender`='X' OR `recipient`='X') AS f1) JOIN (SELECT `sender`,`recipient` FROM `friendships` WHERE (`sender`='Y' OR `recipient`='Y') AS f2)) This is just the attempt to retrieve 2 tables with friends, which surprisingly ( not really ) gives me an error which I cannot understand. Any help? Here's the error message, if it's of any use You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS f1) JOIN (SELECT `sender`,`recipient` FROM `friendships` WHERE (`sen' at line 2
  11. You mean that I need to use the absolutely absolute path even beyond the htdocs folder? EDIT: I never expected I would need to go any deeper than the htdocs but that worked! Thanks
  12. It is in htdocs, since I'm using xampp, to which I as well as HTML, unlike PHP, refer as root :?
  13. Hello freaks, I have been unsuccessfully trying to manage PHP to begin a path from the root directory. I have a structure like so / < ROOT /Project/Public/Index.php /Project/Public/Images/Image.png /Project/Framework/Class.php Index.php includes class.php which checks if image.png exists via file_exists() and does stuff. The problem is that this file_exists("/Project/Public/Images/Image.png") returns bool(false) and in order to get a bool(true) i need to start from "Images/Image.png", but then if I call the class from somewhere else this wouldn't work, I suppose?
  14. Hello freaks, I've set up an ajax system and I'm in need to use the pushState method. Unfortunately I'm not quite aware of how that works. I went through a bunch of tutorials and examples and still couldn't figure it out. What I have is this $('.tabs > li').click(function(e){ e.preventDefault(); var target = $(this).children('a'), title = target.attr('alt'), // This is equivalent to .html(), I have a translating engine so the html is variable according to the language obj = {url:target.attr('href')}; history.pushState(obj, title, target.attr('href')); }); And this works as long as I don't press the back button, when I do the URL goes back to what it previously was but the page remains the same, why is that?
  15. Do you by normalize mean that I should create another table and relate them :/ My apologies, I'm a self learner and that is what I just read about data normalization
×
×
  • 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.