Jump to content

CTM

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

CTM's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. CTM

    Array Help

    [code=php:0]if ( $_POST['sub'] == "yes" ) {   $field_num = 8 ;   $field_prefix = 'p' ;   $p_array = array ( ) ;   for ( $i = 0 ; $i < $field_num ; $i ++ )   {       $p_array[] = $_POST[ $field_prefix . $i ] ;   } } if ( $_POST['sub'] == "yes" ) {   $values = array_values ( $p_array ) ;   foreach ( $p_array as $value )   {       if ( in_array ( $value, $values ) )       {         $error = "yes" ;       }   } }[/code]
  2. First off, you should put !== FALSE on line 259, that might be your error. Else, it's exactly as it says. It can't read from the socket =/
  3. CTM

    SSL Problem

    I did, but the answer wasn't there. However, I did fix my problem. You simply put the 'capture_peer_cert' in the 'ssl' wrapper in the stream context, and once connected, you fetch the new context and if there is a certificate, it'll return it in the context under the wrapper 'ssl' as 'peer_certificate'. While I had understand that much, I'd forgotten to put -with--openssl[=DIR] Eh...
  4. shoz's probably right. Your webhost might prevent (out or in) UDP connections.
  5. $query = mysql_query ( "SELECT * FROM posts WHERE page_id='$id' ORDER BY auto_increment_field_stuff_thingy ASC" ) ; Replace auto_increment_field_stuff_thiny by whatever is your primary auto_increment key.
  6. PHP can't do dynamic things :) What you should do is fetch all the possible results before outputting anything and add them in a Javascript array. Then, through Javascript means, you can switch options dynamically. Forget PHP and Dynamic, unless you're using AJAX.
  7. SELECT SUM(speed) as speed_amount, SUM(power) as power_amount, SUM(dex) as dex_amount FROM table That's assuming you'd want to select the sum of each attribute for every user in table "table". This is a mysql query by the way :p
  8. No. And I'm not sure what you want. You'd want an exact replica of the dropdown options above? Or another one with different info? As I explained my comments, the $select_options[] lines is simply to indicate that you're appending a new value into the $select_options array (which, in that instance, was the usual "<option value='username'>username</option>"). $select_options[2] will simply return the third iteiration of that array, which means a singleton of type "<option value='username'>username</option>". Anyway, explain what you want.
  9. You should treat the error right way instead of doing a rollback.
  10. You're using : /[+]@[+]\.[A-Za-z]{2,3}/ To match any character, it's prefer to use (.+?) instead of [+]. You'll also need to put a \ in front of the @ to avoid any warnings, and you'll probably want to change the {2,3} to {2,5}, since some are obviously longer. Also, what about .qc.ca, or any subdomain? Eh? You should use : /(.+?)\@(.+?)\.([a-zA-Z0-9]\.[a-zA-Z0-9]{2,5}|[a-zA-Z0-9]{2,5})/ I'm no expert in REGEX though, so it's not optimized.
  11. He could use Javascript alone too, depending on his purpose.
  12. Then either your register_globals is turned off or you're preg_match pattern is incorrect. I checked your pattern, and your error is really...well, stupid. You put : [code]/[A-Za-z0-9]{3, 50}/[/code] Correct one would be : [code]/[A-Za-z0-9]{3,50}/[/code] Notice the lack of space between "3," and "50"? Yup, the space was your error :)
  13. You wouldn't really need a second query if using my method, but then again, a second query would speed the process of treating the country info. I'm not sure in memory usage which one would be faster, but the second query is definitively simpler.
  14. That's because you weren't looping through all the results, simply using the first one. Now, onlyican's solution works, but you could always do something like : [code=php:0]<?php include 'db.php' ;  // Including the DB configuration, connection and such I presume $query_users = "SELECT username FROM users" ;   // Instead of *, since you're only using the username field, only fetch that (for memory issues) $users = mysql_query ( $query_users ) or die ( mysql_error ( ) ) ; $select_options = array ( ) ;   // Instead of using a string, we'll use an array into which we'll store every result (in the <option> tag form) while ( $row_user = mysql_fetch_assoc ( $users ) )   // Loop it up {   // The [] after select_options indicates to append a new value to the select_options array   $select_options[] = "<option value = '" . $row_user['username'] . "'>" . $row_user['username'] . "</option>" ; } $select_options = implode ( "<br />", $select_options ) ; // I'm simply using this (and the array form) for formatting preferences (when viewing the HTML source) // Now, you have a long string which contains every option that goes inside your select element. ?> <table width="925" border="0" cellpadding="0" cellspacing="0">  <!--DWLayoutTable-->  <tr>    <td width="104" height="24" valign="middle">Day:</td>    <td width="438" valign="top"><form action="viewusers.php" method="post" name="user" id="user">        <div align="left">          <input name="formtype" type="hidden" id="formtype" value="users">          <select name="formquery" id="formquery">            <?php print $select_options ; ?>          </select>          <input name="Submit" type="submit" class="table" value="Go!">        </div>      </form></td>    <td width="383">&nbsp;</td>  </tr> </table>[/code] Anyway, onlyican's should work fine too, but it can't be re-used.
  15. Hi, I've been trying for a few days to make a script which would loop through a list of IPs through HTTPS connections and, if the server happens to issue a certificate, I'd like to fetch the issuer and user of said certificate and log that into a text file. Now, connecting and looping isn't really hard, but I can't figure out how to get the certificate. I know how to parse it (once I get (somehow) the x509cert data), but the documention on that part seems to be lacking on the web. I've looked in the Zend CVS, and since PHP 5.1.3, apparently there are now two new SSL Context Options, capture_peer_cert and capture_peer_cert_chain, which would seem to be what I need. Unfortunately, I have no idea how to use those, and then they say the certificate data (in x509 format) will be returned as a SSL Stream Context variable, something I didn't even know about. If anyone could help me out, I'd appreciate.  :) Edit : Apparently, everywhere I've posted this no one's been able to help me...Where could I get support for this issue then, if no one on common php boards knows anything about it?
×
×
  • 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.