icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » PHP, MySQL » Need help fixing my php script!

PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >>

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old November 8th, 2007, 11:24 AM   #1 (permalink)
Registered User
Fresh Surpasser
 
SharonQ27's Avatar
 
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.
SharonQ27 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 8th, 2007, 12:33 PM   #2 (permalink)
H
after g, before i
Resident.
 
H's Avatar
 
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
H is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
This user thanks H for this great post!
SharonQ27 (November 10th, 2007)
Old November 8th, 2007, 1:03 PM   #3 (permalink)
wgm
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.
wgm is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 8th, 2007, 2:52 PM   #4 (permalink)
Registered User
Fresh Surpasser
 
SharonQ27's Avatar
 
Joined in Oct 2007
17 posts
Gave thanks: 3
Thanked 0 times
Quote:
Originally Posted by William View Post
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.
Um.. ok *Gets down on knee's and asks nicely* Could somebody please tell me how I get this script to work with register globals turned off. It's for my downloads script which is here http://simsboutique.net/clothing.php?age=Toddler
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")
       {
The mysql connect stuff is in the header of my page. Just letting you know so you don't think I forgot that part. I'm not sure if that's enough of the script. I really just need to know what parts I replace in this script so it'll work with register globals off. I hope someone can help my sites all broken and it's stressing me a little.

Thanks from Sharon.
SharonQ27 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 8th, 2007, 3:21 PM   #5 (permalink)
Surpass Fan
Comfy Contributor
 
jdcopelin's Avatar
 
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")
       {
Regards
Jonathan
__________________
Server: Pass32 and dedicated server
jdcopelin is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
This user thanks jdcopelin for this great post!
SharonQ27 (November 10th, 2007)
Old November 8th, 2007, 3:44 PM   #6 (permalink)
Registered User
Fresh Surpasser
 
SharonQ27's Avatar
 
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.
SharonQ27 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 8th, 2007, 4:18 PM   #7 (permalink)
Registered User
Fresh Surpasser
 
SharonQ27's Avatar
 
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.
SharonQ27 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 8th, 2007, 5:54 PM   #8 (permalink)
Registered User
Seasoned Poster
 
Joined in May 2007
Hosted on SH103
30 posts
Gave thanks: 1
Thanked 2 times
Sharon, read my private message. I assume you got it.
__________________
SH103
http://www.united-fleet.org
Suikolove is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old November 8th, 2007, 6:03 PM   #9 (permalink)
Registered User
Fresh Surpasser
 
SharonQ27's Avatar
 
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.
SharonQ27 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On