Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Windows Program Command Exists


I can do this so easily in Unix: PHP Code:

$msg = exec('whatis convert 2>&1');
echo $msg;

However, in Windows using MS-DOS, I'm utterly lost. I am having to find out if ImageMagick is installed on a system for a function to operate (ImageMagick is required), and since this is a portable web application, you simply can't install ImageMagick everywhere you go.

Therefore I need to know if the system home has ImageMagick or not, and in Unix, I simply do a "whatis convert" and I can tell, but since MS-DOS has no equivalent to "whatis" I can't figure it out, and just running the "convert" command within a recursive function onto thousands of images is just not a good idea.




View Complete Forum Thread with Replies

Related Forum Messages:
PHP Running Exec() Windows Program Very Slow In Comparison To UNIX Equivalent Program
Does anyone have an explanation or solution for the following.
I have a PHP script that uses exec() to call a program to do certain
calculations.

The UNIX version of this program I call runs in about 4 to 5 seconds.
When I run the same PHP script using exec() to call the Windows equivalent
of this same program on my Windows desktop, it takes about 32 seconds....

View Replies !
How Do I Make Sure That An External Program Does Actually Exists?
web host said there is a program /usr/bin/convert I can use to convert image files, after I call it in my code, it does not seemed to be doing anything. I'm sure the command line is right because I echo the commandline to make sure. How do I make sure that an external program does actually exists? I use if (file_exists "/usr/bin/convert")), is there any othe way? Or am I doing something wrong that the system call is not working? For example:

//convert test.jpg to converted.jpg
$command = "/usr/bin/convert "test.jpg" "converted.jpg"";

echo $command;

system($command);

View Replies !
File EXISTS Command
i have a file exists on my page. It check to see if there is a picture of the product.  If it exists, then it displays the item. It works just fine. I recently got a paging system to work to split the query results into numerous pages. Now here is how it normaly works.

View Replies !
File EXISTS Command With QUERY ?
i have a file exists on my page.  It check to see if there is a picture of the product.  If it exists, then it displays the item.  It works just fine.  I recently got a paging system to work to split the query results into numerous pages.  Now here is how it normaly works

QUERY
IF FILE EXISTS
   - display item

now here is how the paging system works..
QUERY - AND COUNT # OF ROWS MATCHING DATA
QUERY - split rows of matching data by PAGE LIMIT, etc.

NOW, the problem is when you mix them, the file exists works, but on the page #'s on the bottom counts ALL ITEMS MATCHING QUERY, just doesnt display them because of the file exists.  My question is to know if there is a way do the FILE EXISTS in conjunction with the paging system. 

so for example. i have 40 items in database, 4 of them have pics.  Paging system shows 4 per page... so the query finds all 40 items that match criteria and divides them my page limit (4) so you get 20 pages.  So the first page has the 4 items with pictures, then the last 19 pages display nothing because the FILE EXISTS is over riding it. 

View Replies !
Exec Command Executing The Program In The Background
i am running xampp on my computer from apachefriends.org, it's a apache server

this is the php script

<html>
<head>
<?php

exec ('notepad');
?>
</head>
</html>

but when i execute the php script on my computer , notepad doesnt not run

i used a process viewer and discovered that notepad is running in the background and i cannot see it

does anyone know how NOT to make it run in the background? i wan to see the notepad window on the apache server (my computer)

View Replies !
Need To Run A Command Line Program All The Time On A Web Server
I have a command line program that I need to have run on the server non-stop. I can start it at the command line but it stops when my session closes. If I set it to run through cron, I am pretty sure it needs an interval.

View Replies !
How To Pass Command Line Argument To C Program From PHP Code
As we know that, we can pass command line agrument for C using
"scanf" commands, So as same as that, Is there any way to pass those
commandline arguments through php code to C and process them.

View Replies !
System Command :: Creating A Password Using The Htpasswd Program
I'm having trouble creating a password using the htpasswd program with the PHP systems command. Here is my code:

