TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-31-2009, 07:02 AM   #1 (permalink)
The Acquainted
 
KingOfTheSouth's Avatar
 
Join Date: Oct 2008
Location: Cincinnati
Posts: 151
Thanks: 14
KingOfTheSouth is on a distinguished road
Default Having trouble!!!

Hey everyone I am having trouble with a page I added a lot of stuff to. I work on this page for about an hour and a half and I thought I had it correct. But I finished I sold a few items on the page and changed the page and then i lost all the money I just made selling the items. But I do not know what the problem is. It is way too big to post here so I will upload it. Please I am a pimp in dis stress lol I need it fixed and I do not know how to to fix it
Attached Files
File Type: php purchase.php (16.4 KB, 126 views)
KingOfTheSouth is offline  
Reply With Quote
Old 01-31-2009, 02:10 PM   #2 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

That's huge! What's broken exactly? What doesn't it do?
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 02-01-2009, 09:31 PM   #3 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Yeah, we can't be expected to get acquainted with, test and debug all that. Give us so more so we can help you.
__________________

Village Idiot is offline  
Reply With Quote
Old 02-02-2009, 01:11 AM   #4 (permalink)
The Acquainted
 
KingOfTheSouth's Avatar
 
Join Date: Oct 2008
Location: Cincinnati
Posts: 151
Thanks: 14
KingOfTheSouth is on a distinguished road
Default

Well is the calls to the database I am pretty sure and what it does when you sell items on the page it takes the items but does not give you the cash.
KingOfTheSouth is offline  
Reply With Quote
Old 02-02-2009, 03:30 AM   #5 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

But what is the exact issue you are facing?
__________________

Village Idiot is offline  
Reply With Quote
Old 02-02-2009, 08:38 PM   #6 (permalink)
The Acquainted
 
KingOfTheSouth's Avatar
 
Join Date: Oct 2008
Location: Cincinnati
Posts: 151
Thanks: 14
KingOfTheSouth is on a distinguished road
Default

I said it in my last post. But I am pretty sure it is within here
PHP Code:
<?
if (($buy) || ($sell))
{
      if ((
maxlength($condoms) == bad) ||
          (
maxlength($meds) == bad) ||
          (
maxlength($glocks) == bad) ||
          (
maxlength($shotguns) == bad) ||
          (
maxlength($uzis) == bad) ||
          (
maxlength($ak47s) == bad) ||
          (
maxlength($crack) == bad) ||
          (
maxlength($dope) == bad) ||
          (
maxlength($lowriders) == bad) ||
          (
maxlength($hummer) == bad) ||
          (
maxlength($jet) == bad) ||
          (
maxlength($plane) == bad))
          {
$error='<font color="#FFCC00">You cannot buy or sell that amount at a time</font>';}
  elseif ((
$condoms) && (eregi_replace("([0-9]+)","",$condoms)) ||
        (
$meds) && (eregi_replace("([0-9]+)","",$meds)) ||
        (
$glocks) && (eregi_replace("([0-9]+)","",$glocks)) || 
        (
$shotguns) && (eregi_replace("([0-9]+)","",$shotguns)) ||
        (
$uzis) && (eregi_replace("([0-9]+)","",$uzis)) ||
        (
$ak47s) && (eregi_replace("([0-9]+)","",$ak47s)) ||
        (
$crack) && (eregi_replace("([0-9]+)","",$crack)) ||
        (
$dope) && (eregi_replace("([0-9]+)","",$dope)) ||
        (
$lowriders) && (eregi_replace("([0-9]+)","",$lowriders)) ||
        (
$hummer) && (eregi_replace("([0-9]+)","",$hummer)) ||
        (
$jet) && (eregi_replace("([0-9]+)","",$jet)) ||
        (
$plane) && (eregi_replace("([0-9]+)","",$plane))) {?><font color="#FFCC00">No item selected</font><br><?}
   else{
       if(
$buy)
         {
$price1=$condoms*5;
          
$price2=$meds*20;
          
$price4=$glocks*500;
          
$price5=$shotguns*1000;
          
$price6=$uzis*2500;
          
$price7=$ak47s*5000;
          
$price8=$crack*20;
          
$price9=$dope*10;
          
$price10=$lowriders*8000;
          
$price11=$hummer*16000;
          
$price12=$jet*50000;
          
$price13=$plane*125000;
         }
       if(
$sell)
         {
$price6=$glocks*375;
          
$price7=$shotguns*750;
          
$price8=$uzis*1875;
          
$price9=$ak47s*3750;
          
$price10=$condoms*3.75;
          
$price11=$crack*15;
          
$price12=$dope*7.5;
          
$price13=$meds*15;
          
$price14=$lowrider*6000;
          
$price15=$hummer*12000;
          
$price16=$jet*37500;
          
$price17=$plane*93750;
         }

Or here
PHP Code:
 if($buy)
             {
$pmp[6] -= $cost;
              
$pmp[6] += $condoms;
              
$pmp[7] += $meds;
              
$pmp[9] += $crack;
              
$pmp[8] += $dope;
              
$pmp[1] += $glocks;
              
$pmp[2] += $shotguns;
              
$pmp[3] += $uzis;
              
$pmp[4] += $ak47s;
              
$pmp[5] += $lowriders;}
              
$pmp[10] += $hummer;}
              
$pmp[11] += $jet;}
              
