Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. Then you best start learning to read manual pages.
  2. How about posting your actual code. And the whole thing - especially the part that logs you in.
  3. Log in to phpMyAdmin as root and run SHOW FULL PROCESSLIST.
  4. Then you might as well go with simpler code instead of shortcuts. If you have the GMP extension installed or installable, that has gmp_xor. Otherwise roll your own. You can break the number down into chunks of, say, 6, and use base_convert() to get something faster than trying to do it one character at a time. function xorhex($hex1, $hex2) { $len = max(strlen($hex1), strlen($hex2)); $hex1 = str_pad($hex1, $len, "0", STR_PAD_LEFT); $hex2 = str_pad($hex2, $len, "0", STR_PAD_LEFT); $xor = ""; for ($i = 0; $i < $len; $i += 6) { $one = (int)base_convert(substr($hex1, $i, 6), 16, 10); $two = (int)base_convert(substr($hex2, $i, 6), 16, 10); $xor .= str_pad(base_convert($one ^ $two, 10, 16), 6, "0", STR_PAD_LEFT); } return ltrim($xor, "0"); }[edit] Okay, one shortcut. Only with bases that are a power of two (binary, octal, hexadecimal, not decimal) can you xor pieces of the numbers together. If the input strings were in base 10 then you'd have to XOR the entire number together. Or convert it to binary/octal/hex, XOR, and convert back.
  5. First a question: what does var_dump(999999999) output for you?
  6. ...Attached? Inline would be better.
  7. XOR each digit with 1. While you treat it as a string. $hex = "41495ab3edde720c"; $chars = "0123456789abcdefABCDEF"; for ($i = 0, $len = strlen($hex); $i < $len; $i++) { $hex[$i] = $chars[strpos($chars, $hex[$i]) ^ 1]; }[edit] If you have to XOR with anything other than 1 then you can't use the $chars that has both lower- and uppercase letters. Reason being that with just 1 the before and after numbers won't cross the 0-9/a-f boundary (which is broken for 0-9/A-F) but with anything more it's possible it would.
  8. You're not using crypt() correctly. The second argument is not a "mode". You don't pass in constants like CRYPT_SHA512. In fact those constants only tell you whether there is support for that type of hash. RTFM print "<hr/>" . crypt('samurai.ciscorouter1', '$6$a16charactersalt'); print "<hr/>" . crypt('samurai.ciscorouter2', '$6$a16charactersalt'); <hr/>$6$a16charactersalt$blQiCNs8hARJgK03F1aaOKeoY1onl6GvJrBkcf2VD03jvIRnHh2jvt47YCPRRaLHGReaDOGOCkuNwQoXKikr2/ <hr/>$6$a16charactersalt$e7lkgunJmMxBX.fokhsuhUIrxmJM.WuiWW6dMmzwK6JqQg9M10amQr3U9SMtQp6L5hqKev7k21bViDuSSkgDc1
  9. I'm 95% sure it's the frameset/iframe thing I mentioned. When you do a View Source of your website, make sure you're doing it from the browser menu and not a context menu. You'll see a or . You don't need your own personal DNS setup covering your router and the web server (unless you want one for your entire lan, but that's a different problem). The way you configure the router takes care of that: it receives traffic for its port 80, it forwards that traffic to port 8080 of some specific machine inside your network. Think of it like hardcoded DNS.
  10. You had the right order before, it just wasn't all together. SELECT * FROM tblphotos WHERE tblph_shareID = ? ORDER BY tblph_shareID DESC LIMIT 1If that doesn't work, please post the code for query_wrapper(). [edit] Third edited post in a row Your query is wordier than it needs to be: you're searching by the shareID so there's no point sorting by it. SELECT * FROM tblphotos WHERE tblph_shareID = ? LIMIT 1And if the tblph_shareID is unique in the table then you don't even need the LIMIT.
  11. My reply on Dev Shed was short so I'll copy/paste it here.
  12. Yeah, you've got the right overall query, but look at that function call more carefully. query_wrapper("SELECT * FROM tblphotos WHERE tblph_shareID = ", $share_ID. " ORDER BY tblph_ordering ASC LIMIT 1")You're passing two arguments. The first one is SELECT * FROM tblphotos WHERE tblph_shareID = and the second one (if $share_ID=123) is 123 ORDER BY tblph_ordering ASC LIMIT 1. That's surely not how the function is supposed to work. However the function returns a string. That's odd. What does the function do and how is it supposed to work?
  13. Putting aside the fact that you put the ORDER BY stuff in the wrong place (you're concatenating it with the share_ID, not with the query), apparently query_wrapper() returned a string. Why is that? What does the function do? What's the code? [edit] And to answer the question in the title and not in your post... not even close to what's in your post... T-SQL's TOP N is equivalent to MySQL's LIMIT N. As it seems you've found out.
  14. strip_tags() to remove markup you don't want. If you don't trust the user then you have to go even more complex by looking for malicious attributes: I could put a just fine, but I could also put a Click to Like this page!
  15. You could go a bit fancier by, say, letting the calling code dictate the structure of the name, and using the class more of a random name generator than simply a name. And why stop at specifying the structure? class RandomNameGenerator { const DEFAULT_CONSONANTS = "bcdfghjklmnpqrstvwxyz"; const DEFAULT_VOWELS = "aeiou"; private $consonants = array(); private $structure = array(); private $vowels = array(); public function __construct($structure, $vowels = self::DEFAULT_VOWELS, $consonants = self::DEFAULT_CONSONANTS) { $this->consonants = str_split($consonants); $this->structure = str_split(strtolower($structure)); $this->vowels = str_split($vowels); } public function generate($n = 1) { $names = array(); for($i = 0; $i < $n; $i++) { $name = ""; foreach($this->structure as $type) { switch ($type) { case "c": $name .= $this->consonants[array_rand($this->consonants)]; break; case "v": $name .= $this->vowels[array_rand($this->vowels)]; break; } } $names[] = $name; } return ($n == 1 ? $names[0] : $names); } } $rng = new RandomNameGenerator("cvcvv", "aeou", "bcdvgt"); foreach($rng->generate(10) as $name) { echo "Random name: ", ucfirst($name), "\n"; }[edit] Oodles of room for more ideas to add in: first and last names, multiple types of alphabets besides consonants and vowels, random lengths and/or structures...
  16. Yes. The dynamic DNS service you have now should be perfectly fine - just don't use the "domain masking" feature, or whatever they may brand it as, that you're using now. Once you set up the router to accept port 80 (but still forward to 8080) the literal dynamic DNS part of it is all you really need.
  17. Something about dialogues? Does this thread look familiar? That's actually a second thread. The original, first thread got deleted because it was in the wrong forum and OP created that second one (in the right place). As mentioned in that second thread, the main problem was that the code had a number of = assignments instead of == comparisons. After you posted, Christian F. posted a cleaned-up version of the code, Jessica saw the =s he'd left intact, and Cygna learned what a guru is. [edit] To those interested and able to view deleted threads, here's the first one.
  18. Well, as long as you have a good reason. That's a bit much code for me to look at right now but you probably need to add a case for $tag=="cdata". From what I can gather it looks a lot like the $tag=="complete" case, in that the enclosed value is ["value"], but it seems like it might be contained within the parent node rather than the parent node "being" a CDATA node. Like <node><[CDATA[data ]]></node> array( "NODE" => [0,2], "???" => [1] ) array( 0 => ["NODE", "open", 1], 1 => ["???", "cdata", 2, "data "], 2 => ["NODE", "close", 1] )[edit] Take a look at the user comments in the manual page for xml_parse_into_struct(). That's where I just picked up most of what I said.
  19. It's a result of the service you're using. Because you have it changing ports they have to use framesets or iframes to make the website work. Otherwise people would have to go to yourdomain.com:8080. The problem with doing it that way is what you've discovered: the URL stays the same. 1. Configure your router to forward port 80 traffic to your VM's port 8080. 2. Configure your dynamic DNS to just do regular DNS (no port stuff) with your router. 3. ??? 4. Profit
  20. What do you need the array for? Are you aware that SimpleXML makes XML much, much easier by giving you an OOP syntax to retrieve nodes and even allows for searching within the XML?
  21. Not sure what you're saying but try the function out. Don't forget the third parameter which is what it should use as the wrapping string.
  22. What's your full code?
  23. It returns a concat() thing or a regular "" string depending on what quotes are being used. $query1 = "channel/item[title=" . escapexpath($p) . "]/title";
  24. Have you looked at the link I gave?
×
×
  • 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.