Jump to content

MetalSmith

Members
  • Posts

    64
  • Joined

  • Last visited

    Never

Everything posted by MetalSmith

  1. Ok I did the zip version. I added this to my apache 2.2.1 httpd.conf LoadModule php5_module "c:/program files/php/php5apache2_2.dll" AddType application/x-httpd-php .php PHPIniDir "C:/program files/php" Is that all I have to do? It seems to be working but I remed out the last 2 lines just to see if it still worked and it seems to work with just the LoadModule line added. I unremed them back to normal just in case. Any thoughts on this?
  2. This is a 5.2.11 windows install. I have done this many times before so I do not understand what I am doing wrong. I run Apache 2.2.1. Here is what was in my php.ini file after fresh install: log_errors=On error_log="C:\WINDOWS\temp\php-errors.log" extension_dir="C:\Program Files\PHP\ext" [php_GD2] extension=php_gd2.dll Strange thing is I used to see tons of options to change like memory and stuff.
  3. I am setting up Apache and PHP on a new Windows box but when I install PHP it is not putting php.ini in the start bar and under the PHP folder the php.ini file doesn't have any settings like it used to. What the heck is going on? Thanks!
  4. Yea I think that will work just fine. Thanks alot man!!
  5. Ok I was told to get a variable from a function you need to do something like this: function scale($quantity) { if ($quantity <= 4500) $interval = 1000; if ($quantity <= 2250) $interval = 500; if ($quantity <= 900) $interval = 200; if ($quantity <= 450) $interval = 100; if ($quantity <= 225) $interval = 50; if ($quantity <= 90) $interval = 20; return $interval; } $interval = scale ($some_number); But what if I want to get more variables from a function like below? function scale($quantity) { if ($quantity <= 4500) { $interval = 1000; $a = 25; $b = 75; $c = 150; ) if ($quantity <= 2250) $interval = 500; if ($quantity <= 900) $interval = 200; if ($quantity <= 450) $interval = 100; if ($quantity <= 225) $interval = 50; if ($quantity <= 90) $interval = 20; return $interval; } $interval = scale ($some_number); I need $a, $b, $c
  6. Yea I have this in there <form action = "process-log.php" enctype = "multipart/form-data" method = "post"> Thanks for all the help!! I will try your method!!
  7. This is what I have very simple. If I can do this within one form that would give me some flexability to position my submit buttons. Otherwise I can't group them together. I would say this is more like links than an actual form. Its not gathering any data from a user. It just takes the persons uploaded file and analyzes it. <body> <p style="text-align: center;"> <img src="logo.jpg" width="192" height="56" border="0" /> </p> <hr align="center" width="100%" size="0" noshade /> <br /> <?php if (move_uploaded_file ($_FILES['thefile']['tmp_name'], "{$_FILES['thefile']['name']}")) { print '<p style="text-align: center;"> <font size="+2">Your file was successfully uploaded.</font> </p>'; } else { print '<p style="text-align: center;">Your file could not be uploaded because: <b>'; switch ($_FILES['thefile']['error']) { case 1: print 'The file exceeds the upload_max_filesize setting in php.ini'; break; case 2: print 'The file exceeds the MAX_FILE_SIZE setting in the HTML form'; break; case 3: print 'The file was only partially uploaded'; break; case 4: print 'No file was uploaded'; break; } print '</b>.</p>'; } ?> <form action = "analysis-1.php" method = "post"> <input type="submit" name="submit" value= "Analysis-1" /> </form> <form action = "analysis-2.php" method = "post"> <input type="submit" name="submit" value= Analysis-2" /> </form> </body> </html>
  8. Well my thinking is that I have several php scripts that run certain reports. I was thinking the best way to do it was to have a submit button pushed to run a certain php script. Like by pushing "phone report" analyzes our phone usage. Then another would be "video conference" analyzes our video conference usage. So each button is attached to a php script. Maybe the way you posted would work. I need to think about it more. Thanks!
  9. Hello, Is there anyway to post different forms based on the submit button? I want to be able to click a submit button but have it post to a different php script based on the button pushed. I have this which works ok but I need more submit buttons within each form. </head> <body> <?php ?> <form action = "analysis-1.php" method = "post"> <input type="submit" name="submit" value="Analysis-1" /> </form> <form action = "analysis-2.php" method = "post"> <input type="submit" name="submit" value="Analysis-2" /> </form> </body> </html> EDIT: Please use [code][/code] tags when posting code on the forums, and use descriptive topic subjects.
  10. Great thanks everyone!
  11. ehehe thats awesome my post started a fight but can you all answer my last post?
  12. Corbin do you mean $y and not $x? $x is what ever I make it but $y is a specific value.
  13. So do you know why mine didn't work? I have a problem understanding how custom functions work. Thanks for all the help!
  14. I can't get my script to see this chunk of code. It just overlooks the function. Why? All it is supposed to do is this (119+$y) which is this (119+12) function center_total($x) { if ($x > 999) { $y = 12; } } center_total(1000); imagestring($image, 3, (119+$y), ((1210-(($total_calls/500)*50))-15), "$total_calls", $black);
  15. OK I have some questions here if anyone can help! First is, all I want to do is a LDAP query to tell me what user has dial up set to Allow or Deny in their user account. The problem is when I run it, if the attribute is missing like the "sn" was not typed in when the account was made the script errors out. Or if the dial setting is neither set for allow or deny it errors out. How can I get the script to over look an empty or null attribute. Or better yet why does in not retrieve and say nothing is there for that attribute? Second is and I don't know why. Why does the $i variable change based on the ldap_get_values function when in the loop I said $i = 0. When I echo the results in the end of the script it gives me the first, lastname and the dial setting. I can't understand why though. Shouldn't $i be the same value? I wrote this by trial and error looking at how to do it online. Still new to this! Anyone? Thanks! <?php $ldap = ldap_connect("192.168.xxx.xxx"); ldap_bind($ldap,"username","password"); $filter="(givenname=*)"; $attributes = array("givenname","sn","msnpallowdialin"); $search_result =ldap_search($ldap,"DC=example,DC=com",$filter,$attributes); for ($entryID=ldap_first_entry($ldap,$search_result); $entryID!=false; $entryID=ldap_next_entry($ldap,$entryID)) { $first_name = ldap_get_values($ldap,$entryID,"givenname"); $last_name = ldap_get_values($ldap,$entryID,"sn"); $dial_status = ldap_get_values($ldap,$entryID,"msnpallowdialin"); for ($i=0;$i<$first_name["count"];$i++) { echo "$last_name[$i], "; echo "$first_name[$i] => "; echo $dial_status[$i]; echo "\n"; } } ldap_unbind($ldap); ?>
  16. Thanks for the help!!! That was easy!!
  17. Hi all, Is there a way to set a variable to a range of values. I need a way to do this: $x = "5" OR "6" OR "7"; This does not work I understand, but I need a way to define a vaiable to a range of numbers. Thanks!
  18. WAAAHHOOOO!!!! I found the answer!!! Well it looks like this thread is turning into my own blog! but in my exhausting few days of google searching I did find a thread somewhere where a guy mentioned to have the Apache service running on windows changed to "Allow service to interact with desktop". To find this open up services and find the Apache service and under the login tab you will find it. I must also mention you MUST!! restart the PC. Restarting the service doesn't cut it. Aslo big thanks to the guy who came up with the method of running the script like I have below: <?php $WshShell = new COM("WScript.Shell"); $oExec = $WshShell->Run('"C:\Program Files\putty.exe" -ssh [email protected] -pw password -m "C:\Program Files\reload.sh"'); ?> having an exec() in a script and hitting with the webserver will cause it to hang. The script above is the work around. And for those of you interested in my script it will open a session with a local Linux box login and run any commands you want. You list the commands you want in a file called whatever.sh that's it! Good Luck!
  19. Well I have researched this for a few days now. My conclusion is that Apache on Windows is preventing this action from happening. The php code is not the problem its the limitations of the Apache web sever or some sort of security feature that can't be worked around. Bummer
  20. Well I also tried this. The browser does not hang anymore but notepad.exe does not execute. CLI works perfect again, SHOCKER!! <?php $WshShell = new COM("WScript.Shell"); $oExec = $WshShell->Run("notepad.exe", 3, false); ?>
  21. Ok I am desperate now. I am starting to think this can't be done. All I need is to have a php script open up Putty.exe run a command on a local Linux box and close out. I am using an XP machine with Apache on it. I have posted this problem before and had some good direction but every attempt gives the same result. Run it under the CLI works fine, Hit it on the Apache and it hangs. Here is my lastest attempt: <?php exec('php -q "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\aastra\awa-det\conference\reload.php"', $output); print_r ($output); ?> BTW I don't know what the -q does and the print output is irrelevant I just have it in there for trying to see whats going on. This script will call on this script: <?php exec('"c:\program files\apache software foundation\apache2.2\htdocs\putty.exe" -ssh [email protected] -pw (password) -m reload.sh'); ?> The reload.sh file has this in it: mkdir "New Folder" I have checked with the permissions in Apache and everything is set to Allow so I know that's not the problem. I must note that when I do hit it from the Apache I hear the windows exclamation sound in the background if that would give a clue to someone. Does Apache need its own account to run an exe file on windows? If someone can see what I am doing wrong I swear I will send you a check for $50.00!!!! If I can get this to work it will be pretty cool for what I am doing at work.
  22. Well I did some research and found this chunk of code that said would run a php script in the background. <?php $WshShell = new COM("WScript.Shell"); $oExec = $WshShell->Run('"c:\program files\putty.exe", 7, false'); ?> This one again works under DOS as my other methods did but this time when I connect to it on my PC which has windows XP and Apache the page does not hang which is good! but again it will not run the command to open the file putty.exe. There are no errors either. I am losing ideas. I even tried making the script point to a batch file that ran the program but again DOS fine Web Server no action.
  23. Great! Well thanks for all the help!!! I appreciate it alot!
  24. Well what I am trying to do is from a client PC access a script on a local web server (same network) that will run a php script to open up putty.exe to connect to a Linux box login and run a command then close out putty. Works great if I use the DOS method but takes a user interaction. When its done from the client PC the browser will hang. Can't the script open on he server run its command then close out without hanging up the clients PC?
  25. Well I tried this: <?php exec("notepad.exe"); ?> and my browser just hangs there loading. Is there mode code needed to see the progrma open? Would the note pad open on the client PC or would it open on the web server?
×
×
  • 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.