$pmp[12] += $plane;}
           if(
$sell)
             {
$pmp[6] += $cost;
              
$pmp[1] -= $glocks;
              
$pmp[2] -= $shotguns;
              
$pmp[3] -= $uzis;
              
$pmp[4] -= $ak47s;
              
$pmp[5] -= $lowriders;
              
$pmp[10] -= $hummer;
              
$pmp[11] -= $jet;
              
$pmp[12] -= $plane;
              
$pmp[6] -= $condoms;
              
$pmp[7] -= $meds;
              
$pmp[9] -= $crack;
              
$pmp[8] -= $dope;
             }
           
$pmp[1]=fixinput($pmp[1]);
           
$pmp[2]=fixinput($pmp[2]);
           
$pmp[3]=fixinput($pmp[3]);
           
$pmp[4]=fixinput($pmp[4]);
           
$pmp[5]=fixinput($pmp[5]);
           
$pmp[6]=fixinput($pmp[6]);
           
$pmp[7]=fixinput($pmp[7]);
           
$pmp[8]=fixinput($pmp[8]);
           
$pmp[9]=fixinput($pmp[9]);
           
$pmp[10]=fixinput($pmp[10]);
           
$pmp[11]=fixinput($pmp[11]);
           
$pmp[12]=fixinput($pmp[12]);
           
$pmp[13]=fixinput($pmp[13]);
           
mysql_query("UPDATE $tab[pimp] SET money='$pmp[6]', condom='$pmp[6]', medicine='$pmp[7]', crack='$pmp[9]', weed='$pmp[8]', glock='$pmp[1]', shotgun='$pmp[2]', uzi='$pmp[3]', ak47='$pmp[4]', lowrider='$pmp[5]', hummer='$pmp[10]', jet='$pmp[11]', plane='$pmp[12]' WHERE id='$id'");
           
$soldfor=$pmp[6];
           
$transaction=completed
I pretty much copy and pasted a few other lines to add the stuff since this page is the most complicated in the whole script
KingOfTheSouth is offline  
Reply With Quote
Old 02-03-2009, 12:00 AM   #7 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

ok so you know where it is. Why don't you try outputing everything right before it gets inserted into the db. Then see what actually gets to the database. Then that should tell you where the problem is.
CoryMathews is offline  
Reply With Quote
Old 02-04-2009, 04:53 AM   #8 (permalink)
The Acquainted
 
KingOfTheSouth's Avatar
 
Join Date: Oct 2008
Location: Cincinnati
Posts: 151
Thanks: 14
KingOfTheSouth is on a distinguished road
Default

That did not work but check this out. I added numbers to everything that is supposed to be numbered to help everyone out with this. Here is the new file. Notice that there is numbers above the first query but they are commented out. The numbers edited above the query are to show which number goes with each item.
Thanks,
Attached Files
File Type: php purchase(2).php (16.6 KB, 154 views)
KingOfTheSouth is offline  
Reply With Quote
Old 02-05-2009, 07:07 PM   #9 (permalink)
The Contributor
 
Join Date: Jan 2009
Posts: 40
Thanks: 10
Scottymeuk is on a distinguished road
Default

Wow that amount of coding is scary on one page like that.

What does it actually do. Does it give out an error? or what? If it does not post the form it may have something to do with

PHP Code:
if($keyboard == enter
I don't see that set anywhere.
Scottymeuk is offline  
Reply With Quote
Old 02-05-2009, 09:05 PM   #10 (permalink)
The Acquainted
 
KingOfTheSouth's Avatar
 
Join Date: Oct 2008
Location: Cincinnati
Posts: 151
Thanks: 14
KingOfTheSouth is on a distinguished road
Default

It does not give out an error. It goes to a game. In the game you can buy items such as your drugs vehicles and weapons. But I added three new vehicles to the game and it will not give you the items or cash when you purchase the items or sell the items.
KingOfTheSouth is offline  
Reply With Quote
Old 02-05-2009, 09:13 PM   #11 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

Well, there's always Watchdog.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 02-05-2009, 09:15 PM   #12 (permalink)
The Acquainted
 
KingOfTheSouth's Avatar
 
Join Date: Oct 2008
Location: Cincinnati
Posts: 151
Thanks: 14
KingOfTheSouth is on a distinguished road
Default

What does that really have to do with a game?
KingOfTheSouth is offline  
Reply With Quote
Old 02-05-2009, 11:53 PM   #13 (permalink)
The Contributor
 
Join Date: Jan 2009
Posts: 40
Thanks: 10
Scottymeuk is on a distinguished road
Default

Its a joke lol. You said you dont get the goods when you purchase it. Therefor complain to watchdog lol.

Anyway, back on topic. What 3 items did you add? (Give the vars)
Scottymeuk is offline  
Reply With Quote
Old 02-06-2009, 01:17 AM   #14 (permalink)
The Acquainted
 
KingOfTheSouth's Avatar
 
Join Date: Oct 2008
Location: Cincinnati
Posts: 151
Thanks: 14
KingOfTheSouth is on a distinguished road
Default

It was the Hummer, Jet, Plane, so in other words it is Hummer, Private Jet, Commercial Plane
KingOfTheSouth is offline  
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
Display Modes

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Having trouble with md5() code_junkie Advanced PHP Programming 7 02-05-2009 06:41 PM
having trouble updating with mysql sarmenhb Absolute Beginners 7 11-18-2008 07:49 AM
Having trouble learning MySQL database codes... Aaron Absolute Beginners 24 05-08-2008 07:11 PM
Having trouble with Custom Function "isImage" Orc General 4 12-30-2007 12:19 AM
Trouble with Smarty obolus Absolute Beginners 1 10-11-2007 02:59 AM


All times are GMT. The time now is 06:17 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design