Vraag

Gestart doorPropje3 reacties45 weergaven

4 berichten · pagina 1 van 1

Propje

Lid · Topicstarter

Berichten
2.517
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hallo

ik heb even een vraag
ik heb zeg maar een script soort winkel script alleen ik wil checken als die persoon wel genoeg saldo heeft maar weet iemand hoe je dat doet?

ps dit is het script:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]../config.php[/COLOR][COLOR= #007700]);[/COLOR]
check_login[COLOR= #007700]();[/COLOR]
?>

[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]POST[/COLOR] [COLOR= #007700]&& ![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700]))
  {[/COLOR]
    [COLOR= #0000BB]$aFouten[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]winkel[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700])
      {[/COLOR]
        [COLOR= #0000BB]$aFouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Je hebt geen winkel aangevinkt[/COLOR][COLOR= #007700];
      }[/COLOR]
      
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aFouten[/COLOR][COLOR= #007700]) !=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
          {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De volgende fouten zijn opgetreden: <br /><br />[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/for"]for[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$Fi[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$Fi[/COLOR] [COLOR= #007700]<[/COLOR] [URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aFouten[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$Fi[/COLOR][COLOR= #007700]++)
              {[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$aFouten[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$Fi[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];
              }[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br />Klik <a href="javascript:history.go(-1);">hier</a> om terug te keren[/COLOR][COLOR= #007700];
          }[/COLOR]
        [URL="http://www.php.net/else"]else[/URL]
          [COLOR= #007700]{[/COLOR]
          [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE gebruikers SET winkel = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]winkel[/COLOR][COLOR= #007700]]) .[/COLOR][COLOR= #DD0000]" WHERE gebruiker = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruiker[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]" "[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
          [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE `gebruikers` SET geld=geld-1500 WHERE `gebruiker` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruiker[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
          [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De gegevens zijn succesvol opgeslagen in de database[/COLOR][COLOR= #007700];
          }
      
  }[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
  [COLOR= #007700]{[/COLOR]
?>
<form action="" method="POST">
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<b>Welke winkel wil je?</b>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="radio" name="winkel" value="kledingwinkel">kledingwinkel<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="radio" name="winkel" value="boekenwinkel">Boekenwinkel<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="radio" name="winkel" value="speelgoedwinkel">speelgoedwinkel<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="radio" name="winkel" value="mediawinkel">Mediawinkel<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="radio" name="winkel" value="schoenenwinkel">schoenenwinkel<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="radio" name="winkel" value="supermarkt">Supermarkt<br />[/COLOR][COLOR= #007700];[/COLOR] 
?>
<input type="submit" name="verzenden" value="Verzenden">
</form>
[COLOR= #0000BB]<?php[/COLOR]
  [COLOR= #007700]}[/COLOR]
?>
0
Berichten
2.692
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik weet niet of het klopt maar ik heb dit:

[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]../config.php[/COLOR][COLOR= #007700]);[/COLOR]
check_login[COLOR= #007700]();[/COLOR]
?>

[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000]POST[/COLOR] [COLOR= #007700]&& ![/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700]))
  {[/COLOR]
    [COLOR= #0000BB]$aFouten[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]winkel[/COLOR][COLOR= #007700]] ==[/COLOR] [COLOR= #DD0000][/COLOR][COLOR= #007700])
      {[/COLOR]
        [COLOR= #0000BB]$aFouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Je hebt geen winkel aangevinkt[/COLOR][COLOR= #007700];
      }[/COLOR]
    [COLOR= #0000BB]$getgebruiker[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM gebruikers WHERE gebruiker = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruiker[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
    [COLOR= #0000BB]$gebruiker[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$getgebruiker[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruiker[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]geld[/COLOR][COLOR= #007700]] <[/COLOR] [COLOR= #DD0000]1500[/COLOR][COLOR= #007700])
      {[/COLOR]
        [COLOR= #0000BB]$aFouten[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #DD0000]Je hebt niet genoeg geld[/COLOR][COLOR= #007700];
      }[/COLOR]
      
        [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aFouten[/COLOR][COLOR= #007700]) !=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
          {[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De volgende fouten zijn opgetreden: <br /><br />[/COLOR][COLOR= #007700];[/COLOR]
            [URL="http://www.php.net/for"]for[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$Fi[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #0000BB]$Fi[/COLOR] [COLOR= #007700]<[/COLOR] [URL="http://www.php.net/count"]count[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aFouten[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$Fi[/COLOR][COLOR= #007700]++)
              {[/COLOR]
                [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$aFouten[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]$Fi[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]<br />[/COLOR][COLOR= #007700];
              }[/COLOR]
            [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<br />Klik <a href="javascript:history.go(-1);">hier</a> om terug te keren[/COLOR][COLOR= #007700];
          }[/COLOR]
        [URL="http://www.php.net/else"]else[/URL]
          [COLOR= #007700]{[/COLOR]
          [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE gebruikers SET winkel = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]winkel[/COLOR][COLOR= #007700]]) .[/COLOR][COLOR= #DD0000]" WHERE gebruiker = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruiker[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]" "[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
          [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE `gebruikers` SET geld=geld-1500 WHERE `gebruiker` = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruiker[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
          [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]De gegevens zijn succesvol opgeslagen in de database[/COLOR][COLOR= #007700];
          }
      
  }[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
  [COLOR= #007700]{[/COLOR]
?>
<form action="" method="POST">
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<b>Welke winkel wil je?</b>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]</br>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="radio" name="winkel" value="kledingwinkel">kledingwinkel<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="radio" name="winkel" value="boekenwinkel">Boekenwinkel<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="radio" name="winkel" value="speelgoedwinkel">speelgoedwinkel<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="radio" name="winkel" value="mediawinkel">Mediawinkel<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="radio" name="winkel" value="schoenenwinkel">schoenenwinkel<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<input type="radio" name="winkel" value="supermarkt">Supermarkt<br />[/COLOR][COLOR= #007700];[/COLOR] 
?>
<input type="submit" name="verzenden" value="Verzenden">
</form>
[COLOR= #0000BB]<?php[/COLOR]
  [COLOR= #007700]}[/COLOR]
?>
0
Berichten
3.461
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kost iets dan altijd €1500+? Je kan beter een string maken die het saldo ophaalt en dan met een of checken of $saldo lager is dan $productPrijs
0
Propje

Lid · Topicstarter

Berichten
2.517
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
owja ik wil trouwens ook meerdere winkels andere prijzen hebben

en dat je maar 1 winkel mag kiezen en dan mag het niet meer
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren