Jump to content

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


flamerail

Recommended Posts

[!--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]
Link to comment
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
Link to comment
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?
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.