Jump to content

severndigital

Members
  • Posts

    355
  • Joined

  • Last visited

Posts posted by severndigital

  1. I have a perl script that runs in cgi-bin directory.

     

    I would like to pass a hidden form value to it and assign it a variable in the cgi file.

     

    example

    $i++ while (-e "$c->{target_dir}/$fn$i$ext" && $c->{copy_mode} eq 'Rename');
    
    #needs to be modded to something like
    
    $i++ while (-e "$my_hidden_form_field/$fn$i$ext" && $c->{copy_mode} eq 'Rename');
    
    

     

    can anyone help a brotha out?

     

    Thanks in advance.

     

     

  2. let's say I have a string like

     

    'abdc'

     

    I would like to return every possible arrangement of that string. Like boxing a lottery number.

     

    so the result would be something like

     

    array('abcd',

    'acdb',

    'acbd',

    'adbc',

    'adcb',

    and so on

    )

     

    Is there an easy way to do this, or will have just have use like a ton of loops to make it work? it doesn't not have to be in any special order. i just needs to return all possible configurations of the string.

     

    Thanks in advance.

     

    P

     

  3. you pretty much answered your own question in your post .. but here goes.

     

    1. fill out the form and POST that form to the captcha page

    2. display the captcha information

    3. Add the previous pages POST information to the captcha form

    4. send all POST information to the confirmation page.

    5. send email if everything checks out.

     

     

    or you could just use a simple "captcha" like field:

     

    <label for="check">What is color of this text?:</label>
    <input type="text" value="answer here" name="check" id="check" />
    

     

    if would not be AS secure, but at least it is checking for some kind of human interaction.

  4. are you sure all the contents are files?

     

    you may need to put something like

     

    foreach($filenames as $value){
       if(!is_dir('/Library/WebServer/Documents/RandysWebsite/gallery/' . $foldername . '/' . $value))
       {
             copy('/Library/WebServer/Documents/RandysWebsite/gallery/' . $foldername . '/' . $value,  '/Library/WebServer/Documents/RandysWebsite/' . $foldername . '/images/' . $value);
       }
    
    }
    

     

    also I cleaned up the code a bit, you had some quotes in there you didn't really need.

     

    http://us.php.net/manual/en/function.is-dir.php

     

  5. I was just PM'ed on this post about wether or not I found a solution.

     

    well ... I did.

     

    So to complete the post .. here is the answer I came up with.

     

    function get_status($jobnumber)
    {
    	//echo 'Processing Job: ' . $jobnumber .'<br/>';
    	$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;
    	$shell = ssh2_shell($conn,'xterm');
    	fwrite($shell,"/usr/local/bin/invoiced_date.sh " . $jobnumber." \n ");
    	usleep(350000);
    
    	$response = fread($shell,100000);
    
                   /// .... Parse the repsonse however you need to.
    
                 return $response;
    
    }
    
    

     

     

    Hope others find this useful also.

     

    -C

  6. i need to get the char count of the result of a url

     

    in php i would do this.

     

    $link = 'www.google.com';
    $length = strlen(file_get_contents($link));
    
    

     

    any help on doing this in javascript would be great. I need to resize some divs and iframes based off of the char count.

     

    Thanks,

    C

  7. I am putting a ustream feed on my site.

     

    I want the site to look like the cartoon character is holding the stream window

     

    I have been playing around with z-index but can't seem to get it to work right.

     

    Can someone help me?

     

     

    here is what I have so far.

     

    <div id="stream">
        <img src="images/right_flap.png" style="z-index:2;position:absolute"/>
        <div id="videofeed" style="z-index:1;position:absolute">
             <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="586" id="utv526970" style="z-index:-1;"><param name="flashvars" value="autoplay=false&brand=embed&cid=2593430"/><param name="bgcolor" value="#000000"/><param name="allowfullscreen" value="true"/><param name="allowscriptaccess" value="always"/><param name="movie" value="http://www.ustream.tv/flash/mediastream/2593430"/><embed flashvars="autoplay=false&brand=embed&cid=2593430" width="480" height="586" bgcolor="#000000" allowfullscreen="true" allowscriptaccess="always" id="utv526970" name="utv_n_738783" src="http://www.ustream.tv/flash/mediastream/2593430" type="application/x-shockwave-flash" /></object>
    </div>
    </div>
    

     

    the page is here ... www.growingpirate.com

    you will see the pirate hook and hat are supposed to lay over top of the video stream.

     

    any help would be great.

     

    Thanks,

    C

     

     

     

     

     

     

  8. what is the type of field you are trying to insert the information into?

    if the field type is an int or enum or something it will be error out because of the comma

     

    also where is your mysql_query() line? does that have an mysql_error() with it?

     

    it should look something like this.

    $query "INSERT INTO table (field) VALUES ('value')";
    $push  = mysql_query($query) or die(mysql_error());
    

     

  9. I have an application that we use internally here at the office.

     

    The software company provides a Java API.

     

    Is there a way to use this Java API with PHP?

     

    or am i stuck having to use tomcat and jsp to interact with the api?

     

    if it is possible.. can someone give me a working example?

     

    the api documentation is located here

    http://elevenrings.com/dsapi/

     

    for reference.

     

    Any help would be great.

     

    Thanks,

    C

     

     

     

     

  10. ok so i got it figured out to a point .. i need to use setInterval().

     

    but why is this simple example not working properly?

     

    <script language="Javascript">
    function livestatus(){
    var output = '#FF99CC';
    document.getElementById('testing').style.color = output;
    }
    
    var time=5;
    var interval = time * 1000;
    var timer setInterval("livestatus()",interval);
    </script>
    <div id="testing" style="color:#03F">SOME STUFF HERE SHOULD CHANGE COLOR!</div>
    

     

    any help would be great.

     

    thanks,

    C

  11. I have a PHP based website that has a little piece of code that looks at database and diplays an image based on the database query.

     

    nothing fancy just like this

    //paraphrased this code just do you get the idea, my actual code works.
    $query = "SELECT status FROM status_monitor ORDER BY id";
    
    if($query == 1){
    <img src="images/active.png">
    }else{
    <img src="images/stopped.png">
    }
    
    

     

    I would like the graphic to change automatically without refreshing the page if the status changed.

     

    Can i do this using ajax?

     

    if so, can someone point me in the right direction?

     

    I have done ajax calls where i am switching the content of div or span using the onclick but i'm not sure how to do it without user interaction of some kind.

     

    i would also like to keep from refreshing the whole page if possible.

     

    thanks in advance,

    -C

     

     

  12. I am trying to display the information from an ssh2_exec() call

     

    here is my function right now.

     

    public function checkJobBilled($jobnumber){
    	echo 'Processing Job: ' . $jobnumber .'<br/>';
    	$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;
    		$stdout_stream = ssh2_exec($conn, $command);
    
    		$err_stream = ssh2_fetch_stream($stdout_stream, SSH2_STREAM_STDERR);
    
    		$dio_stream = ssh2_fetch_stream($stdout_stream, SSH2_STREAM_STDIO);
    
    		stream_set_blocking($err_stream, true);
    		stream_set_blocking($dio_stream, true);
    
    		$result_err = stream_get_contents($err_stream);
    		echo $result_dio = stream_get_contents($dio_stream);
    
    
    
    
    
    
    }
    

     

    when i run the $command directly on the remote machine (using putty) it works and displays something like

     

    jobnumber 111222 was delivered on 8/14/2009

     

    to the terminal screen.

     

    any reason why that is not showing up in my php code.

     

    just to verify everything is working right I ran the following

     

    ssh2_exec($conn,'ls -al >> "testfile.txt"');
    

     

    when i open testfile.txt on the remote machine, it contains the ls information, so my ssh2 connection is open and working properly.

     

    Any Ideas?

     

    Thanks,

    C

×
×
  • 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.