Jump to content

regdude

Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by regdude

  1. Hi! I have created a script (more like a system) that uses expect. The idea is actually simple: you press a button, PHP opens an expect stream to a telnet, expect_expectl waits for specific output, PHP reads output, based on output PHP sends more data. (Im refering to this PHP module - http://php.net/manual/en/book.expect.php ) I have ran into multiple problems, one of them is that the expect extention seems to be really unstable, it crashes apache and can't really figure out why. Another problem is that sometimes it likes to simply skip an output for no reason and gets stuck in a while loop. Obviously this is happening randomly and I can't find the cause of it (its not the client's fault, the client processes command as it should). Even worse, I can't seem to compile the exepect module on any x64 machine, it seems that the code is not meant to be for 64-bit machine. I have tried a lot of things and basically I'm tired of this module (even gentoo seems to have removed it since PHP 5.3) and I don't think there is anything that can make the expect module work properly on current PHP versions. So my question is: can anyone give an alternative way to deal with these shell interactions? I'm looking at Python's "pexpect", I don't like that its bit tricky to read output from a Python script inside PHP and I don't like that I must use popen. Also found that TCL also has "exepect" which is very similar to Python's "pexepect" and also Perl has it too, haven't really dealt with either of those languages, but it is not anything "out of this world". The best way I can think of is using cgi-bin scripts, I send a request with parameters (IP, command etc.) to a Python/TCL/Perl script which then gives an output. And I can do this in 2 ways, either open a stream and fetch the output (like with popen, still don't like it) or with ajax (since the current page is based on ajax, not a big problem). Whats wrong with SSH? Its slow because of the encryption, telnet is able to proccess commands a lot faster (and on slower devices SSH creates a notable lag). Anyone has any advice?
  2. Hi! I used this script: http://javascript-array.com/scripts/simple_drop_down_menu/ to make a menu in a PHPBB2 forum. From the IE view it is all fine, but from FF/Chrome it goes wrong! As here: http://img580.imageshack.us/img580/3213/menub.jpg So the first is that the menubar background for some reasons goes 2 times bigger and messes up the background, the second thing is that the hover background of a button doesn't seem to cover up all text. Here is the style: <style type="text/css"> #topmenu { z-index: 30 } #topmenu li { list-style: none; font-size: 11px; font-weight: bold; color: #EEEEEE; float:left } #topmenu li a { display: block; font-size: 11px; font-weight: bold; padding: 4px 8px 6px 8px; width: 60px; background-image: url(images/cellpic2.gif); background-repeat: repeat-x; color: #EEEEEE; text-decoration: none } #topmenu li a:hover { background: #FE9801 } #topmenu div { position: absolute; visibility: hidden; margin: 0; padding: 0; background-image: url(images/cellpic2.gif); background-repeat: repeat-x; border: 1px solid #4F4F4F } #topmenu div a { position: relative; display: block; margin: 0; padding: 5px 10px; width: auto; white-space: nowrap; text-align: left; text-decoration: none; background: #4F4F4F; color: #FFFFFF; font-size: 11px } #topmenu div a:hover { background: #FE9801; color: #FFFFFF } </style>
  3. Is there a ready-to-use script like this?
  4. Hi! Is it easy to make a paypal script that would simply give a result like true/false (did buy, didn't buy)? For example, I have a SMS script that simply checks the SMS Code with the database and gives the answer if it is a good code, like this: $answer = @file_get_contents("http://...", FALSE, NULL, 0, 140); This code goes after I typed in the code and pressed Send in webpage. Before it does something I check if the user hasn't got the product etc. Can anyone show me a really simple example on how I can make Paypal script work similar to my SMS script?
  5. Yes. But as I said I have changed the servers. What I think here is simply the old data being exported wrong. How should be the data exported?
  6. Through the forum. Every old entry in the database shows up like "????", but a new entry (a post in the forum) shows up fine like "āāāā". Through phpmyadmin it shows up also fine.
  7. I forgot to tell you and don't know why this forum doesn't have an edit button. Ok, the thing is that everything from the DB is messed up, but a new entry in the DB shows up fine! Is this problem still related with setting UTF8 before connecting?
  8. Well I tried to set some things that are related to UTF8, but didn't seem to work, but I do recall one time when I had such a problem (also a migrating problem) and "SET names UTF8" did solve the problem, now it didn't but I think it's just the wrong place. I'm using a phpbb2 forum. Is it possible to avoid this code set so that it will allways use UTF8? I really don't want to change every single page.
  9. Hi! I'm using now mysql server 5.1.37-2 and I was using mysql server 5.0.70! So when I moved from one server to another I had problems with encoding because I get "????�" instead of "ĀĀĀĀŠ" (from UTF8). All database data seems to be in UTF8 and in phpmyadmin everything even shows up right!! But not in the web page (I did also change PHP and web server). I have tried many ways to get this working but none of them seem to be working. I have tried simply copying the DB files, I have tried mysqldump, I have tried phpmyadmin export, I have tried converting all this to latin1 then utf8, but nothing helps. Everything worked fine with my forum, it displayed all characters right, but now it only shows up right characters when I start a new forum entry, the old ones are messed up.
  10. Hi! I have a file in /var/www/localhost/stuff.php Then I use a command: "php /var/www/localhost/stuff.php?id=5" It fails because of special char "?", so if I use "php /var/www/localhost/stuff.php" - it works! With how I must replace "?" to make it work?
  11. Well, I would like to doubt that. A while go I made the whole script in a total mess, but a week ago I did a major recode. What I did was simply change from checking name to checking ID and some other things, like shortening the code (less instructions), I managed to get the query time from 1.2s to 0.2s! After you gave me the bit-type to test, I found in google an article "why I shouldn't use BIT", so I better will not. So what should be better? Can I specify and action for an out-of-range value on a single column? Or that is only possible with every column? What is the default action?
  12. The table is quite large, it has about 50 colums and over 1000 rows (will be larger), so every milisecond counts.
  13. Hi, I have been googling for this question for a while now and I found few answers for few situations. Now my IP is stored as INT, not char, and seems to be bit faster and I encountered with a new atribute - UNSIGNED. So the unsigned atribute can't store negative numbers, but what happens if an UPDATE or INSERT gives a negative number? What should be the best type and size for a number with 10 digits (positive), the best for numbers 1 or 0 and the best for a text with about 50 chars?
  14. Hi! $bin .= strlen(decbin(ord($txt_str[$i]))) < 8 ? str_pad(decbin(ord($txt_str[$i])), 8, 0, str_pad_left) : decbin(ord($txt_str[$i])); Got this line, but I don't understand a few things. For starters, it doesn't work, but will find out why after I will understand how it works. I understand all parts except "< 8 ?" and ":". What they do?
  15. Hi! I'm making a server query for Source engine games (like cs). Made already the main monitor part in php, but now is left some parts that involve bytes in the packets. http://developer.valvesoftware.com/wiki/Server_Queries#A2S_SERVERQUERY_GETCHALLENGE here are all parts of the packet and what they mean, as far as I figured then everything is sepereted with NUL (\x00). So now I'm stuck with the byte and can't figure out how could I make the byte as a readable number to everyone. Here is how it should look: $gotpacket = fread($fp, 4096); $gotpacket = substr($gotpacket, 5, 4); //removes headers, first chars of the packet is some whacky letters. $parts = explode("\x00", $gotpacket); //I hope that everything is really sepereted with a \x00! $maxplayers = $parts[6]; //Not sure if this is right $maxplayers = somefunction($maxplayers); echo $maxplayers; // Should be 17 Also this worked fine with connected players, but not with maxplayers: $playerson = $parts[5]; $playerson = substr($playerson, 0, 1); $playerson = ord($playerson); //is 15
  16. Where did the edit button go? Sorry about the double post then. I figured out that I could simply set a timer, but this isn't Assembler where 2 proccesses are ran in background. Luckily there is a function for a timer and already set for usage: socket_set_timeout($fp, 2);
  17. I think you misunderstood what I'm making. The server I'm testing is not TCP (also not HTTP), but it is UDP.
  18. Doesn't seem to work either.
  19. Hi! I made a simple query for a server, JK3 btw, because couldn't find any queries and LGSL always crashed my apache server. But there is a problem, I want to add the server monitor on a page, but the page wouldn't load if the server is down. This I have to connect to the server, but since UDP is connectionless then this can't be used if server is up. $fp = fsockopen("udp://ip", 29070, $errno, $errstr, 200); if (!$fp) { echo "ERROR: $errno - $errstr<br />\n"; } Also have this, but that doesn't seem to work. if(fwrite($fp, $packet)) { //... } How could I test if the server is up?
  20. You're a linux user? Also that can do
  21. Can you recommend one for simply this purpose?
  22. Hi! header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public", false); header("Content-Description: File Transfer"); header("Content-Type: application/zip"); header("Accept-Ranges: bytes"); header("Content-Disposition: attachment; filename=$zipfilepath"); header("Content-Transfer-Encoding: binary"); $zipfilepath is something like /var/www/site/htdocs/folder/something-001.zip When I open the page it starts downloading a file, that size is 1 kb and when I open it is damaged, because the file wasn't downloaded right. The path is right in $zipfilepath!
×
×
  • 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.