Accessing An External Programm

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

You would have to parse the argument by yourself, see http://msdn.microsoft.com/library/defau ... mbstok.asp e.g.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

Ok So We Can This Trick To Use Comma As Separator

The Programm Will Scan Only That comma Separated Argument And Treat It as 1 Argument And Then It Will Explod It By comma To Separate Arguments
User avatar
ok
Forum Contributor
Posts: 393
Joined: Wed May 31, 2006 9:20 am
Location: The Holy Land

Post by ok »

neel_basu wrote:Ok So We Can This Trick To Use Comma As Separator

The Programm Will Scan Only That comma Separated Argument And Treat It as 1 Argument And Then It Will Explod It By comma To Separate Arguments
No It but you!
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

Can I Change The Variable Names Of argc and argv
with My Own Variable Names ??
User avatar
ok
Forum Contributor
Posts: 393
Joined: Wed May 31, 2006 9:20 am
Location: The Holy Land

Post by ok »

Yes
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

I Wanna Use php To Interact With That C Program
That Programm Doesn't Have Any Interaction With File System
Can Hackers Make Any Damage To It By Passing A Bad Value As Argument To That Program Through Script Kiddies To Make That Programm Injurious To The Health Of http Server??
If yes Then Would You Please Tell Me About That Bad Values ??
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

really depends on what your actual c code does (or does not)
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

If Its The C Code
============

Code: Select all

#include <stdio.h> 
#include <stdlib.h> 

int main(int argc,char *argv[]) 
{ 
        if ( argc > 1 ) { 
                long x = strtol(argv[1], NULL, 10); 
	        printf("%s",argv[1]);
                printf("->%ld", x*5); 
        } 
        return 0; 
}
Is There Any Risk ??
User avatar
ok
Forum Contributor
Posts: 393
Joined: Wed May 31, 2006 9:20 am
Location: The Holy Land

Post by ok »

I don't see that this program can damage the server. But, why you don't use PHP for this purpose?

intval()!
Last edited by ok on Thu Dec 07, 2006 7:09 am, edited 1 time in total.
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

I Wanna Create My Own Encryption Decryption Module

So If The Encryption Decryption Function Is Written On php
It Would Be Easy To The Hackers

Thats Why I Am Using An External program
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

I Have Another Question Also
Would This Code Run In Linux or Free BSD Servers as Well As Windows Server ??

Code: Select all

$output =  shell_exe('mult.exe'); 
print $output;
If I Upload The exe File In That Server In The Same Drectory Where My php Script Is ??
User avatar
ok
Forum Contributor
Posts: 393
Joined: Wed May 31, 2006 9:20 am
Location: The Holy Land

Post by ok »

No. Linux can't run .exe files (you can use wine).
User avatar
neel_basu
Forum Contributor
Posts: 454
Joined: Wed Dec 06, 2006 9:33 am
Location: Picnic Garden, Kolkata, India

Post by neel_basu »

So How Can I Create Binary Program For Linux By C And What Would Be The Exetension Of That File ??
User avatar
ok
Forum Contributor
Posts: 393
Joined: Wed May 31, 2006 9:20 am
Location: The Holy Land

Post by ok »

You just need to compile it under linux (using gcc or different compiler).

The extension would be (I think...) .out or .bin
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

neel_basu wrote:I Wanna Create My Own Encryption Decryption Module

So If The Encryption Decryption Function Is Written On php
It Would Be Easy To The Hackers
eh... why?
And please, don't write an "Own Encryption Decryption Module". It's very,very unlikely you come up with a good strong one just like that.
Better take a look at http://de2.php.net/mcrypt
Post Reply