Jump to content

severndigital

Members
  • Posts

    355
  • Joined

  • Last visited

Everything posted by severndigital

  1. you be needing to poke around at the MySQL .. Like parameters http://www.htmlite.com/mysql011.php
  2. i tried that also with no luck.. just returns an empty variable. when I run the .sh script in the command line on the server it returns a line of text to terminal. that line of text should be outputting correct?? $conn = ssh2_connect($this->_host); ssh2_auth_password($conn,$this->_user,$this->_pass)or die("Cannot Connect"); //build command line to include this jobnumber $command = '/usr/local/bin/invoiced_date.sh ' . $jobnumber; //issue the command line $stream = ssh2_exec($conn,$command); stream_set_blocking($stream,true); $output = ssh2_fetch_stream($stream,SSH2_STREAM_STDERR); $output = stream_get_contents($output); echo 'what i got: ' . $output; is that code right .. or am I missing something?? Thanks again, C
  3. @ operator good explanation here .. http://thesmithfam.org/blog/2006/05/07/php-the-operator/ single line if statement $question_mark = $samoi == 'Yes' ? 0 : 1; //is the same as if($samoi == 'Yes'){ $question_mark = 0; }else{ $question_mark = 1; } Hope that helps.
  4. here's what i got. $conn = ssh2_connect($this->_host); ssh2_auth_password($conn,$this->_user,$this->_pass)or die("Cannot Connect"); //build command line to include this jobnumber $command = '/usr/local/bin/invoiced_date.sh ' . $jobnumber; //issue the command line $stream = ssh2_exec($conn,$command); stream_set_blocking($stream,true); $output = ssh2_fetch_stream($stream,SSH2_STREAM_STDERR); echo 'what i got: ' . $output; when this echo's i get. what i got: Resource id #7 how do i turn Resource id #7 into actual information? Thanks in advance, C
  5. I installed and configured zend server CE on my linux machine. I used the quickstart guide here. http://framework.zend.com/docs/quickstart/ and followed all the instructions. then at one point in the guide it says but that just takes me to the default apache2 welcome page. I also tried http://localhost/quickstart with no luck. How do I get to my framework application from the browser? Thanks, -C
  6. that will work, I was just trying to save myself from writing a really long if statement. thanks plenty. C
  7. I would pull the data first, then push the random number this is the short version, since I don't know your mysql interface. $array = "SELECT id FROM table"; for($i = 0; $i < count($array); $i++){ $update = "UPDATE table SET t_val='" . rand(1,10) . "' WHERE id='" . $array[$i] ."'"; } **EDIT ** this will NOT ensure that each entry gets a different random number, if that is needed.
  8. this might be impossible, but i had an idea and can't seem to find if it is possible. I have a quite a few of functions that I need to call based on the content of a variable. all the functions are basically named the same except for the content of the variable. can I load the variable as part of the function name?? here is some code that might help to explain it better. $variable = $_POST['renderIntent']; //this can be a bunch of different things we'll say HTML for this example. render_$variable_info(); // which would translate to render_HTML_info(); i know the easiest way would be to make an if else and go through all the functions. but there are more than a few possibles. Unfortunately this is how the code is now, and I'm trying to make the best of crappy situation. any help would be great. Thanks,
  9. i have a function something like this function myfunction($var,$var2){ //bunch of code here //that results in a return array(); } I can access that array without assign a variable? something like myfunction("input1","input2")[0]; or am I looking for something that just isn't possible? Thanks in advance, C
  10. if i use the following $pull = pg_query($sql) or die("Error"); while($r = pg_fetch_array($pull){ $result[] = $r; } everything works out, but i get an array of two values (one the NUM => the value and the other the ASSOC => the value. when i change the pg_fetch_array() command to this pg_fetch_array($pull,PGSQL_NUM) i get the following error Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 32 bytes) in /var/www/html/dpSandbox/calculator/class/database.class.php on line 56 i don't understand why. It doesn't matter the size of the database or the amount of data, it still will return this error. any ideas? do i have something configured wrong?? Thanks in advance -SD
  11. I don't think Apache is the ideal place to do this, but I'm out of ideas so if anyone can point in the right direction it is much appreciated. we have a single ip address coming into our building. lets say the ip is 123.456.789.012 when a request comes in on that ip for our domain on port 80, it routes to our linux machine running Apache which houses our domain : www.mydomain.com and is at ip 172.16.2.7 what i need to do is when a request is issued for a subdomain like subdomain.mydomain.com I need to forward that request to another internal IP: 172.16.2.8 Like I said, I have a feeling Apache is NOT the place to be doing this, but I have to start somewhere. Thanks in advance, -SD
  12. thanks to both. I just got myself at turned around and dizzy. both posts were help. -P
  13. here is my array Array( [0] = 'Peter' [1] = 'Stewie' [2] = 'Brian' ) I want to add Lois to the array but at position 1 so the array looks like this. Array( [0] = 'Peter' [1] = 'Lois' [2] = 'Stewie' [3] = 'Brian' ) what is the best way to achieve that? My original thought was to make a loop that when it gets to the position inserts the entry and then +1 to rest of the entries. but i figure there must be a better way. thanks, -P
  14. I want to put borders around the table cells on this table using css. <table name="purgeTable" id="purgeTable" /> <thead> <th >Job Num</th> <th >Customer</th> <th >Job Name</th> </thead> <tbody> <tr> <td >172860r</td> <td >Guitar Solo</td> <td >Bellinati:valsa Brilhante</td> </tr> <tr> <td >176430</td> <td >Wayne Leupold</td> <td >Organist's Companion-july</td> </tr> </tbody> </table> if i remove the thead and tbody tags I can set the borders of the table and the cells. how do i control the border of the cells, rows, and headers when i am using the thead and tbody tags? I've looked a bunch of online examples, but can't seem to get this working correctly. here is my css #purgeTable table, td { border-color: #600; border-style: solid; } #purgeTable table { border-width: 0 0 1px 1px; border-spacing: 0; border-collapse: collapse; } #purgeTable td { margin: 0; padding: 4px; border-width: 1px 1px 0 0; background-color: #FFC; } I'm very confused now, i've been coding in circles for about an hour. please help Thanks
  15. thank you .. i knew it was something simple, i just had a brain fart.
  16. i have a list of errors and the codes to go with them in a constants.php file like this define("P001","General Processing Error"); i want to issue the error code as part of the url for example www.mysite.com/index.php?view=error&ecode=P001 how do I get my php code to recognize the ecode as a constant? i could do it this way if($_GET['ecode'] == "P001"){ echo "<error>" . P001 . "</error>"; } but i was hoping to not have to hard code the error number since i have quite a few of them. I was thinking it would end up looking something like this: if($_GET['view'] == 'error'){ echo "<error>" . some way to get php to see the ecode as constant . "</error">; } thanks in advance, -P
  17. ok .. so after a quick look I am using PHP 5.1.6 which does not have Json included. no worries though I installed the PECL extension version of the json functions, since upgrading to 5.2 is not an option at this point. looks like everything is going to work though. Thanks much. -P
  18. yes. right now the function that is being called is set to print_r() the array. should I change that?
  19. ok .. so i have a url i can access with various get variables to pull information i need. like site.com/?method=search&q=searchstring&option=file the result is echoed on the screen as an array. that looks like this Array ( [0] => Array ( [HANDLE] => Collection-58148 [DISPLAYNAME] => Collection Title ) ) in another script on a completely different sever that DOES NOT have access to the source code of the first script. I am running this $result = file_get_contents('linkwith?all=the&get=information'); how do I get the text output of the array back into an array? I'm not sure what php function (s) to use to do this. Thanks, C
  20. i would like to do something like this $var1 = 'yes'; $var2 = ''; $var3 = 'yes'; if(empty($var1) || empty($var2) || empty($var3)){ echo 'var2 is empty'; } I know that's not right, but it was the easiest way to explain what I am trying to do. can anyone help? Thanks. -P
  21. FIgured it out. here it is for anyone else probably not the cleanest way .. but it's working //removing evertything before the <?xml $headers = substr($string,0,stripos($string,"<?xml")); $string = str_replace($headers,'',$string); //then we remove anything after the last > just to be safe. $string = substr($string,0,(strrpos($string,">")+1));
  22. I have an XML reponse from a server using fsockopen(). the response includes the headers, which I don't need. what is the easiest way to remove all the of the content before the <?xml chars?? Thanks, -P
  23. I've been working on a script to automatically log into one of our internal systems and perform search functions. I need to log into the system to do this. I used the HttpRequest() class to get in. But I've been having some problems. Apparently the login form has a hidden field in it called login_token that needs to be sent along with the post data. the login page and the action for the form are two different pages. how do i read the value of the login_token field and pass it along with the post data to the login action? here is what I have so far. $DSUrl = 'http://my.site.com'; $user = "username"; $pass = "password"; $login = new HttpRequest($DSUrl . '/ApplyLogin',HttpRequest::METH_POST); $post_data = array("username"=>$user,"password"=>$pass,"domain"=>'DocuShare'); //$post_data = array("username"=>$user,"password"=>$pass); $login->addPostFields($post_data); //$login->addHeaders($headers); try { echo $login->send()->getBody(); }catch(HttpException $ex){ echo $ex; } Thanks in advance. -P
  24. Ahhh .. ok I was starting a new request class with the login page. what I needed to do was start the class with the url that is running the login script. AHHHHH ... OK .. well it's giving me an error, but It is posting the information now. -Thanks, sorry for confusion. -P
  25. ok so I learned that addPostFile is for uploading files .. how do I tell the request which form on the page to submit?
×
×
  • 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.