Jump to content

Archimedees

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Archimedees's Achievements

Member

Member (2/5)

0

Reputation

  1. Can some body please show me the correct way of defining a constant for a file name using define (); Please?
  2. Pleeeeease???? I want to create a php file that I will include in all my files to enable my scripts find specs.conf file which they require in order to execute. I was thinking of something like <?php // define specs.conf name and path define("specsname", "Specs.conf"); define("specspath", "home/ragley/config/space.conf"); ?> Now, let's suppose this was working, I would then include it in all of my scripts that need to use specs.conf Please assist me find out why it doesn't work.
  3. I want to create a php file that I will include in all my files to enable my scripts find specs.conf file which they require in order to execute. I was thinking of something like <?php // define specs.conf name and path define("specsname", "Specs.conf"); define("specspath", "home/ragley/config/space.conf"); <? Now, let's suppose this was working, I would then include it in all of my scripts that need to use specs.conf Please assist me find out why it doesn't work.
  4. Now, I have 2 arrays. $arOne and $arTwo I want to create another array $arThree which consists of the values of $arOne and the keys of $arTwo. Which function should I use??? Thanks.
  5. yes indeed. <html> <head><title>bla</title></head> <body> <form name="urllist" action="ActiveServer.php" method="GET"> <table border=1> <tr> <th></th> <th></th> <th>Server</th> <?php $arPageConf = read_contents_pageconf("page.conf"); $arPingConf = read_contents_pingconf("ping.conf"); $arPageServers = create_servernamelist_pageconf($arPageConf); $arPingServers = create_servernamelist_pingconf($arPingConf); //loop through PingServers to create final List $arFinalServers = $arPageServers; foreach($arPingServers as $nKey => $arServer) { $arFinalServers = search_array($arFinalServers, $arServer); }//end foreach($arPingServers as $nKey => $strServer) foreach($arFinalServers as $key => $value) { $strServer = $value["name"]; echo "<tr>\n"; echo " <td></td>\n"; echo " <td><input type=\"checkbox\"name=\"active[]\"value=\"active_".$strServer."\""; if ($value["active"]==true) { echo "checked"; }//end if ($value["active"]==true) echo "></td>\n"; echo "<td>".$strServer."</td>"; echo "</tr>\n"; } ?> </table> <input type="submit" name="submit" value="submit"> </form> </html>
  6. I have a form with checkboxes and the values of the checkboxes are derived from a file. I want user to be able to check or uncheck these boxes and thus change the values of active flag. When I check or uncheck new boxes and press submit, all the values are passed to form action file alright. The problem is when I refresh the page with the form the newly checked or unchecked boxes are back to the way it was before I changed their status. How do I solve this problem?
  7. According to script below. I set flag in $arParsedLines array to false then for set flag for every $arParsedLines containing $arServerNames to true. I get errors when doing this line Please read script below to understand my point. Wha is the correct way of achieving my aim??? Please help if you understand my probo. Thanks.
  8. I want to change this array into Does any kind person here know how I should go about that? Thanks.
  9. I have 2 arrays Now, I want to create another array with the numbers in the values of $arActive (in the active_) as Keys and the values of $arMyServers as values. Those number should match the keys in $$arMyServers e.g Which function should I use???
  10. In first.php I have a table inside a form with 2 inputs, names of server and a checkbox next to each server name. Clicked checkboxes reflect that the server is active and unclicked reflect that the server is inactive. Now, when I manually click the checkboxes and press submit button the server names and active status are passes as variables to second.php. Here I just extract the variables from request array and search for them in a function that creates server list. When Server name is found the active status is set to true. I later write new config file and account for these changes. My problem is that when I click the checkboxes which are empty(setting them to active or vice versa) everything works just fine and new configuration file gets written. However when I refresh first.php the newly clicked checkboxes are unclicked. It is like the new variables are passed and used in second.php but first.php does not store these changes. What to do??? Please help. Here's section of form showing inputs and variables that are passed in first.php
  11. Above string is passed from a form by get method and it contains several server names. if (isset($_GET["submit"])) { if (!empty($_GET["MyServer"])) { $strMyServer = $_GET["MyServer"]; }// end of (!empty($_GET['MyServer'])) else { die(" I died here"); }//end of else }//end of isset($_GET["submit"])) later in the script I want to search for each of the elements in $strMyServer ( which are server names) in array, $arPageServers and only if it's not there in $arPingServers. When match is found the server is set to inactive in the $arPageServer and $arPingServer respectively. Below is complete script to this effect. <?php // Process $_Get variables if (isset($_GET["submit"])) { if (!empty($_GET["MyServer"])) { $strMyServer = $_GET["MyServer"]; }// end of (!empty($_GET['MyServer'])) else { die(" I died here"); }//end of else }//end of isset($_GET["submit"])) // Load page.conf $arPageConf = read_contents_pageconf("page.conf"); $arPageServers = create_servernamelist_pageconf($arPageConf); $i=0; $MaxServers = count($arPageServers); for($i=0; $i<$MaxServers; $i++) { $arCurrentPageServer = $arPageServers[$i]; $nFound = false; }//end of for($i=0; $i<$MaxServers if($arCurrentPageServer["name"] == $strMyServer) { $Found = true; $arCurrentPageServer["active"] == true; //write new page.conf $nFileHandle = fopen("page.conf", "w"); $i=0; $nMaxlength = count($arParsedLines); for ($i=0; $i<$nMaxlength; $i++) { $arCurrentLine = $arParsedLines[$i]; $strNewLine =""; $bIsActive = $arCurrentPageServer["active"]; if ($bIsActive==false) { $strNewLine = $strNewLine."#"; }//end if ($bIsActive==false) //add URL to string $strNewLine = $strNewLine.$arCurrentLine["url"]."\t"; $strNewLine = $strNewLine.$arCurrentLine["email"]. "\t"; $strNewLine = $strNewLine.$arCurrentLine["size"]. "\t"; $strNewLine = $strNewLine.$arCurrentLine["command"]. "\r\n"; fwrite($nFileHandle,$strNewLine); } //end for ($i=0; $i<$nMaxlength; $i++) fclose($nFileHandle); } else { // load ping.conf $arPingConf = read_contents_pingconf("ping.conf"); $arPingServers = create_servernamelist_pingconf($arPingConf); $i=0; $MaxServers = count($arPingServers); for($i=0; $i<$MaxServers; $i++) { $arCurrentPingServer = $arPingServers[$i]; $nFound = false; } if($arCurrentPingServer["name"] == $strMyServer) { $nFound = true; $arCurrentPingServer["active"] == true; //write new ping.conf $nFileHandle = fopen("ping.conf", "w"); $i=0; $nMaxlength = count($arParsedLines); for ($i=0; $i<$nMaxlength; $i++) { $arCurrentLine = $arParsedLines[$i]; $strNewLine =""; $bIsActive = $arCurrentPingLine["active"]; if($bIsActive==false) { $strNewLine = $strNewLine."#"; }//end if ($bIsActive==false) //add URL to string $strNewLine = $strNewLine.$arCurrentLine["url"]."\t"; $strNewLine = $strNewLine.$arCurrentLine["email"]. "\t"; $strNewLine = $strNewLine.$arCurrentLine["size"]. "\t"; $strNewLine = $strNewLine.$arCurrentLine["command"]. "\r\n"; fwrite($nFileHandle,$strNewLine); }//end for ($i=0; $i<$nMaxlength; $i++) fclose($nFileHandle); }// end of if($arCurrentPingServer["name"] == $strMyServer) }// end of else ?> My problem is that I get on below lines respectively. Should I first make an array out of $strMyServer for me to compare individual values with the name of the servers in the PageServer and Ping Server lists? I would appreciate some help. if($arCurrentPageServer["name"] == $strMyServer) and if($arCurrentPingServer["name"] == $strMyServer)
×
×
  • 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.