Find programmers and grapic design experts at ScriptLance.com
<? DEW-CODE.COM  
Dew-Code
Welcome, Guest
Please Login or Register.    Lost Password?
update.php not working (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 3
TOPIC: update.php not working
#534
fattymattybrewing (User)
Support Your Local Brewer
Expert Boarder
Posts: 105
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Fatty Matty Brewing Location: Southwestern Wisconsin Birthdate: 1974-11-05
update.php not working 2 Months, 2 Weeks ago Karma: 3  
OK so I had my host transfer my website files to a new webserver and apparently the "EDIT" a site function is not working anymore from the front end.

I can perform it great on the admin side but is not working from the front end.


I have attached the include/update.php file to this post and below are the URLs that I am given when clicking on "EDIT" (a site) from within a child category of link sites.

When I click on "EDIT" next to a website in a category I get this page: http://www.fattymattybrewing.com/directory/owner.html?ID=1689

When I click on "UPDATE YOUR WEBSITE." on the next page I get this URL: http://www.fattymattybrewing.com/directory/owner.html?ID=1689

but when I add my username and pass and LOGIN I get this URL: http://www.fattymattybrewing.com/directory?show=update&ID=1689

and when I click on the Password Hint Link I get this URL: http://www.fattymattybrewing.com/directory?show=lost&ID=1689

I can see the differences in the URLs but not sure what the fix is? any ideas?
File Attachment:
File Name: update.zip
File Size: 2528
 
Report to moderator   Logged Logged  
 
Last Edit: 2008/09/17 11:08 By fattymattybrewing.
 
Lifes Too Short To Drink Crappy Beers
fattymattybrewing.com
  The administrator has disabled public write access.
#538
Dewed (User)
Administrator
Posts: 229
graph
User Online Now Click here to see the profile of this user
Dew-Code.com
Re:update.php not working 2 Months, 2 Weeks ago Karma: 7  
GAH ! ! ! !

I think the problem is in the directory file, the version you use doesn't have a "freindly" URL for the password lost page (it does in the latest version)

around lines 71 - 78 (maybe different line numbers, I'm looking at the 2.1 version) ..
locate this block of code..

Code:

if ($url_array[1] == "review_add.html"){$show="review_add";} if (is_numeric (ereg_replace (".html", '', $url_array[1]))){ $PID = (ereg_replace (".html", '', $url_array[1])); } } else {$PID ="";}
below it add..
Code:

if ($_GET['show'] == 'lost'){ $show = 'lost'; if (is_numeric($_GET['ID'])){ $ID = $_GET['ID']; } }
Sounds like you now run on PHP with register global off, and despite my efforts, I apparently missed assigning it when show=lost
 
Report to moderator   Logged Logged  
 
Nothing to it but to Dew it !
Dew-Code.com
  The administrator has disabled public write access.
#539
fattymattybrewing (User)
Support Your Local Brewer
Expert Boarder
Posts: 105
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Fatty Matty Brewing Location: Southwestern Wisconsin Birthdate: 1974-11-05
Re:update.php not working 2 Months, 2 Weeks ago Karma: 3  
ok, let me try that out, will reply with the results, thanks for the help with the PHP with register global off...

what is that anyway?
 
Report to moderator   Logged Logged  
 
Lifes Too Short To Drink Crappy Beers
fattymattybrewing.com
  The administrator has disabled public write access.
#540
fattymattybrewing (User)
Support Your Local Brewer
Expert Boarder
Posts: 105
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Fatty Matty Brewing Location: Southwestern Wisconsin Birthdate: 1974-11-05
Re:update.php not working 2 Months, 2 Weeks ago Karma: 3  
ok, I tried that and what happens is I get to a URL like this: http://www.fattymattybrewing.com/directory?PHPSESSID=&show=lost&ID=170

and the page says "Enter Email Address: " with a place for me to fill in the email address and when I submit it, it just goes to the same page with the "Enter Email Address: ". and doesn't email the password hint.

Also, this still does not work with the new code:

When I click on "EDIT" next to a website in a category I get this page: http://www.fattymattybrewing.com/directory/owner.html?ID=1689

When I click on "UPDATE YOUR WEBSITE." on the next page I get this URL: http://www.fattymattybrewing.com/directory/owner.html?ID=1689

what happens is for the EDIT->then username & password is it just takes me back to the directory page.

thanks for your help...I think what I may do is remove the edit feature to make this bug go away? Where can I find the EDIT (your website) PHP code to comment it out?

yea thanks again!
 
Report to moderator   Logged Logged  
 
Lifes Too Short To Drink Crappy Beers
fattymattybrewing.com
  The administrator has disabled public write access.
#542
Dewed (User)
Administrator
Posts: 229
graph
User Online Now Click here to see the profile of this user
Dew-Code.com
Re:update.php not working 2 Months, 2 Weeks ago Karma: 7  
ok, I misunderstood the problem.. well rather I didnt get the whole picture
remove what I suggested and replace it with this ..
Code:

if ($_GET['show'] == 'lost'){ $show = 'lost';} if ($_GET['show'] == 'update'){$show = 'update';} if (!empty($_POST['Email'])){$Email = $_POST['Email'];}
If you still want to remove the edit link.. its in the ginourmous /include/functions.php file around lines 703 - 706 it can be removed by doing a block comment.. instead of adding double slashes in front of every line, you can comment out whole blocks of code with a forward slash followed by an asterick at teh top , and an asterisk followed a forward slash at the bottom This is the code block to comment out .. I'd put in the comment characters but that breaks the forum's formatting .. so above this block add forward slash asterisk and at the bottom add asterisk forward slash
Code:

$htmlsrc .= "&nbsp;&nbsp;<a class=\"ownerLink\" "; $htmlsrc .= "href=\"./directory/owner.html?"; if ($usesession =="yes"){$htmlsrc .= "". session_name()."=".session_id() ."&";} $htmlsrc .= "ID=". $sites_array["site_id"] . "\">" . $functions_11 . "</a>";
stupid forum. messing up my nicely formatted post And finally to answer your question.. whats register globals.. Well, when PHP was young (like a couple of years ago) it was really handy to have variables automatically populated for you. So on a page that had a URL like /somescript.php?value=yippy the script automatically had a variable named $value with the contents yippy But, it turns out that can be quite a security issue, since I might be able to guess at some of the internal variable names in your script and overwrite their values with something else, or if I were evil, I could sneak in some nasty php code and get it executed by your server somescript.php?value=whocares&debug=1 somescript.php?value=(eval(print_r($_SERVER))) // and no to potential hackers.. that wont actually work.. thank God. but if it did, when your script tries to do something with the automatically created variable $value, since it contains an eval function call, the code within the parens would be executed as PHP code... I think you can see where that can get really scary. So, initially they shipped PHP with register globals on, and strongly suggested you disable it. Now with PHP5 its off by default (but can still be enabled) although even a stubborn caveman like me thinks its probably best to adapt the code to the newer, more secure enviroment. The end result is, if you want a variable, you have to fetch it from the $_GET or $_POST array. In this example since the value was passed via the URL, you would use the $_GET array. Use $_POST if it were submitted by a form and of course you still need to scrutinize & sanitize what was passed .. $value = $_GET['value']; // that works, but doesn't keep badness out.. if value should be a number.. best to do something like if (is_numeric($_GET['value'])){ $value=$_GET['value'];} else {unset($_GET['value']);} // it wasn't a number so, erase it To make sure the value variable only contains alphanumeric characters if (!empty($_GET['value'])){ $value = ereg_replace("[^[:alpha:]]", '', $_GET['value']); } I'm still learning about potential security issues and how to address them, and the two examples above are fairly simple.. but a good start I think.
 
Report to moderator   Logged Logged  
 
Last Edit: 2008/09/17 19:34 By Dewed.
 
Nothing to it but to Dew it !
Dew-Code.com
  The administrator has disabled public write access.
#549
fattymattybrewing (User)
Support Your Local Brewer
Expert Boarder
Posts: 105
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Fatty Matty Brewing Location: Southwestern Wisconsin Birthdate: 1974-11-05
Re:update.php not working 2 Months, 2 Weeks ago Karma: 3  
cool, thanks for the register global education, I really do appreciate you taking the time to explain it. BTW - I don't think you used enough emoticons. No but seriously I will try the new code in replace of the first set of code you gave me and let you know how it works. Thanks again for taking the time to help.
 
Report to moderator   Logged Logged  
 
Lifes Too Short To Drink Crappy Beers
fattymattybrewing.com
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Newsflash

Sign up for PayPal and start accepting credit card payments instantly.
Copyright Dew-Code 2008