Author Topic: change details-template after sql-query  (Read 5209 times)

0 Members and 1 Guest are viewing this topic.

Offline Peppino

  • Newbie
  • *
  • Posts: 46
    • View Profile
change details-template after sql-query
« on: July 24, 2007, 09:01:14 AM »
Hallo

Da mir ja hier keiner helfen kann


http://www.4homepages.de/forum/index.php?topic=3304.0

möchte ich es anders versuchen.


Und zwar soll, wenn man auf ein Thumb klickt, erst überprüft werden, ob der User genug Coins hat, das Bild in groß zu sehen.

Es soll aus der

Tabelle ->4images_users  Feld-> user_coins
abgefragt werden, und aus

Tabelle ->4images_categories   Feld-> cat_cost

wenn user_coins < cat_cost

dann soll nicht details.html aufgerufen werden, sonder details_no.html.

Ist das machbar?

--------------------------------------
So, nobody can help me here

http://www.4homepages.de/forum/index.php?topic=3304.0

so i want to try it by an other way.

If a User clicks at the Thumb, it must be checked that the user has enough coins for see the full image.

So, a db-query must select
Table ->4images_users    field-> user_coins
 
and
Table ->4images_categories  field-> cat_cost


if user_coins < cat_cost
then not open the template details.html, then open details_no.html

Danke
Thanks

Gruß Marcus

Offline Peppino

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: change details-template after sql-query
« Reply #1 on: July 25, 2007, 06:04:42 PM »
Ok,
versuchen wir es noch anders :)

Kann mir jemand sagen, wo ich diese Abfrage hier
Code: [Select]
$sql = "SELECT user_coins
          FROM ".USERS_TABLE."
          WHERE user_id = $user_id";
   $result = mysql_query($sql);
 

und diese hier

Code: [Select]
$sql = "SELECT cat_cost
          FROM ".CATEGORIES_TABLE."
          WHERE cat_id = $cat_id";
   $result2 = mysql_query($sql);


in die functions.php einbauen kann, so dass auch die Variablen alle vorhanden sind.
Dann noch kontrollieren ob result < result2 .
und dann das so in den Code schon vorhandenen Code einbauen?

Code: [Select]
if (!check_permission("auth_viewimage", $image_row['cat_id']) || !check_permission("auth_viewcat", $image_row['cat_id'])) {
    $show_link = 0;
  }

Würde mir echt helfen.

Also wie oder wo es eingebaut wird, ist mir echt egal ;)
Nur soll halt vor öffnen der details.php geprüft werden ob genügend Coins vorhanden sind.

« Last Edit: July 31, 2007, 08:15:43 AM by Peppino »
Gruß Marcus

Offline Peppino

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: change details-template after sql-query
« Reply #2 on: July 31, 2007, 08:17:03 AM »
Kann ich denn sql-abfragen einfach so in der functions.php starten,
bzw. sind die variablen

$user_id und $cat_id

in der functions.php verfügbar?

Danke
Gruß Marcus

Offline Peppino

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: change details-template after sql-query
« Reply #3 on: August 08, 2007, 02:07:43 PM »
Ok
the last post in english.

Can i use the the code above?
Is it possible to use the variables

$user_id and $cat_id

in the functions.php?

I try it a long time, but it doesn´t work :(

thanks
Gruß Marcus

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: change details-template after sql-query
« Reply #4 on: August 08, 2007, 02:12:06 PM »
Sorry ... no get jack what you post the 1st post...
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Peppino

  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: change details-template after sql-query
« Reply #5 on: August 10, 2007, 11:57:24 AM »
Hello!

The Main-Problem ist here

http://www.4homepages.de/forum/index.php?topic=3304.msg96138#msg96138

I´ve add/create a Coin-Mod.
But i need a little MOD for this MOD ->

http://www.4homepages.de/forum/index.php?topic=3304.0

The MOD should check if the User is authed to see the Pictures and now my Problem, the MOD should check the coins from the User.
So if the table-field 4images_users -> user_coins is < as the table-field 4images_categories -> cat_cost
then the Popup must open too.

I hope you understand it.

The variable $show_link checks if the user has permission.
and the MOD -> [Mod] Popup message when user clicks thumbnail where they have no permission
works with this variable.
So the definition for the variable $show_link must have the check with the coins.

Thanks
Gruß Marcus

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: change details-template after sql-query
« Reply #6 on: August 10, 2007, 01:08:36 PM »
For MOD ? Please post in right topics.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?