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




How To Execute A Link In PHP ?


I have the following piece of code:

If TRUE {do this;} else {go to this page;}

In the else clause, is there a function in PHP that I can pass in an URL and make it automatically go to that particular page ? The only PHP function I know for this purpose is the "header" function but it does not always work.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Click Link To Execute Code
Can code be inserted into a database via clicking on a link?

Cant Execute Commands With Execute()
I am trying to do the following:

exec("cat filename.txt | /usr/sbin/sendmail -v chandakme@yahoo.com");

It is supposed to mail the contents of the filename.txt to the email adress. If i run this command from the shell , contents of the file are emailed. but if run it from php using exec, i get an email but without any contents . i have already done chmod 777 filename.txt

For some weird reasons, i cant use mail() function of php...so i have to run this command somehow.

Dynamic Download Link - Not Direct File Link
I'm posting a podcast feed that makes reference to audio files for download. Instead of linking to the files directly (e.g. www.mywebsite.com/podcast.mp3), I want to link to the file as get variables so that I can track number of listeners (e.g. www.mywebsite.com/?audio=podcast.mp3). Where would I look to get something like this to work? How do I start sending audio data to the user using a link like this?

Determine If User Came From Inner Link Or An Outside Link
any php method or function to determine if a user came from within the website or from an outside website. I have a page that I want to display in different manners depends on how did the user arrive at my site.

I know about the HTTP_REFERER function. but don't really know how to use it. I know this is the syntax:

<?php
echo $_SERVER['HTTP_REFERER'];
?>

but when i entered the code in the php page. for instance test.php, there is nothing coming up. So my questions:

1. is there any other method?
2. could any of you maybe specify a bit more details about this function and how to use it.

Execute Exe In Php
Im trying to execute a visual basic program that i have compiled and i want to execute it in php. (The vb program takes data out of a mysql database and writes it into an excel spreadsheet).

How To Execute PHP
I know how I can get a PHP script to execute by having a
form with a post method in my regular HTML file. So far so good.

Now I just want to run a PHP scrip from an HTML file to insert a text
file, but how do I execute the PHP without the form + post?

(The text file is a club member list and I want the web page to always
display the updated list)

System Execute In Php
The same set of command in linux prompts and if call by php program, it does not work. I do not know why. The set of command is already chmod +x and ./what what ,it works.

Execute Php File
I'm working on a search engine. The idea is simple user types a keyword in the text box and then I my program searches for all files (.html, .htm, .txt, php) that have a match.

But I nedd to search the output of php file not the code.

Execute Ph Script
I need to execute a php script in my shell so :

touch test.php
chmod +x test.php
edited the file, inserted the following lines :

#! /usr/bin/php -q
$a = 0;
echo $a;

../test.php

Gives me the following output :

$a = 0;
echo $a;

PHP Slow To Execute
I have some PHP pages at.. which is exhibiting
some strange slowness. It is hosted by secureserver.net (bad?).

When I time how long it takes to load the main web page from the
server
it averages 7 seconds, but often goes to 15.

When I store the main page on my hard drive, the load time is 1
second.

I've tried removing PHP code that might slow things down
but that only brings the load time down to 5.5 seconds best case.

I have other PHP pages on the same server that seem to execute
faster. The key difference between the slow main page and the faster
pages is the faster pages do not use "include" to execute code in
other
PHP files.

However with out "include" and the modularity it affords, my PHP code
would be harder to maintain. What to do?

Execute PHP In A CSS File?
On Apache with PHP is there any way to execute PHP code inside of a CSS file? This is assuming AddType application/x-httpd-php does not list CSS as an extension. I would like to serve my stylesheets as CSS but also dynamically construct the CSS for various browsers (and ultimately hope to keep the number of served stylesheets to one).

Could Not Execute Query
I have a db that I am trying to poulate using an online form but every time I press the submit button it givesm me this error:

Could not execute query : INSERT INTO register (id, name, phone, email, interest, other, type, comments, update) VALUES ('', 'Tom', '0000000', 'abc@abc.com.au', 'Music Performer', 'other things', 'painting', 'none really', 'Y').You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'update) VALUES ('', 'Tom', '0000000', 'abc@abc.com.au', 'Music