//CREATE THE HTPASSWD FILE
echo "running command...";
$command = "c:program filesapache groupapache2 inhtpasswd -c .htpasswd david";
$test = system($command, $returnvalue);
echo "executed command: ".$command;
echo "<br>";
echo "here are the results: ";
echo $test;
echo $returnvalue;

View Replies !
Does Anyone Know Of Any Program That Would Be To Windows What CRON Is To Unix.
Does anyone know of any program that would be to Windows what CRON is to Unix.

I Run Apache on XP with PHP 4--and am hoping that I can find something like described above.

View Replies !
Execute A Windows Program From An Anchor Tag
I believe I am close but I have spent several hours investigating this and
can't understand why it won't work. I have tried exec, system, and settled
on popen from reading various notes on the subject. I am wanting to launch
a file editor when I click on a link. This is strictly an internal
application so I don't need to worry about escaping shell/args. This is
what seems as if it should work, however it doesn't. This is on XP, latest
Apache 1.3.29 and PHP. The logic makes it into the "if" test and the file
exists. Thanks.

if (chdir("C:Program FilesTextPad 4")) {
$cmd = "start "textpad.exe" x:webprogram.php";
pclose(popen($cmd, "r"));
}

View Replies !
Php Session Problems When Working With A Windows Client Program
I am currently involved in a project that involves a windows client
program written in delphi and a web application written in php. I
have made several php pages for the delphi program to do requests via
the http component from INDY. the problems I am having are:

1) the first request from delphi app to php web app is the
authenication. In which user sends username + password to the php app.
If authenication is valid, a session is started and the sid is
returned to the client. All subsequent requests from delphi app to
php web app will have this sid as one of the arguments in the POST
form request (this is one of the function in the INDY component for
delphi). Even the sid is passed to the subsequent pages, the session
global array is still undefined. However if I open up a web browser
and create my own string request to the login page then the next page,
the global array would be defined (using var_dump + echo to see the
array) what is the problem?

2) does the above problem has anything to do with the http referer
field?

3) this problem that I am having has been asked before on google
group, but somehow the person who asked it didnt' put down the
solution for it. (this only involves the web only) when I login on a
page and return with a session id, then I log out.. the user is
redirected to the login page again. However if the user login again
(with a different login account), he would be presented with the same
session ID as before. a different sesson id is presented only if the
user restart the browser. why is that happening?

View Replies !
Copy Command Available In Windows?
Is the copy command available for use on a windows system. I have tried to run a script using it (taken directly out of a PHP manual) and am receiving a "parse error".

View Replies !
[windows] PHP.GTK And Popuped Command Line
i compile php.gtk file with roadsend php compiler. Is here possiblity to
have windows program without starting command line window?

View Replies !
Running PHP Scripts From The Command Line Under Windows
I was wondering if anyone has ever tried running PHP scripts from the DOS command prompt. Any insight would be appreciated.

View Replies !
Running A Windows Command Line From A Web Page
I have a web page on an intranet, i need to run a command in the local windows run from the webpage. for example when you press a button button on a webpage it has the same effect as running cmd from the run prompt on the local machine. Anyone know how to do this?

View Replies !
UPDATE Command Is Not Working On MySQL, Windows 2000 Server
Hi all,

I encountered mysterious problem with MySQL and PHP.

UPDATE command is not working on MySQL configured on Apache 2 with Windows 2000 Server.

It pulled my hairs for atleast 5 hours.

MySQL says Affected rows: 0 (Query took ~ sec) always?

Now, I've decided to move all PHP files and db to remote server.

Can anyone suggest possible reasons for above errors?

View Replies !
Sending Command (Ctrl Ctrl G) To A Program
Im wondering how to send Ctrl Ctrl G to a program. Ive got an example below how I connect to it to get stats from it. It works fine, just dont know how to send a command to it :/ Code:

View Replies !
System(); Command Not Working On Remote System. Windows.
My server is a windows machine, on the same domain as python(also a windows machine). Apache is running as a service as an administrator. This is a test only environment to whom it may concern(I hate people telling me how insecure my system is) I'm just trying to run:

$last_line = exec('dir pythonc$', $retval, $g);
print_r($retval);
echo '<br>'.$g.'<br>';
echo '$last_line= '.$last_line.'<br>';
Which outputs:

Array ( )
1
$last_line=

The command from the command line works fine. And apache can access directories that only administrators can access on the local machine.

View Replies !
Method Name Exists, Property Value Exists, Calling Method Fails
I have a class object I am calling in another class:

class Stuff {
var $myObj;
function Stuff($myObj) {
$this->myObj = $myObj;
}
function doStuff() {
print_r(get_class_methods($this->myObj)); print_r("<P>");
print_r($this->myObj->name . "<P>");
print_r($this->myObj->getName() . "<P>");
}
}

The first "print_r" works just fine and shows a "getName" method in
the array of methods for object $this->myObj. The second "print_r"
works just fine and shows the property value that was set in a prior
$whateverObjName->setName('Whatever'); the value comes up as
"Whatever". BUT the third print_r throws a nasty error "Member
function called on a non-object". What happened? How did it turn from
being a legitimate object to a NON-object in one line? Could someone
with some class experience point me in the right direction as far as
using "getter" functions of one object inside another object function?

View Replies !
Tracert :: Passing Command To Command Prompt Via Exec
I want to execute a "tracert" command in the command prompt via php (using windows)

I've managed to use passthru() to open the command prompt (but it doesn't allow me to use it) and when I close it, it outputs the command prompt output in the browser.

I don't mind whether the result is passed back to the browser to stays in the command prompt window (but that would use exec() I would think).

So how can I tell the command prompt that launches to execute the line

tracert 192.190.201.273

So far my experimental code is:

<?php
passthru("c:windowssystem32cmd.exe");
?>

EDIT: my backslashes have been stripped from the path, but you know what I mean!

View Replies !
How To Use "if Exists" - INSERT INTO IF EXISTS TMyTable ???
Google can't find me a good example of how to use the "if exists"
syntax in MySql. Is it right that to use it this way:

INSERT INTO IF EXISTS tMyTable VALUES("xxlk", "lkjlkjlkjljk")


I want to insert into a table but only if the table exists.

How does one, in general, from PHP, test for the existence of a table,
without getting an error message?

View Replies !
How To Call *.exe Program From Php Program
I have a php program, and from that program I wanna call C program that counts number of visitors on my page.

This is a piece of my program:

View Replies !
Is It Possible To Authenticate Users Running Apache On MacOS X (with PHP 4) And An Active Directory On Windows 2000 Or Windows XP?
From a PHP webpage, is it possible to authenticate users running Apache on MacOS X (with PHP 4) and an active directory on Windows 2000 or Windows XP?

View Replies !
Two Sessions: Session A By A Program Destroys Session B By A Program
I have two separate programs that I want to use together on a website
Program A starts first and calls session_start(). Program B is started by the user clicking on a link and it also calls session_start(). The session started by program B blows away the session started by program...

View Replies !
Sessions? External Program / External Program
I am trying ac ouple of days now to learn some things on SESSIONS,but I think I am not getting it very clearly. I have a PHP page tha contains a form.

Users enter data in the form, which are then written in a file (the file is created at the time a user enters some data) The file is then given as an input to an external program The external program runs and gives some results which are then stored in another file (that is created when the external program finishes) What I want to do is to somehow create these files and, when the user exits from the browser, then both files that refer to this user, will be deleted. Code:

View Replies !
NOW() Exists?
My scripts I have use this function for time ver frequently NOW() I cannot locate the code for this function and searching for it didnt return results, is this a native php function already?

View Replies !
Value Exists In SQL DB
I have this code that someone had made for me to add money into an account in my DB. Now I have found that it still adds the money if the account number does not exist in the database. I need to check if the account number exists in the DB and if so add the money if not return an error, I know how I would go about this in VB, but I'm not quite sure about the PHP. Here is my code:

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$add_balanceSQL = sprintf("UPDATE account_info SET balance = balance + %s WHERE acc_no=%s",
GetSQLValueString($_POST['NewMoney'], "text"),
GetSQLValueString($_POST['AccountNumber'], "text"));

