Jump to content

XaeroDegreaz

Members
  • Posts

    47
  • Joined

  • Last visited

    Never

Everything posted by XaeroDegreaz

  1. Well I wonder how other have produced Windows binaries for the pcntl extensions! I have even tried using cygwin and had no luck....
  2. Are there any windows c++ compilers that work under Linux? Or Linux compilers that are able to produce win32 binaries?
  3. Yes, I know, it's strange but there is a reason I'm doing it this way. The pcntl extensions cannot be built on Windows, so, I downloaded the Windows source distribution for PHP 5.3.1 and decided to give it a whirl building it there. The build process works fine, but it keeps producing Unix binaries after the make process (even though I am using a Windows source download). I was wondering how I could get the build process to produce Windows binaries under Linux. I'm sure it's possible, but I just don't know how to make it work. Any help at all would be greatly appreciated Thanks for the fast reply btw!
  4. Perhaps the tuesday cookie has already been set once and still resides in your cookies (perhaps from another testing of the script?) Try clearing your cookies.
  5. Nevermind guys, it's not that big of a deal. Since I seemed to fix my original problem, I'll go ahead and mark this as solved. Thanks for your guys' effort..
  6. I tried that, however, I get the NOTICE that those constants are undefined. [07-Jun-2009 04:24:57] PHP Notice: Use of undefined constant STDIN - assumed 'STDIN' in D:\...ExtensionManager.php on line 36 [07-Jun-2009 04:24:57] PHP Notice: Use of undefined constant STDOUT - assumed 'STDOUT' in D:\...ExtensionManager.php on line 36 [07-Jun-2009 04:24:57] PHP Notice: Use of undefined constant STDERR - assumed 'STDERR' in D:\...ExtensionManager.php on line 36
  7. I trouble shooted all the way through the code and finally came to the conclusion that stdout was the culprit. After juggling around the code, I can get it to work if I don't fclose stdout. It seems as though you cannot close stdout if you are gonna echo more text to screen? Is that what it is?? $out = fopen("php://stdout", "w"); $in = fopen("php://stdin", "r"); fwrite($out, "Which project should I launch? [blank = $defaultExtension]: "); $ProjectName = trim(fgets($in)); //# This Logger will print to screen just fine Logger::log(__CLASS__, "Testing: $ProjectName / ".$list[(int)$ProjectName]); fclose($out); //fclose($in); //# If I put the logger here, however, the CLI will quit. It is a simple echoing class, outlined below. //Logger::log(__CLASS__, "Testing: $ProjectName / ".$list[(int)$ProjectName]); $tst = new $list[(int)$ProjectName](); Logger.php <?php Class Logger { static public function log($class, $message, $die=false) { if($die) { print("# $class (FATAL): $message\n"); while(true){}; exit(); } print("# $class\t: $message\n"); } } ?> See, nothing fancy. I'm happy to have found the cause of my original problem, but now I'm faced with another problem. It takes a few seconds to close the CLI on my own now. It used to be instant. I assume because the CLI is trying to close STDOUT? Is there a way past this?
  8. Welcome to the PHP family, an everlasting quest of finding new ways to make computers do your bidding
  9. http://sourceforge.net/forum/forum.php?thread_id=3176187&forum_id=81620 3rd message down: http://sourceforge.net/forum/message.php?msg_id=7090445
  10. It runs all the way throgh to the return statement, but it seems to dislike outputing code into the console in that method, for some reason. This project is actually pretty large and I have been coding it myself for several months now. I just decided for my next release that I would like to have the startup a little more interactive by allowing users to create a project through the console (which oddly enough I'm using stdin for user input control and it works for the project creator) and to also allow them to choose which extension they would like to run. It's open source and available at https://launchpad.net/smartsocket However, the current additions that I am doing are not yet pushed to the repository.
  11. That is a shorthand way of writing an if statement.. http://www.tech-recipes.com/rx/288/php-if-statement-syntax/ http://www.scottklarr.com/topic/446/shorthand-php-if-statement-without-the-else-notation/ $variable = (statement) ? "return if true" : "return if false"; //# Compared to if(statement) { $variable = "return this if true"; } else { $variable = "return this if false"; }
  12. Nothing is foolproof, I was just giving him a concept to run with.
  13. Try this King. Contents of "a.php": Hello, this message is being served from a.php!<br/> Contents of "b.php": Hello, this message here is from b.php!<br/> Contents of index.php <?php echo("This will always be at the top.<br/>"); //# This will dynamically include the file in the querystring "page". Example index.php?page=a or ?page=b include($_GET['page'].".php"); echo("This will always be at the bottom.<br/>"); ?>
  14. I'm not sure, but in most PHP socket connections, the string must be terminated by a zero byte character, chr(0). Try appending that to your string? I'd be happy to help you out further if you need.
  15. Here is what I came up with. <?php if ($uId) { if ($uCan) { echo "<img src=\"i/user_go.png\">Hey! <STRONG>$uName</STRONG>"; // helo member! echo '<p>'; echo "<a href=\"index.php?action=editprofile\">Edit Profile</a> <br>"; echo "<a href=\"index.php?action=memberlist\">View Members</a> <br>"; echo "<a href=\"index.php?action=logout\">Logout</a> <br>"; echo '</p>'; echo "<br />"; //# This needs its own if statement... if ($uCan['admin']) { echo '<br />'; echo '<p><a href="index.php?action=admin"><strong>Admin</strong></a></p>'; } //###### } else { // if this isn't a member then echo "<img src=\"i/user_go.png\">Welcome, <STRONG>$uName</STRONG>!"; echo '<p>'; echo "<br>"; echo "<a href=\"index.php?action=login\">Login</a>"; echo "/"; echo "<a href=\"index.php?action=register\">Sign up</a>"; echo '</p>'; } echo "<BR>"; //break echo "<BR>"; // break ?>
  16. Are you sure that $uCan is an array?
  17. Try writing the contents to a file by using the fwrite function: $file = fopen("MyXML.xml", "w"); //File is created if it doesn't exist already, and it is overwritten if it does. fwrite($file, $myXML); //$ Outputs the contents of $myXML to the MyXML.xml file.
  18. Also, I have noted the typo above ($extenstion) but it doesn't make a difference in the code, since it is never even executed. I have changed it in the code and still nothing.
  19. Where is your PHP script being ran? If you are running it from your own computer it should be displaying your date. If you are running it from an external server, it will use that server's date. At the time of writing this, it is still June 6th here in the USA, so if you are being hosted by a USA server, then, that date being displayed is quite correct.
  20. Hi, thanks for taking the time to check out this post. To make a long story short, I'm taking input from the command line, and using that input to make a decision, and then load another class based on that decision. For some reason it keeps exiting, without loading the class and without error: This is the first part of the code: $xml = simplexml_load_file("Config.xml"); $em = new ExtensionManager(); $extension = $em->ScanExtensions((string)$xml->default_extension); echo("This text will not appear"); //# This seems to call, but it exits immediately afterwards and it SHOULDN'T because inside is an infinite loop. $e = new $extenstion(); Here is the ScanExtension method: public function ScanExtensions($defaultExtension) { Logger::log(__CLASS__, "Listing valid extensions..."); if ($handle = opendir('./Extensions')) { echo("*********************************************\n"); $i = 1; $list = array(); while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && is_dir("./Extensions/$file")) { if(file_exists("./Extensions/$file/$file.php")) { echo("[$i]\t$file\n"); $list[] = $file; $i++; } } } closedir($handle); echo("*********************************************\n"); } $out = fopen("php://stdout", "w"); $in = fopen("php://stdin", "r"); fwrite($out, "Which project should I launch? [blank = $defaultExtension]: "); $ProjectName = trim(fgets($in)); fclose($out); fclose($in); if($ProjectName > 0) { //# This text will not appear.. Logger::log is a simple echo class/method I have created Logger::log(__CLASS__, "Loading extension ".$list[$ProjectName-1]."."); //sleep(3); $ext = $list[$ProjectName-1]; }else { //# Neither will this logger output appear. Logger::log(__CLASS__, "Loading default extension $defaultExtension."); //sleep(3); $ext = $defaultExtension; } return $ext; } This method goes through everything fine. It accepts user input and seems to return the correct string stored in $ext (I know it is working because I purposely made some errors in the class it should call, and it appears in my log file) It just simply exits without any errors at all! I have error_reporting set to E_ALL. There is nothing wrong with the class file that gets called, because I can launch it just fine by commenting out the call to the ScanExtension method, and typing $e = new Example() in the first block of outlined code above. I'm not sure what's going on. I have tried taking the ScanExtension code from the method and just placing it beneath the first code block outlined above, and I get the same results. Any help at all would be greatly appreciated!
  21. Hehe yeah I kept editing my post over and over adding stuff to it hehe Trying to figure out exactly what he wants to do, but I think we pretty much covered the bases.
  22. <?php $query = mysql_query("Your query here"); $i = "What you want to match"; while($rs = mysql_fetch_assoc($query) { //Insert your code here for what you want to happen, for each result in the database if($rs["the name of the field you want to match"] == $i) { echo("<td width='24' height='16' class='event'><a href='##?IndexNo=$IndexNo'>$i</a></td>"); }else { //Here you echo what you want it to look like if it does NOT match what you want } } ?>
  23. Ok before I start coding, let me get this straight. You want to pull dates out of a database, and if the date matches your variable, then you want it to do what? Change the css class for that table?
×
×
  • 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.