I am not sure what the problem is.  Can someone have a look and tell me what I need to fix to make this work. Code:

Execute String
I would like to load a string with PHP code and execute it. Is there a command that will let me do that? Maybe something like
php_exec(). I suppose I could always use some sort of shell_exec("php.exe...") trickery but would prefer something more graceful.

Execute Ssh Command Via Php?
I'm trying to make a web interface for my music server. Basically what it's going to do is list all the music files in a directory. Then when a song is clicked PHP executes a shell command, for example "sudo play /var/www/music/System Of A Down - BYOB.mp3" and my server plays the song. So far I've been trying system() and exec() but it do doesn’t seem to work.

Execute As Root
Is there a way to execute commands as root using sudo? If yes, how to use it, if no, how can I get around.

Execute Another Php File
Is their a way to execute another PHP file from a PHP file? for example, say I want to check if a User's Authority level is equal to 3, by using a If statement, and if the User's Authority level is equal to 3, execute another PHP file which executes a function within the file.

How can I do this? if it is at all possible? (your probably wondering why I want to know how to do this, lets just say PayPal isnt very flexible)

Can Cron Job Execute A Php Page?
how can i write a cron job to execute a php page? (reasking )

and created a txt file
with this in the file
45 10 * * lynx -dump /usr/home/mydomain/www/mydomain.com/crontest.php

named the file work.txt

and installed the crontab by
crontab /usr/home/mydomain/www/work.txt

in my crontest.php file, i have just some commands, such that if i load the page an email is sent to me.

i made the crontest.php file executable
and also put a MAILTO to check for the error

it dumped the whole thing in my email,

how do i make it execute that php page. and send me an email ?

Using System() To Execute Pkzip??
I am trying to use pkzip to compress documents.
I am running a windows PC, so I am trying to execute a DOS command.

I have so far:
<?php
$pkzip="C:/Progra~1/Apache~1/Apache/readwr~1/pkzip.exe";
$pkzipdirectory="C:/Progra~1/Apache~1/Apache/readwr~1/";
$command=$pkzip." ".$pkzipdirectory."myzip.zip"." ".$pkzipdirectory."mydoc.doc";
system($command);
?>
The system() command doestn seem to do anything.
Neither does:
exec($command);
shell_exec($command);

In case I would echo the $command and copy the outputtext to the command prompt; it works fine, but how can I execute it from php?

PHP4 = Compile + Execute ?
I heard that PHP4 compiles and then executes scripts instead of just interpreting them. is it true?

if it's true, then what gain is it to us, really? every time a script is called it is probably compiled anew. i could see benefit in that, if a script is running for a long time (like a daemon on a server or something). but not otherwise.

Time To Execute Script?
I've seen "This page created in 0.04 seconds" on the bottom of some pages, but I'm not sure where to start to create that for my own pages.

Execute A Stored Procedure
Execute a stored Procedure

Execute a stored Procedure in php using an ODBC connection and
return the results

function runStoredProc($sql, $dsn){

$val = array();

$con = odbc_connect($dsn, $SqlUser, $SqlPass);
$rs = odbc_exec($con, $sql);
while ( $row = odbc_fetch_array($rs) ){
array_push($val, $row);
}
odbc_free_result ( $rs );
odbc_close( $con );
return $val;
}

The Result is an array of rows. A stored procedure S_GetUsers that
returns ID's and ......

Execute Javascript File In Php
How can I execute a javascript file(test.js) from within PHP. I'm running
oscommerce and want to insert a menu created in javascript by Sothink
DHTMLMenu.

Execute Php In Html Without Using Post?
I want to display some of the text from php in HTML without using POST
method.
For example: Hello.php
<?php
echo "hello ";
?>

If i want to display Hello in main.html,

Execute Command From Array
I have an array, say something like this (to build a form):

$commands = array(
"Start Date" => "build_date('startdate')",
"End Date" => "build_date('enddate')"
);

