Jump to content

Archived

This topic is now archived and is closed to further replies.

flamerail

How to check the value of $_GET and see if its = to something?

Recommended Posts

How can I go about this,
edit.php?action=rename&filename=test.txt

How can i determin with $_GET that action is set to rename...
Thanks!

Share this post


Link to post
Share on other sites
[code]$doit = $_GET['action'];
if ($doit == "rename") {
    echo "Rename ....";
    ... more code ...
}
[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=365407:date=Apr 16 2006, 06:35 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Apr 16 2006, 06:35 PM) [snapback]365407[/snapback][/div][div class=\'quotemain\'][!--quotec--]
[code]$doit = $_GET['action'];
if ($doit == "rename") {
    echo "Rename ....";
    ... more code ...
}
[/code]
[/quote]

I got it to work but im having problems with the permissions...
Warning: rename(,2314.txt) [function.rename]: Permission denied in C:\website\flamerail\edit\rename.php on line 15
Any ideas?

[code]<?php
switch ($_GET['action']) {
case rname;
print '<form action="?action=rname&filename="'.$_GET['filename'].'" method="post">
rename to<input name="rnamed" type="text" /> <input type="submit" name="Submit" value="Submit" /></form>';
if ($_GET['action'] == "rname"){
if (isset($rnamed)) {
$original = $_GET['filename'];
rename($original, $rnamed);
} else {
print "No rename specified!";
}
} else {
print "action rname not true";
}
break;
}
?>[/code]

Share this post


Link to post
Share on other sites
it means that the file does not allow the required permissions to modify (ie, rename) the file. take a look at [a href=\"http://www.php.net/chmod\" target=\"_blank\"]http://www.php.net/chmod[/a] for more on permissions

Share this post


Link to post
Share on other sites
[!--quoteo(post=365489:date=Apr 17 2006, 06:39 AM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Apr 17 2006, 06:39 AM) [snapback]365489[/snapback][/div][div class=\'quotemain\'][!--quotec--]
it means that the file does not allow the required permissions to modify (ie, rename) the file. take a look at [a href=\"http://www.php.net/chmod\" target=\"_blank\"]http://www.php.net/chmod[/a] for more on permissions
[/quote]

The server is windows... it dosnt support chmod. Would I need to copy the file with a new name then unlink the old.... :S

Share this post


Link to post
Share on other sites
[!--quoteo(post=365628:date=Apr 17 2006, 02:54 PM:name=flamerail)--][div class=\'quotetop\']QUOTE(flamerail @ Apr 17 2006, 02:54 PM) [snapback]365628[/snapback][/div][div class=\'quotemain\'][!--quotec--]
The server is windows... it dosnt support chmod. Would I need to copy the file with a new name then unlink the old.... :S
[/quote]

No ideas?

Share this post


Link to post
Share on other sites
probably a stupid blank guess here, but is it possible, that you are trying to get the file to access your root directory, and the file is in a sub directory if so you will probably have to add some more commands, to get it to find the sub directory?? just a guess.

Share this post


Link to post
Share on other sites
[!--quoteo(post=365844:date=Apr 17 2006, 10:32 PM:name=businessman332211)--][div class=\'quotetop\']QUOTE(businessman332211 @ Apr 17 2006, 10:32 PM) [snapback]365844[/snapback][/div][div class=\'quotemain\'][!--quotec--]
probably a stupid blank guess here, but is it possible, that you are trying to get the file to access your root directory, and the file is in a sub directory if so you will probably have to add some more commands, to get it to find the sub directory?? just a guess.
[/quote]

There both in a subdirectory... edit.php is in the same dir as the file im trying to rename.

Share this post


Link to post
Share on other sites

×

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.