Jump to content


Photo

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


  • Please log in to reply
8 replies to this topic

#1 flamerail

flamerail
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 16 April 2006 - 10:29 PM

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!

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 16 April 2006 - 10:35 PM

$doit = $_GET['action'];
if ($doit == "rename") {
    echo "Rename ....";
    ... more code ...
}

Legend has it that reading the manual never killed anyone.
My site

#3 flamerail

flamerail
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 17 April 2006 - 02:34 AM

[!--quoteo(post=365407:date=Apr 16 2006, 06:35 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Apr 16 2006, 06:35 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
$doit = $_GET['action'];
if ($doit == "rename") {
    echo "Rename ....";
    ... more 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?

<?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;
}
?>


#4 redbullmarky

redbullmarky
  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 17 April 2006 - 10:39 AM

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
"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

#5 flamerail

flamerail
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 17 April 2006 - 06:54 PM

[!--quoteo(post=365489:date=Apr 17 2006, 06:39 AM:name=redbullmarky)--][div class=\'quotetop\']QUOTE(redbullmarky @ Apr 17 2006, 06:39 AM) View Post[/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

#6 flamerail

flamerail
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 18 April 2006 - 02:26 AM

[!--quoteo(post=365628:date=Apr 17 2006, 02:54 PM:name=flamerail)--][div class=\'quotetop\']QUOTE(flamerail @ Apr 17 2006, 02:54 PM) View Post[/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?

#7 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 18 April 2006 - 02:32 AM

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.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#8 flamerail

flamerail
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 20 April 2006 - 09:13 PM

[!--quoteo(post=365844:date=Apr 17 2006, 10:32 PM:name=businessman332211)--][div class=\'quotetop\']QUOTE(businessman332211 @ Apr 17 2006, 10:32 PM) View Post[/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.

#9 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 20 April 2006 - 09:40 PM

you may have to rebuild that section for it to work right.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users