Only it will have many more entries. I want to cycle through the array,
and print the first part, but then execute the second part so that it
goes to the function build_date (which returns html code to output).

Right now I am doing it something like this:

echo "<tr><td>Start date</td><td>";
echo build_date('startdate');
echo "</td><td>End date</td><td>";
echo build_date('enddate');
echo "</td></tr>";

Because this is going to have many entries in it, it is getting very
repetitive to do it this way! I am stuck on how to execute that function
(and pass the string) with it already being a string itself.

Execute A Network Command
I'm trying to execute an Network command with PHP exec() function but
i can't.
The PHP script looks like the following:

<?php
...
exec('PTtypeMyapp');
...
?>

When i execute this command in the windows shell i've no problem, but
when i use PHP exec() function it simply don't run. It seems that the
instruction is jumped.
I guess it isn't a PHP problem because when i make:

<?php
...
exec('C:WINDOWSNOTEPAD:EXE');
...
?>

NOTEPAD is correctly opened.

Probably the problem has to do with the way the 'Path' is typed.

How To Execute Two Commands Within 'system'
On PHP4, I want to execute these two system commands:
# cd /home/foo1/foo2
# /usr/local/php/bin/php /home/foo1/foo2/script.php

If I do it via shell, it works ok.

But If I do:
-------
system("cd /home/foo1/foo2/", $retval);
system("/usr/local/php/bin/php /home/foo1/foo2/script.php", $retval);
--------

I get this error message:
-----
Fatal error: main(): Failed opening required '../config/config.php'
(include_path='.:/usr/local/php/lib/php') in /home/foo1/foo2/script.php
on line 2
-----

This error is caused by the fact that the script is not executed in the
right directory.

How To Execute .php Code From C++ Program?
I can launch .html file by ShellExecute to lunch IE for viewing.
However the .php has no effect in the same way. I can read the .php
page through the input on FireFox browser.

How To Execute A Tasks If The Time Is 22:30:45
crontab work every minute

How to execute a tasks if the time is 22:30:45 or 22:31:01

id | time | script
-------------------
4 | 22:31:01 | script0.php
3 | 22:31:00 | script1.php
2 | 22:30:45 | script3.php
1 | 22:30:00 | script2.php

How To Execute Nested PHP Scripts
I've got a PHP script that browse a database and extracts from it parts of HTML code. Some of these parts contain other PHP scripts In my webpage i've got a first PHP script similar to this one: PHP Code:

Query Execute Time
is there a way to have php spit back the amount of time a mysql query took to execute?

Can I Execute PHP From External/different Server?
Hopefully there are some experts out there that can help with this - I've done a bit of searching here but haven't found an answer yet.

The problem is, the site where I'm hosting a set of html files does not support PHP. I have another host which does support PHP. I need to have my html files located on the server which does not support PHP.

Is there some way I can execute my PHP scripts within a regular HTML file? I've seen references to using Javascript for this but no working examples (and none I could make work).

Unfortunately I can't get PHP on the site where I need it without redirecting my domain (among other things). If there is a way to execute the PHP remotely, that would be the preference..

Execute Exe File From Php Script
how can i execute a exe file from a php script or javascript .

Execute Shell Interactive
I ve been trying to make a CLI script in PHP to execute /bin/sh and create a pipe for stdin / stdout / stderr. It should work like this. You start the script, it executes /bin/sh and passes the streams to the process it opened. Moreover I would like it to listen for connections with sockets. I have the whole script half-done, here's the code and explanation: Code:

Execute Two Forms With 1 Button
Execute two forms with 1 button Is it possible ?

Time It Took To Execute Query
Just wondering if there is any sort of function that allows you to see how long it took for the mySQL queries on that page to execute?

Execute The Php File And Get The Content
how to get the content after Executing the php file? i have used 'fread' to get the content but its returns that content with Php code.. Code:

Execute Files On Linux
How to execute files e.g exe on linux with using php code.

Execute On Session Expirey
My website uses sessions for the login functions and then they expire after a while so then it basically logs you out.

How can i get it so when they expire they execute some code, see i want to have an online users list and ill need to execute some mysql code when the session expires or they log-off.