mysql_select_db($database_billingserver, $billingserver);
$Result1 = mysql_query($add_balanceSQL, $billingserver) or die(mysql_error());
}

View Replies !
Testing If A Value Exists.
Im trying to create a function that tests if a 'Username' exists in a
particular table. If the value is found then the code generates 'Username1'
as the username, and check if that username exists. If it does, it
continues onto generating 'Username2' and so on.

<?
//testing with username andrew
$name = "andrew";

mysql_pconnect("server", "username", "pass");
mysql_select_db("db");
$result = mysql_query("SELECT Username FROM users WHERE Username =
'$name'");
$num_rows = mysql_num_rows($result);

if ($num_rows > 0):
$count = 1;
While ($num_rows > 0):
//$username = $username.$count;
$result = mysql_query("SELECT Username FROM users WHERE Username =
'$name'");
$num_rows = mysql_num_rows($result);
print($username.$count);
$count = $count + 1;
endwhile;

//----
else:
print("ok");

endif;

?>

View Replies !
Checking A Url Exists
I've looked on this newsgroup on google and on php.net, but I can find
a work function which will allow me to check if a url exists?

View Replies !
How To Know If A Picture Exists Or Not
im trying to get custom pictures on my website based on how the user was directed there. i.e.  if he clicked a link that says www.mysite.com/index.php?key=Gears%20Of%20War i use key to find "Gears of War.jpg" and display it on the page.  Alot of the links that visitors may click will not have a picture designated for them, so i want a default picture to show when "Gears of War.jpg" does not exist. im assuming i need an if statement of some sort.  How exactly would i go about doing this?

View Replies !
Check To See If Row Exists
i need to know how to check to see if an id exists in a table. if the id does not exist then display "some text" else continue with script. my table is called "orders" and i just want to check if the row "id" exists

View Replies !
Check If Value Exists
I have a form with stuff like name, id etc
when it's posted i want to check if a name already exists with php.
If it doesn't already exist then it's ok and it's saved.
if it exists then i want to ask for confirmation from the user like "do you still want to send this information".

It would be nice if i can have this confirmation with a javascript box.
how would i do this, i mean how do i pass data from the form page then to the check page then to the javasript box and then to the code that saves it?

View Replies !
Image Exists Or Not
i had the link: www.foobar.com/blabla.gif, is there any way to check if that is a real image because i dont want any of these boxes showing with the red cross in (ie. when an image doesnt exist).

View Replies !
The Function Exists
I downloaded from PHPclasses.com a class which converts charset. This is the class.

However, whenever I try to call the ConvertCharset::Convert function I get
This error "Call to undefined function: makeconverttable()".
I checked it and this function exists!

What can I do?

View Replies !
If String Exists
What would you use too ask if one string exists in another string?

View Replies !
If Install.php Exists
My script has an install.php file which if it exists, I want it to redirect to the install.php file. I entered this code in index.php:
//----------------------------
// Checking If Install File Exists!
//----------------------------
if(is_dir('./install.php') and $_SERVER['HTTP_HOST'] != 'localhost')
{
header("Location: ./install.php");
die();
}
//----------------------------
// Finished Checking
//----------------------------
But it didn't work, it just views index.php naturally, even if install.php exists, what I'm I doing wrong?

View Replies !
FTP &gt; File Exists?
I am downloading the latest file from an FTP server.

Fortunately the files are named with the date:

20051107_blah.csv (Created every working week day.

I have some simple code which connects to the server, moves to the right directory, then creates the filename from the current date. It first tries 'today', then creates the filename for the previous day, etc. within a loop limiting it to a week. When a file has been successfully copied it then continues as desired.

The problem is that my code outputs errors, visible to the user, and naturally I don't want them to see.

Is there a way to see if a file exists without getting these visible errors?

View Replies !
If Cookie Exists
I know I know, this question is asked all over the internet but despite reading so much about it I just can't get it to work.

SET cookie:
$value = 'value'

setcookie("TestCookie", $value);
setcookie("TestCookie", $value, time()+3600); /* expire in 1 hour */

CHECK cookie:
if(isset($HTTP_cookie_VARS['TestCookie'])){;
$cookievalue = $HTTP_cookie_VARS['TestCookie'];
}else{
$cookievalue = no_cookie;
}
echo "$cookievalue";

When I echo $cookievalue I get no_cookie. I can't find out what I am doing wrong. I have checked in firefox and the cookie exists.

View Replies !
Array Exists?
How do I check if an array already exists?

View Replies !
Check If Name Exists In A Row
i'm making a small voting system where each member only can vote once.. I've never done this before, but i thought i could do this by inserting the members name in the votes row like ths: member1, member2, member3.

But then I need a way to check if the members name exists in that row..

View Replies !
IF EXISTS - Error
I am trying to run the following query:

IF EXISTS(SELECT * FROM `md` WHERE `rn` = 'DD') UPDATE `md` SET `rn`='CC' ELSE INSERT `md` SET `rn`='BB';

#1064 - You have an error in your SQL syntax;

View Replies !
Userfile Exists
I have a script working for uploading a photo. I have 2 choices on the form, upload a photo or a checkbox for no photo. I want to to do a check so if they checked no photo as well as picked a file to upload, it reports back that they need to fix it.

$userfile = $_FILES['userfile']['name'];

View Replies !
How To Check If File Exists
Have a look in a folder, check if there is a file and if there is display one thing, if not display something else. example:

$result=mysql_query("select * from my_table");

while($row=mysql_fetch_object($result))
{
if(fodler/$row->name.txt exists)
{ display this}
else { display thus }
}

View Replies !
Check To See If Image Exists
I've tried three different methods of checking whether an image on a server (sometimes my own, sometimes somebody else's) exists, and I'm not getting consistent results.

Method 1:
if (@fclose(@fopen("$burl", "r")))

Method 2:
if (file_exists($$burl))

Method 3:
if ($img = @GetImageSize("$burl"))

where $burl is an absolute URL to an image.

Methods 1 and 3 seem to return the same result, but Method 2 (as per the PHP Manual) always seems to return a "not found".

However, the strange thing is that all three methods sometimes return a "not found", even when the image does exist. For example, here's such a banner:

http://www.is1.example.com/cgd.aspx?BID=18457&AfID=100845&AdID=2941

Is this because this banner is actually returned by some code on the the hosting server, and if so, is there any way around this (other than trying to copy the banner to my own server - although in this particular case, I can't do that either)?

(The reason I need it is that I have about 280 banners in rotation across several of my websites, and I have written a program that will check them all, switching them off or on as required, and emailing the results to me. If I can't find a consistent and accurate method of finding whether the image is currently working or not, I may have to go back to checking them all manually.)

View Replies !
Help With Syntax - If Domain Name Exists
Can anyone tell me what the proper syntax is
for checking a particular domain from a web form? For instance, I am
looking for an if statement that accomplishes this:

if ($domain=*.mydomain.com)

For some reason, can't get the proper syntax so that sciprt will take.
Thoughts?

View Replies !
HOW TO: Check If A URL Exists Or Not - ERROR 404 ?
My php passes through some links. But I want to redirect if the URL does not
exist.
How best to check if a URL is there or not?

View Replies !
Fopen - When I Know The File Exists?
when I know the file exists?

fopen("http://www.devshed.com/devshednews.rdf","r") - No such file or directory

I am obviously doing something stupid - but do not know what? the fopen command is actually -$fd = fopen($cachefile, "r"); any pointers?...anyone?

View Replies !
Determining If A File Exists
How can I check to see if a file exists?

View Replies !
How Do I Test To See If A Variable Exists?
I've been having a problem that is drving me crazy. Let's say that I have the following code in a file that is included into the main file: PHP Code:

View Replies !
How To... Validate Some External .jpg Exists By Url?
.... validate some external .jpg exists by url?

func. file_exists(http://url_to_navigate.jpg), doesn't work, and I need
something like this.

------------------------------------
if(--validate http://something.jpg exists--){

//show picture

}else{

//show default picture

}
------------------------------------

View Replies !
Detect If A File Exists
How can I do a code that would ask PHP to detect if a file exists, and if it doesn't?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved