Jump to content

AV1611

Members
  • Posts

    997
  • Joined

  • Last visited

Posts posted by AV1611

  1. <?php
    $ctx = stream_context_create(array(
        'http' => array(
            'timeout' => 1
            )
        )
    );
    if(false === $str = @file_get_contents("http://example.com/", 0, $ctx)){echo 'Link Down';} else {echo $str;}
    ?>
    
    
    Well not sure if that's the best way to do it but it seems to work? I'll know for sure when the link comes back up 

  2. I have a website that pulls some data from another site with file_get_contents();

     

    It works great ... most of the time... but when the site I'm pulling from goes down (rarely) then my script hangs for a very long time...

     

    Is there a way for me to put ...say... a 10 second time limit on the file_get_contents() so it's just returns null or error or whatever then the rest of the page will load like normal?

     

    Thanks.

  3. what am I doing wrong?

     

    $LIST[0]=1; /for demonstration purposes

    $LIST[1]=7; /for demonstration purposes

     

    $result=mysql_query(select * from table where field IN $LIST);

     

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Array' at line 1

  4. I wasn't sure if it was a css issue or if it was simply calling a certain type image file via normal html so I went here. sorry.

     

    I'll check out your answers and let you all know how it all turns out :)

     

  5. Don't really how I get this done...

     

    I have a nice background image on a site. I have a div centered over the background for content. simple.

     

    I want to make the background color of the div be "opaque" so it looks dark but I can still kinda see the background image.

     

    I want it to work in Mozilla & IE

     

    1. possible?

    2. How?

     

    opaque gif doesn't seem to work

  6. I did this: http://www.phpfreaks.com/forums/index.php/topic,221929.0.html

     

    and it's working fine now.

     

    Now, here is the change I made:

     

    Rather than having the smileys in the table under the shoutbox I put the table in a separate popup page. the hope is it works the same. the actual question is what do I have to do to make the img click apply back to the original page?

     

    main page snippet:

    <script type="text/javascript">
    function insertSmiley(smiley){
      var txtarea = document.getElementById('smileytext');
      txtarea.value = txtarea.value+smiley;
    }
    </script>
    <script type="text/javascript">
    function popitup(url) {
       newwindow=window.open(url,'terms','height=500,width=750,resizable=yes');
       if (window.focus) {newwindow.focus()}
       return false;
    }
    </script>
    

    popup:

    <img  onclick="insertSmiley('');" src="Smileys/grin.gif" alt="" />
    
    

  7. I have spent the past few years trying to get proficient at PHP. I have gotten to the point where I can do most anything I need to now (albeit the code isn't always pretty :P). I have avoided JS like the plague cause I don't like it.  PHP is much easier to learn IMO.

     

    Anyways, can I get a few suggestions for a complete noob.  I am a quick learner but I am slow to get "traction" in the beginning until the light "clicks" if you know what I mean...

     

    Thanks.

  8. <form method="POST">

    <textarea></textarea>

    <input type="submit" value="Shout!" />

    </form>

     

    then at the bottom a simple table with

     

    <td><img.... /> :somecode: </td>

    and so on.

     

    The code and image are simple replace when the text is displayed. all posts are in database table, and all img name/code are in a table.

     

    that's it.

     

  9. 1st, I know PHP and NOT JS!  :P

     

    I have a shoutbox I wrote in php. It works great. when the user does : P for example they get :P .

     

    The bottom of the box is a textarea

     

    Below the shoutbox is a table with every smiley and code in a td cell.

     

    Now, the question.

     

    I want to make it so if you click a smily image below it shows up in the textarea above.

     

    No clue where to begin, but I 've seen similar before.

     

    Help, and be gentle :)

  10. I hate to tell you but if he's putting a file on your server then you've been compromised.  You need to reinstall from scratch.  Period. You MIGHT get lucky with a rootkit but prolly he's got crap in your system. It could be something like the ls command for example been patched to recreate or whatever.

     

    You're screwed. 

     

    1. Linux or Winblow?

    2. Virt domain or host domain?

    3. Your server or hosted?

     

  11. I really suck at dates myself.

     

    If I understand you want to search for a given month? or loop through each month. If the latter, that's separate I think.

    Either way, There are several ways I suppose but I would prolly determine the unix timestamp for the 1st day and last day of the month (midnight respectively) and add something like

    "... WHERE field >= $monthstart AND field <= $monthend..."

     

     

  12. So,

     

    You want to convert the hex AABBCC to decimal XXXYYYZZZ then take the last set and subtract 128 and see if it's a positive number or not?

     

    :D

     

    http://us2.php.net/hexdec

     

    <?php

    var_dump(hexdec("See"));

    var_dump(hexdec("ee"));

    // both print "int(238)"

     

    var_dump(hexdec("that")); // print "int(10)"

    var_dump(hexdec("a0")); // print "int(160)"

    ?>

     

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