Jump to content

Manixat

Members
  • Posts

    164
  • Joined

  • Last visited

Everything posted by Manixat

  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
  16. Hello freaks, I'm looking for a way to select multiple IDs from a table based on a string of those IDs separated by a comma. The string in question is a record from another table. Now I can easily retrieve the string and perform various operations to assemble a new query, but it couldn't bother me more that there most probably is a correct way of doing this using only mysql. So I turn to you - is there such way?
  17. Excellent, thank you for this reply!
  18. Hello again freaks, I have a dilemma here that I thought I would ask for a professional opinion. $mysqli->query("SELECT * FROM `table` WHERE `id`='$id1' OR `id`='$id2' OR `id`='$id3' ... OR `id`= '$id3001' OR `id`='$id3002'"); or $mysqli->query("SELECT * FROM `table` WHERE `id`='$id1'"); $mysqli->query("SELECT * FROM `table` WHERE `id`='$id2'"); $mysqli->query("SELECT * FROM `table` WHERE `id`='$id3'"); ... $mysqli->query("SELECT * FROM `table` WHERE `id`='$id3001'"); $mysqli->query("SELECT * FROM `table` WHERE `id`='$id3002'"); which is the better way to go?
  19. Sometimes I just sit and wonder how can I be that much of a retard.. The problem was that I was thinking my field was INT type and the query was for some reason returning tinyint...
  20. Hello freaks, I have an insert query that uses a select query to find values to insert. To make it more clear I have around 4000 cities stored in a database and when a user registers the name of the city is sent to PHP but I need to record the ID and then my query looks something like this INSERT INTO `users` (`blablabla`,`blablabla`,`CITY`) VALUES (`blablabla`,`blablabla`,(SELECT `ID` FROM `cities` WHERE `Name`='$phpvariable')) The problem is that it retrieves cities up to ID 127. I suppose that is due to the data limit of TINYINT. My question is how do I get around that, or in other words how can I change the data type the SELECT query returns ?
  21. <textarea id="def0" name="def0" alt="Gedetailleerde omschrijving" ></textarea>
  22. Okay look, try uploading another image, see if it gets uploaded. If it does but the code is still giving you a hard time, then probably there's something wrong with your mysql stuff which you can determine really easily by mysqli_error(). If not then you still need to figure why move_uploaded_file is giving you such a hard time. I have to go now, I hope I've been of any assistance and good luck!
  23. Are you sure that the images folder exists ? move_uploaded_file cannot create folders
  24. Well your code seems fine to me. Notice that neither the then nor the else bolck are firing in your 'live script' -> if (!empty($name) && !empty($score) && !empty($screenshot)) {
  25. You're missing a slash in here: define('GW_UPLOADPATH', '/guitars/images'); $screenshot = $_FILES['screenshot']['name']; $target = GW_UPLOADPATH . $screenshot; $target becomes '/guitars/imagesScreenshot.jpg' instead of '/guitars/images/Screenshot.jpg'
×
×
  • 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.