is this possible? if not, are there any alternatives?

Execute PHP Code In Remote Server
Does a way exist of using a similar library for WWW access in Perl known how LWP, and to use it in PHP that allows to execute code of PHP in a remote server?

Execute External Binary File With PHP
I have a problem.I wanna run binery using php, but i cant.
chk this out:

<?php
$com=("gcc -o new new.c");
system($com);
?>

Note:I'm using Fedora-7,Apache2,PHP-5.1.1 and i was logged on as root.
i used exec() function too btu it also fail.

Include, Include_once, Actually Execute The File?
I use jpgraph, which uses a php method to generate png image files of graphs (very handy if you produce graphs), I will be creating quite a number of these files (both php and png) that will have to be updated each year. e.g. graph_attendance_by_year.php produces graph_attendance_by_year.png

I have shell files that consist of tables that call multiple .png image files that were originally created by using the many jpgraph php files. Each year when the data are updated in mysql I will have to run about 50 php files to update the graph images.

QUESTION:
If I created one file, that does nothing other than "include" all my graph files, when I execute it will all the "include"(d) files actually be exectuted, thus creating updated graphs?

Can You Have A Server Execute A Php At Cron Time?
I was wanting to have the server that is hosting my site run a php3 program at a certain time and day. If I was a perl expert, I am sure I could have written it in perl, but since I am not, can php3 be invoked without a webpage?

Incoming Mail Shall Execute Php-script
the task:
Any mail that drops into a specified mailbox shall cause a (php-)script to
immediately react with some action.
Quite a common task, isn't it?

I could use e.g. cron to let a script frequently look for new mail.
But mail drops in only once every few days, so I don't want to execute that
look-for-new-mail-script every 3 minutes. But IF mail drops in, the
reaction should be as quick as possible.

Is there a way to watch the mailbox and run the script when the mb changes?
Or could the mailserver be told to run that script when such mail drops in?

It's a Redhat Linus. Probably running in a more or less "standard"
configuaration (what ever that is...)

I don't know which mailserver is running there, but when I connect via SMTP
the server says:
ESMTP Sendmail 8.12.10/8.11.6; Fri, 30 Jul 2004 15:30:22 +0200

And on connection via POP3 it says:
+OK POP3 v2000.70rh server ready

I don't have root access and cannot access the relevant config files. But I
guess I could convince the admin to set up sth. if I tell him exactly what
I want...

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"));
}

Why I Can Use Exec() And Passthru() To Execute Lynx
i have try using exec("/bin/lynx -source http://URL") or passthru("/bin/lynx -source http://URL") but also not success and i have put the lynx inside the bin folder already but also cannot, why?

Limit To Size Of File That PHP Can Execute?
I haven't been able to find anything regarding file size limits for PHP execution via PHP.net / Google, so I was curious if there was a limit to the size of the file that PHP can execute.

I'm running into an issue w/ my server (Solaris9; iPlanet6; MySQL 3.23.x; PHP 4.2.2) where scripts over a certain size won't execute, or die after a certain point during execution.

Execute Exe File From Php Code Through Browser
step 1.
testcommand.php
----------------------
$cm='p4 dirs //seabu/*'
$handle = popen($cm, 'r');
echo "'$handle' " . gettype($handle) . "
";
$read = fread($handle, 4096);
$p=fopen("c:wwwshowcasekamal.txt","");
fwrite($p,$read);
echo $read;
pclose($handle);

step 2.
i compiled this testcommand.php file with bamcompile and i created exe called testcommand.exe.

step3.
callexefile.php
----------------
exec("c:wwwshowcase estcommand.exe");

then i executed this callexefile.php thorugh browser, but its not calling the testcommand.exe file. how to solve this?

Execute PHP -> Return Output To String
I've got a problem
I want a PHP script to call another PHP script, execute it and return its
OUTPUT (not its content) into a STRING in the first script.

How Do You Execute PHP Commands When A Window Closes
I was wondering how to the act of closing a window cause a PHP command to execute (in this case I want it to go to a database and remove an entry from a field in a table)?


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