Jump to content

miseleigh

Members
  • Posts

    63
  • Joined

  • Last visited

    Never

Everything posted by miseleigh

  1. Nevermind, we found a better way to do it anyway, but for future reference for anyone else - it's called ROW_COUNT(). Just call SELECT ROW_COUNT() after an insert, update, or select, and you'll have the number of affected rows.
  2. The MySQL manual says that the update statement returns the number of affected rows. We're trying to figure out how to use that feature, and it seems that few people use it or even think about using it. The way we've been doing it in the past has been performing the update and then doing a select to get the count. However, we're trying to reduce the size of our stored procedure (we need it faster!) and combining those into one statement would help. Any tips on this one? It's been hard to find anything online. Basically, in the stored procedure, we want something like SET v_count = UPDATE Users SET active=1 WHERE username=v_username); instead of UPDATE Users SET active=1 WHERE username=v_username; SELECT COUNT(username) INTO v_count FROM Users WHERE active=1 AND username=v_username;
  3. Could you add a print_r($_REQUEST) statement in add_answer.php and post the results? What you have should be working.
  4. We're porting over to MySQL from MSSQL, and while trying to create the tables in our new MySQL DB we're getting a syntax error that we can't find. CREATE TABLE `makem`.`Clients` ( `cl_ID` INTEGER UNSIGNED NOT NULL, `cl_username` VARCHAR NOT NULL, `cl_password` VARCHAR NOT NULL, `cl_challenge` TINYINT NOT NULL DEFAULT 0, `cl_answer` VARCHAR DEFAULT NULL, `cl_name` VARCHAR DEFAULT NULL, `cl_contact` VARCHAR DEFAULT NULL, `cl_phone` VARCHAR DEFAULT NULL, `cl_email` VARCHAR DEFAULT NULL ) CHARACTER SET utf8; It says there's a syntax error near 'NOT NULL'. If anyone can spot it, please let me know so I can fix it and make my table. Thanks!
  5. We solved it by using an intermediary page on the parent domain that does the javascripts after getting values from the child page. Just a warning to anyone else trying this: whether it's http or https, or whether the www is present or not, makes a difference to javascript- they must be alike before and after for js to recognize it as the same domain.
  6. Well, we've figured out it's a cross-domain problem... and that a work-around for that is plug an iframe into the child that's located on the parent's domain. But how do we use that work-around in order to fill a field on the parent page?
  7. We're trying to pass a link from a child window to the parent window after we upload a file. For some reason, the javascripts below don't even seem to be running, although all the values are filled in correctly after the php is done. The only thing we can think of is that the child loses its window.opener after processing its own form. Essentially, the parent calls the child, then the child processes a form to upload a file, and the child is then supposed to fill in a link to that document. <SCRIPT type="text/javascript"> window.opener.document.<?php echo $ret_field;?>.value = "<?php echo $link;?>"; window.close(); </SCRIPT> The child page uploads eveything properly, but then does not close and does not fill in the value on the parent. Thanks for any help.
  8. Mentioning that it's an SQL query would have made a big difference here. $q=sqlquery("select distinct email from user,user_group where user.user_id=user_group.user_id and (group_id=3 or group_id=5) and notify=1 and email<>''");
  9. Well, nevermind, I had another typo in the command that tells the Ether to send data back, so I never sent it the right command... *doh!*
  10. Whoops, I had a typo in there, but it really does all work up to the read() call: $sock = socket_create(AF_INET, SOCK_DGRAM, 0); One possibility I've thought of is that the Ether doesn't know where to send its data back to. Is there a way to listen to a specific ip address & port number, since I have no way of telling the Ether who's talking to it?
  11. It would be helpful if you could mark which line is line 20, but just giving it a quick glance, you mistyped 'password' in your sql select statement. Also, you really don't need all those quotes: $sql="SELECT email, password FROM sign WHERE email = $email AND password = $password"; would work.
  12. I'm using UDP sockets to talk to an Ether IO 24 board, and I need to make my commands get through properly, so I'm trying to read back the data I send to it. However, I'm not getting anything, and instead my browser just hangs. I don't know much about sockets (this is my first time using them) so maybe there's something I should be doing that I'm not or vice versa. Any help would be greatly appreciated. set_time_limit(0); $socket = socket_create(AF_INET, SOCK_DGRAM, 0); $result = socket_connect($sock, $IP, $Port); $cmd = pack("ci", $writeA, $xff); // writes to device - this works socket_write($sock, $cmd); $cmd = pack("c", $readA); // tells device to send data back socket_write($sock, $cmd); $buf=socket_read($sock, 2); // I get nothing here echo $buf;
  13. Thank you effigy, that is working perfectly.
  14. Thanks for your replies, but neither worked. I think the problem is that PHP is evaluating the \x part before the number is added to the string, so it doesn't realize it's supposed to escape it. Or something.
  15. I need to create strings with escape hex numbers - I'm trying to use sockets to write to a device that needs binary values. If I use a single string like "\x8" it does exactly what I'm looking for, but putting the 8 into a variable and appending them doesn't work properly. Any tips? $hex1 = "\x8"; socket_write($socket, $hex1); //this works! $hex = 8; $hex2 = "\x".$hex; socket_write($socket, $hex2); //this one doesn't, but I need to be able to do this. I've also tried $hex2 = '\x'.$hex and $hex2 = "\x$hex". Neither worked. Any help would be awesome.
  16. Also, those ssh commands are through putty's plink utility, with commands for the router we're linking to piped in from a text file. Maybe it's something with plink not waiting for the router's prompt before sending the piped-in commands when it's being run through Apache? I can't think what Apache would do to change this, though, the same batch file works fine when double-clicked.
  17. Just in case this helps, I'm running Apache 2.0.59 with php 5.1.6 on XP Pro 2002 sp2. Any help would be greatly appreciated.
  18. I'm trying to run a .bat file through php. The exec command works just fine if I use the CLI version of PHP, but doesn't work right if I run it through Apache. (It kind of works - I can get solitaire to run, but not a batch file containing SSH commands. Though that batch file runs fine if I double-click it.) So it looks like there's a permissions issue with Apache. Any tips where to look for this?
  19. Yet another update... this is really bugging me now. exec is partly working, but not fully. Doing an exec command on a process like solitaire or calculator does create a process, but the window won't pop up - it seems to get hung right after the process is started but before it really gets going. It's probably not a php issue like I thought it was, but I'm still hoping someone here can help because I really don't know where else to go. We've been working on this for a few days now and haven't gotten anywhere. Thanks for any help/advice you can offer.
  20. Also, just doing echo exec($bat); instead of piping it to a file results in Shouldn't it have "< routerfile.txt" instead of that 0? How well does exec handle piping within a batch file?
  21. We're using php to run batch files that create an ssh connection (using PuTTY) into routers and run various commands on those routers. At least, that's what we're trying to do, but somewhere along the way the commands for the router get partially lost. The code that creates & executes the batch file: $cmd.="$cmd="set PATH=D:\Program Files\PuTTY;%PATH%\r\n"; plink $rt -ssh -l $un -pw $pw < $script\r\n"; //plink is the putty connect command //$rt is the router's ip, $script is a file holding the ssh commands for the router $bat=$folder."putty.bat"; $fp=fopen($bat, 'w'); fwrite ($fp, $cmd); fclose ($fp); exec ($bat." >> ".$out); The batch file is exactly what we need it to be, and works well when you double-click it. However, when run through exec... basically, the first half of the router commands in the $script file get cut out. The .bat file (which works perfectly on it's own, btw): ($bat, above) set PATH=D:\Program Files\PuTTY;%PATH% plink ipaddress -ssh -l username -pw password < routerfile.txt And then routerfile.txt: And the output (from the $out file in the exec command): (where CLI> is the router's prompt.) As you can see, the router isn't receiving "enable config remote configur" when it should, but again this is only when we run the batch file through exec. I've also tried using system instead of exec, with the same results. The only things I've been able to think that might do this would be overrunning a buffer somewhere, or maybe it's not waiting for the router's prompt before it starts sending commands, or there's an Apache or PHP configuration issue. I would love some help if anyone knows what's going on here, or at least has some suggestions for where to look. Thanks.
  22. Alright, so those .dlls weren't my problem. Instead the problem was simply that Apache was running an older version of libeay32.dll than Windows was, so get a new copy of that one and put it in Apach/bin.
  23. Well, nevermind, we finally got the ssh module loaded properly by copying a newer version of libeay32.dll into Apache2/bin. I hate .dll issues. So now all I have to do is figure out how to use the ssh functions
  24. Well, I know the module should work, but it looks like the module isn't getting a function from one of the windows .dlls that it expects, and I just can't get it to load that way. ("Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.") I might be able to fix that if I could figure out which module is causing the problem, but I haven't been able to. So back to this. You're saying that loading a module in through the CLI doesn't affect Apache at all, even if I run it through Apache, so I'll have to write my ssh functions as CLI scripts? Is there a way I can get the results back from those scripts that way?
×
×
  • 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.