PHP - Get Udp Bittorrent Peer List (ip List)
Is it possible to get bittorrent peer list (IP list) via php, udp protocol ?
txh! Similar TutorialsHi, In my mysql database i have a text input option, in the registration form and edit my details form i have a multiple select dropdown list, which user selects options to populate the text input box, which ultimately populates the text field in the mysql database. All works perfectly. The dropdownlist consists of 3 parts <optgroups> first is current selection (what is the usesr current selection)works fine, The second <optgroup> is existing words, what words we(the site) have given as options, and the third <optgroup> is the words that others have used. This is where im having a small problem. Because its a text field when i call the data from the database, it calls the entire text box as a single option in my select list.. I want to break the words in the text field (at the comma) and have them listed each one as an option in the select list. Example what i need: Words in text box:(my input allows the "comma") word1, word2, word3, word4, word5, word6, How i want them called/displayed: <option value=\"word1\">word1</option> <option value=\"word2\">word2</option> <option value=\"word3\">word3</option> <option value=\"word4\">word4</option> <option value=\"word5\">word5</option> <option value=\"word6\">word6</option> here's my code: $query = "SELECT allwords FROM #__functions_experience WHERE profile_id = '".(int)$profileId."' LIMIT 1"; $original_functionsexperience =doSelectSql($query,1); $query = "SELECT allwords FROM #__functions_experience WHERE profile_id = '".(int)$profileId."' LIMIT 1"; $functionsexperiencelist=doSelectSql($query); $funcexpList ="<select multiple=\"multiple\" onchange=\"setFunctionsexperience(this.options)\">"; foreach ($functionsexperiencelist as $functionsexperienceal) { $selected=""; if ($functionsexperienceals->allwords == $original_functionsexperience) $selected=' selected="selected"'; $allwords=$functionsexperienceal->allwords; $funcexpList .= "<optgroup label=\"Current selection\"> <option value=\"".$allwords."\" ".$selected." >".$allwords."</option> </optgroup> <optgroup label=\"Existing Words\"> <option value=\"existing1,\">existing1</option> <option value=\"existing2,\">existing2</option> <option value=\"existing3,\">existing3</option> <option value=\"existing4,\">existing4</option> <option value=\"existing5,\">existing5</option> <option value=\"existing6,\">existing6</option> </optgroup> <optgroup label=\"Others added\"> //heres problem <option value=\"".$allwordsgeneral."\">".$allwordsgeneral."</option> </optgroup>"; } $funcexpList.="</select>"; $output['FUNCEXPLIST']=$funcexpList; The result im getting for optgroup others added: word1, word2, word3, word4, word5, how can i get it like this: <option value=\"word1\">word1</option> <option value=\"word2\">word2</option> <option value=\"word3\">word3</option> <option value=\"word4\">word4</option> <option value=\"word5\">word5</option> <option value=\"word6\">word6</option> Hi , I have one question .. Can I split showing of content of dynamic list in 2 parts , when I echo list in code .. Code: [Select] <?php // Run a select query to get my letest 8 items // Connect to the MySQL database include "../connect_to_mysql.php"; $dynamicList = ""; $sql = mysql_query("SELECT * FROM products ORDER BY date_added DESC LIMIT 8"); $productCount = mysql_num_rows($sql); // count the output amount if ($productCount > 0) { while($row = mysql_fetch_array($sql)){ $id = $row["id"]; $product_name = $row["product_name"]; $price = $row["price"]; $date_added = strftime("%b %d, %Y", strtotime($row["date_added"])); $dynamicList .= '<table width="100%" border="2" cellspacing="2" cellpadding="2"> <tr> <td width="17%" valign="top"><a href="product.php?id=' . $id . '"><img style="border:#666 1px solid;" src="inventory_images/' . $id . '.jpg" alt="' . $product_name . '" width="77" height="102" border="2" /></a></td> <td width="83%" valign="top">' . $product_name . '<br /> $' . $price . '<br /> <a href="product.php?id=' . $id . '">View Product Details</a></td> </tr> </table>'; } } else { $dynamicList = "We have no products listed in our store yet"; } mysql_close(); ?> Code: [Select] <p><?php echo $dynamicList; ?><br /> </p> It works ok, and putting my files, everything works, but when I put 8 pictures with price and other details, it just show one image with details and another image below with details, and the third image below and so on .. Can I split dynamic list to show 4 images with details on the left side and 4 on the right side? Thank you in advance for help , if is possible Hi, I use the following code to create a select menu from an array of options stored in LISTS.php: include 'LISTS.php'; print('<select id="from" name="from">'); foreach ($langList as $lang) {printf('<option %s>%s</option>', ($from1 == $lang ? 'selected="selected"' : ''), $lang); } echo '</select>'; where LISTS.php includes the following: $langList = array(' ','English', 'French', 'German', 'Dutch', 'Spanish'); This works great, but now I want to do something similar with a checkbox list, where each checkbox has an associated 'onchange' javascript function and I'm getting pretty stuck. My checkbox list is of the following form: Code: [Select] <html> <ul style="height: 95px; overflow: auto; width: 200px; border: 1px solid #480091; list-style-type: none; margin: 0; padding: 0;"> <li id="li1b"><label for="chk1b"><input name="chk1b" id="chk1b" type="checkbox" onchange="function1('chk1b','li1b')">Option1</label></li> <li id="li2b"><label for="chk2b"><input name="chk2b" id="chk2b" type="checkbox" onchange="function1('chk2b','li2b')">Option2</label></li> //etc. </ul> </html> What I want to do is have 'Option1', 'Option2', etc. stored in an array in LISTS.php and have a PHP script that populates the checkbox list accordingly, in a similar manner to my select menu above. I can't work out how to get the ID of the next <li> and the next <input> in the list to go up by one each time, e.g. 'li1b' then 'li2b', 'li3b', etc. Could someone pls help me out? Thanks! Is there a way to take data that is listed like a,b,c,d,e and turn that into an unordered list? Basically, I'm going to have a list of schools that will be listed with comma separators. I'll print that data out in two places, one will be printed as it's in the database. The other I would like to echo as an unordered list. How hard would something like this be? I have a database with all my users. I need an empty list and when a user clicks a button "Add me to the list" they are added to the first position in the list Slots 1. Tom 2. 3. 4. 5. Later, Jerry wants to be added to the list. So this happens Slots 1. Jerry 2. Tom 3. 4. 5. More people join the list 1. Bob 2. John 3. Jerry 4. Tom 5. Tom gets upset clicks the same button to join the list again, and he's bumped back up to first place. Slots 1. Tom 2. Bob 3. John 4. Jerry 5. Is this possible? And is so, how would I go about getting started on such a thing? I've been using PHP for about a year and a half. Hello there, this is a really noob question, but I've no idea on how to make it work without making everything messy and crappy. I have one SQL table called categories, and another called subcategories. Inside the subcategories table there's a field named 'parent' that will link it to the correspondent category, so it should look something like this in html: Code: [Select] <ul> <li>Category <ul> <li>Subcategory</li> </ul> </li> </ul> Would you please give this poor guy a hand? =) the problem is that the bittorrent client can't receive any seeders and peers, on the site it shows correctly if the're are 1 or many, but the client doesn't receive any of that info, why ? can someone please look on the file A while back, I was showed how to authenticate to PostgreSQL using peer authentication over a socket for applications where PHP, FPM, and PostgreSQL are all on the same machine. All works. I could use native PHP as shown and it returns results without errors so I know that PHP, FPM, and PostgreSQL is setup correctly to establish a connection using peer authentication without a PostgreSQL username or password. $pdo = new PDO("pgsql:dbname=testing"); $rs = $pdo->query('SELECT * FROM company')->fetchAll(); I could also use Doctrine but not Symfony and get results without errors so I know that Doctrine is capable of establishing a connection using peer authentication without a PostgreSQL username or password. $pdo = EntityManager::create(['driver' => 'pdo_pgsql','dbname' => 'testing'], Setup::createAnnotationMetadataConfiguration([__DIR__."/../src"], true, null, null, false))->getConnection(); $rs = $pdo->query('SELECT * FROM company')->fetchAll(); Now I am trying to do the same but when using Symfony. I expected I could just edit config/packages/doctrine.yaml as follows, however, it results in An exception occurred in driver: SQLSTATE[08006] [7] fe_sendauth: no password supplied doctrine: dbal: driver: pdo_pgsql dbname: testing server_version: 13 Any thoughts how to do this? Thank you Hey, I'm having a issue with using a listbox.. Am I doing something wrong?? Heres my HTML: Code: [Select] <select style="height:100px;width:250px;" name="countries[]" multiple> <option value="US">United States</option> <option value="UK">United Kingdom</option> <option value="CA">Canada</option> <option value="AU">Australia</option> </select> and my PHP: $countries = $_POST['countries']; $countries = implode(' | ', $countries); I'm trying to set it up so I can insert the data as: US | UK | CA. But, when I submit the form, I get these errors: Quote Notice: Undefined index: countries in /Applications/MAMP/htdocs/mynewscript/admin/cp/add.php on line 30 Warning: implode() [function.implode]: Invalid arguments passed in /Applications/MAMP/htdocs/mynewscript/admin/cp/add.php on line 31 Thanks in advance! Hi , i am trying to make a to do list where i can add things i still need to do . i also want to remove items from the list when they are done , this is what i made now but it still misses a lot , my array keeps getting emptied when i add something.
im still a beginner in php. This is the file without the css included , i don't think it's relevant to this question to include it.
<?php Okay. Lets say i have a list box. Code: [Select] <select name="drop1" id="Select1" size="4" multiple="multiple"> <option value="1">item 1</option> <option value="2">item 2</option> <option value="3">item 3</option> <option value="4">item 4</option> <option value="0">All</option> </select> Now what i need it to do is open a file and replace the string [Replace] with whats in the list box. But it has to loop through everything in the list box understand? So How can i make it so that after it replaces 2 strings it gose to the next list item ect. after it replaces 2 more strings it goes to the next. So basically every 2 strings it will switch! Please help! here my code so far. <?php $fh = fopen(" myfile.txt", "r+"); if($fh==false) die("unable to create file"); ?> Please help! Hello, I'm trying to walk a directory into a single array from a specific starting point. For example, lets say that I wanted to start at the specific directory "/content/users/n-bomb/" it would then begin to parse from that directory and list all sub-directories and directories and store them into an array. I'm not sure what would be the best array structure, but since I know the directory where I'm starting from (members base directory) I just want the array to be from their home directory. Ideally, I'd want a full-path to each directory as well, but I'm not sure how to incorporate that into the array structure. Example array of "/content/users/n-bomb/": [n-bomb] => Array ( [0] => /content/users/n-bomb/form.vb [1] => /content/users/n-bomb/song.mp3 [2] => /content/users/n-bomb/movie.avi [images] => Array ( [0] => /content/users/n-bomb/images/funny.png [1] => /content/users/n-bomb/images/mad.png [2] => /content/users/n-bomb/images/sad.png ) [documents] => Array ( [porn links] => Array ( [0] => /content/users/n-bomb/porn links/good websites.txt [1] => /content/users/n-bomb/porn links/bad websites.txt ) [0] => /content/users/n-bomb/documents/bills.txt [1] => /content/users/n-bomb/documents/website.txt [2] => /content/users/n-bomb/documents/emails.txt ) ) I started to mock up some code, but I can't quite get it right: private function walk($directory, $start = False) { if(!is_dir($directory)) return false; if(!$start) $this->information["structure"][basename($directory)] = array(); $scan = scandir($directory); natcasesort($scan); foreach($scan as $item) { if($item == "." || $item == "..") continue; $item = $directory . "/" . $item; if(is_dir($item)) $this->walk($item); if(is_file($item)) ($start) ? $this->information["structure"][] = $item : $this->information["structure"][basename($directory)][] = $item; } } With the above code I'm getting results like this: Array ( [documents] => Array ( [0] => /content/users/n-bomb/documents/bills.txt [1] => /content/users/n-bomb/documents/website.txt [2] => /content/users/n-bomb/documents/emails.txt ) [porn links] => Array ( [0] => /content/users/n-bomb/porn links/good websites.txt [1] => /content/users/n-bomb/porn links/bad websites.txt ) ) As you can see that "porn links" is not going inside of "documents". How can I resolve this issue so my code will output like the array structure that I want? Hi ,
I am pretty new to php. I would like to create a php website based on folders.
I have a code so far that shows the names of folder in a selection box. What I would like to achieve now is how i get the images inside the folder after I click on submit. I know how to get the images with a glob function. What I don't know is how to get the value of each specific folder name. How would I do that?
I have this code so far to get the names of the folders in the selection box:
<form action="test.php" method="post"> <select name="myDirs"> <option value="" selected="selected">Select a genre</option> <?php $dirs = glob("*", GLOB_ONLYDIR); foreach($dirs as $val){ echo '<option value="'.$val.'">'.$val."</option>\n"; } ?> </select> <input type="submit" name="submit2"> <?phpif (isset($_POST['submit2'])) Hello, I am using the send mail form, everything is sent to my mail except the country field, it is sending blank. Code: [Select] $name = $_REQUEST['name'] ; $phone = $_REQUEST['phone'] ; $email = $_REQUEST['email'] ; $country = $_REQUEST['country'] ; $message = $_REQUEST['message'] ; $headers = "From: $email"; $sent = mail( $to, $subject, $name."\n".$phone."\n".$email."\n".$country."\n".$message, $headers); How could it be fixed please? thanks What I want to be able to do is this: If I have a list of values in my database: 1 13 26 15 12 4 I do a query of this database and sort it asc so it looks like this: 1 4 12 13 15 26 I want to know how I can use php and/or sql query to find these values based off of "position" in the list. If I wanted the 3rd value in the list, that value would be 12. If i wanted the 2nd value in the list it would be 4. How would I go about doing this? Thank you in advance. I have a "select"-drop down bar and I want to have a numbered list in it, i've tried but it doesn't seem to be possible. Is there any way that i'm able to do this? friends i got my subcats stores like this subcat_id subcat_name id_cat 1 name 1 and i fetch them like this Code: [Select] function getAllSubcategoryWithPrimaryCategory() { $subcategories = array(); $sql =" SELECT c.cat_name, sc.id_subcat, sc.subcat_name FROM `categories` AS c INNER JOIN subcategories AS sc ON c.id_cat = sc.id_cat order by c.cat_name asc , sc.subcat_name "; $rs = executeSql($sql); while($row = mysql_fetch_array($rs)) { $subcategories[] = $row; } return $subcategories; } now the thing is i have stored names like a b c d e f g h i j k l m n o p q other category but results are like this a b c d e f g h i j k l m n o other category p q Acending ways but i wish for the other category to show at the end of every subcategorym how could i get that done? Hey guys I need some help, Im trying to generate a numbered list by using i++ and an if statement but I cant seem to get the values to start over to 0, here is a look at my code Code: [Select] $make = "SELECT * FROM category_description ORDER BY category_id ASC LIMIT 1000"; $makeresult = mysql_query($make); while($make1 = mysql_fetch_array($makeresult)){ $parent = "SELECT * FROM category WHERE parent_id = {$make1['category_id']} LIMIT 1000"; $parentresult = mysql_query($parent); while($parent1 = mysql_fetch_array($parentresult)){ if(($make1['category_id'] == $parent1['parent_id']) AND ($make1['name'] == $make1['name'])){ $i += 1; $count = $i; echo "[". $count . "]" . " " . $parent1['category_id'] . " " . $make1['category_id'] . " " . $parent1['parent_id'] . " " . $make1['name'] . "<br />"; Basically the output comes out like this: Code: [Select] [1] 100 10 10 Acura [2] 101 10 10 Acura [3] 102 10 10 Acura [4] 103 10 10 Acura [5] 104 10 10 Acura [6] 105 10 10 Acura [7] 106 10 10 Acura [8] 107 10 10 Acura [9] 108 10 10 Acura [10] 109 10 10 Acura [11] 110 10 10 Acura [12] 111 10 10 Acura [13] 112 10 10 Acura [14] 113 10 10 Acura [15] 114 10 10 Acura [16] 115 10 10 Acura [17] 116 10 10 Acura [18] 117 10 10 Acura [19] 118 10 10 Acura [20] 119 10 10 Acura [21] 120 10 10 Acura [22] 121 10 10 Acura [23] 122 10 10 Acura [24] 123 10 10 Acura [25] 124 10 10 Acura [26] 125 10 10 Acura [27] 126 11 11 Audi [28] 127 11 11 Audi [29] 128 11 11 Audi [30] 129 11 11 Audi [31] 130 11 11 Audi [32] 131 11 11 Audi [33] 132 11 11 Audi [34] 133 11 11 Audi [35] 134 11 11 Audi [36] 135 11 11 Audi [37] 136 11 11 Audi [38] 137 11 11 Audi But I need it to come out like this, so basically if Acura = Acura generate 1,2,3,4 etc and if Audi = Audi generate 1,2,3,4......Im still somewhat new to this would really appreciate the help if someone can point me in the right direction: Code: [Select] [1] 100 10 10 Acura [2] 101 10 10 Acura [3] 102 10 10 Acura [4] 103 10 10 Acura [5] 104 10 10 Acura [6] 105 10 10 Acura [7] 106 10 10 Acura [8] 107 10 10 Acura [9] 108 10 10 Acura [10] 109 10 10 Acura [11] 110 10 10 Acura [12] 111 10 10 Acura [13] 112 10 10 Acura [14] 113 10 10 Acura [15] 114 10 10 Acura [16] 115 10 10 Acura [17] 116 10 10 Acura [18] 117 10 10 Acura [19] 118 10 10 Acura [20] 119 10 10 Acura [21] 120 10 10 Acura [22] 121 10 10 Acura [23] 122 10 10 Acura [24] 123 10 10 Acura [25] 124 10 10 Acura [26] 125 10 10 Acura [1] 126 11 11 Audi [2] 127 11 11 Audi [3] 128 11 11 Audi [4] 129 11 11 Audi [5] 130 11 11 Audi [6] 131 11 11 Audi [7] 132 11 11 Audi [8] 133 11 11 Audi [9] 134 11 11 Audi [10] 135 11 11 Audi [11] 136 11 11 Audi [12] 137 11 11 Audi How can I edit this code to have images appear in it? <div id="rssSummaryList<?php echo intval($bID)?>" class="rssSummaryList"> <?php if( strlen($title)>0 ){ ?> <div class="rssSummaryListTitle"><?php echo $title?></div> <?php } ?> <?php $rssObj=$controller; $textHelper = Loader::helper("text"); if (!$dateFormat) { $dateFormat = t('jS F, Y'); } if( strlen($errorMsg)>0 ){ echo $errorMsg; }else{ foreach($posts as $itemNumber=>$item) { if( intval($itemNumber) >= intval($rssObj->itemsToDisplay) ) break; ?> <div class="rssItem"> <div class="rssItemTitle"> <a href="<?php echo $item->get_permalink(); ?>" <?php if($rssObj->launchInNewWindow) echo 'target="_blank"' ?> > <?php echo substr ($item->get_title(), 0, 100); ?> </a> </div> <div class="rssItemDate"><?php echo $item->get_date($dateFormat); ?></div> <div class="rssItemSummary"> <?php if( $rssObj->showSummary ){ echo $item->get_description(); } ?> <a href="<?php echo $item->get_permalink(); ?>" <?php if($rssObj->launchInNewWindow) echo 'target="_blank"' ?> >Read more</a> </div> </div> <?php } } ?> </div> Hello All, i am trying to figerout how can i create a list of options that the user can input the values to as many lines as he wants and then getting the value of each row and inserting it to my DB (mysql) i havent found anyway to make this kind of list that is "open" for edit and is not limited... Can anyone suggest anything ? |