| PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >> |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread |
|
|
#1 (permalink) |
|
Registered User
Fresh Surpasser
Joined in Oct 2007
17 posts
Gave thanks: 3
Thanked 0 times
|
Need help fixing my php script!
Please can somebody help me with this problem I'm having with two of my php scripts. I'm not very good at php and used to have a friend that helped me with all this stuff but now I don't have that friend anymore.
Anyway my problem is that my scripts don't work when register globals is turned off and I'm told that having register globals turned on can be a serious security risk. I have no clue how to update these scripts to work. My php knowledge is pretty limited so I'd be needing a seriously patient person to help me with this. I would really appreciate some help as my site is currently all messed up now and it might scare people off as it is. ![]() |
|
|
|
|
|
#2 (permalink) |
|
after g, before i
Resident.
Joined in Jul 2004
Lives in N,BC,CA
8,055 posts
Gave thanks: 48
Thanked 129 times
|
See this post: http://www.surmunity.com/showthread....631#post267631
|
|
|
|
| This user thanks H for this great post! | SharonQ27 (November 10th, 2007) |
|
|
#3 (permalink) |
|
Registered User
Super #1
Joined in Mar 2005
Lives in Washougal, WA
1,306 posts
Gave thanks: 23
Thanked 39 times
|
If you ask nicely, sure one of the PHP gurus could help.
Make sure to use [ CODE ]code here[ /CODE ] when posting any code, without spaces on either side of the word code and /code. |
|
|
|
|
|
#4 (permalink) | |
|
Registered User
Fresh Surpasser
Joined in Oct 2007
17 posts
Gave thanks: 3
Thanked 0 times
|
Quote:
It usually displays downloads with register globals turned on but now it won't work. Anyway here's the important part of the script Code:
$nextID = $ID;
$sql = "SELECT * FROM Downloads WHERE age = '$age'";
if($nextID != "")
{
$sql .= "&& skinID <= '$nextID'";
}
$sql .= "ORDER BY skinID desc LIMIT 8";
$getSkin = mysql_query($sql, $linkID);
// echo "$sql";
while($Downloads = mysql_fetch_array($getSkin))
if ($age == "$age")
{
Thanks from Sharon. |
|
|
|
|
|
|
#5 (permalink) |
|
Surpass Fan
Comfy Contributor
Joined in Feb 2004
Lives in Norfolk, England
Hosted on Pass32
165 posts
Gave thanks: 22
Thanked 18 times
|
Hello Sharon,
I see H has posted some code in the other thread about this and you said you didn't understand it. Basically without register globals, you need to declare (or register) the name of a variable before you use it (see the code in blue). The code in red is what fails when register globals is disabled. So, you need to create lines similar to the blue code for each variable that isn't registered. Code:
$nextID = $ID;
$age = $_GET['age'];
$sql = "SELECT * FROM Downloads WHERE age = '$age'";
if($nextID != "")
{
$sql .= "&& skinID <= '$nextID'";
}
$sql .= "ORDER BY skinID desc LIMIT 8";
$getSkin = mysql_query($sql, $linkID);
// echo "$sql";
while($Downloads = mysql_fetch_array($getSkin))
if ($age == "$age")
{
Jonathan
__________________
Server: Pass32 and dedicated server |
|
|
|
| This user thanks jdcopelin for this great post! | SharonQ27 (November 10th, 2007) |
|
|
#6 (permalink) |
|
Registered User
Fresh Surpasser
Joined in Oct 2007
17 posts
Gave thanks: 3
Thanked 0 times
|
Ok. well that got my downloads to display but now the page number links at the bottom of each page don't work. And I still have no clue how to fix the login script. I don't know why I let my friend convince me to make a php site. It kind of scares me.
|
|
|
|
|
|
#7 (permalink) |
|
Registered User
Fresh Surpasser
Joined in Oct 2007
17 posts
Gave thanks: 3
Thanked 0 times
|
Wow this is so frustrating me. Even though my downloads appear it seems that nothing works now. My page numbers no longer work and my download button doesn't let me download the file anymore. I have no idea why I wanted this site back. I never had this much trouble with php before I don't get why things have to change.
|
|
|
|
|
|
#9 (permalink) |
|
Registered User
Fresh Surpasser
Joined in Oct 2007
17 posts
Gave thanks: 3
Thanked 0 times
|
Sorry for triple posting but I can't find an edit button.
I managed to get my page number links to work but I can't for the life of me figure out why it's not letting me download my files now. I have a small php script that counts how many times a file is downloaded so usually when I click the download button it'll just let me download it and it'll add 1 to whatever number was already listed. Now it's just taking me to the list of files that I have in my folder where I keep all my download files. So I'm wondering if anybody help me with this little problem now. |
|
|
|