Our Sponsors



Theme Shop
Get the best in phpnuke themes, stock photos, icons from Western Studios themes shop.
shop.westernstudios.net

Live Tutorials
PHP, Photoshop, flash, illustrator tutorials.
www.live-tutorials.com

Your Ads Here
Advertise with Western Studios.
www.westernstudios.net

PHP Nuke Services
Need work done on your site? View our services for the best in phpnuke services.
www.westernstudios.net

PHP Nuke Downloads
The latest and best in php nuke downloads.
www.westernstudios.net




Western Studios :: View topic - 4images usergroup hack - help please (SOLVED)
 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups     ProfileProfile   Log inLog in 


4images usergroup hack - help please (SOLVED)


Goto page 1, 2  Next
 
Post new topic   Reply to topicprinter friendly version    Western Studios Forum Index -> 4 Images
Western Studios

X-perienced
X-perienced
~PHP Nuke User~

Platinum Subscriber

Posts: 110
Next Group: 40 posts
Anna wrote:

First, this is regarding a stand alone 4 images gallery NOT nuked.

I am trying to create a hack so that a person is promoted to a 4images usergroup after uploading 5 photo's to the gallery. This woiuld then give them extra permissions.

Have been playing with the following code

Code:
  $sql = "SELECT COUNT(image_id) AS totimg
         FROM ".IMAGES_TABLE."
         WHERE  user_id = $user_id";
    $result = $site_db->query($sql);
   $row = $site_db->fetch_array($result);
   $uploaded_images = $row['totimg'];
if ($uploaded_images ==5) {
 $sql = "INSERT INTO ".GROUP_MATCH_TABLE."
                (group_id, user_id, groupmatch_startdate, groupmatch_enddate)
                VALUES
                (3, $user_id, $current_time, 0)";
        $site_db->query($sql);
       )


Buit this results in an error regarding the final line )

Hoping that someone here is able to herlp me figure out how to achieve this result.

I should mention that I am trying to insert this into member.php after a successful image upload has been completed. I also think that the above code will cause another issue for me as it is not checking to see if the user is already a member of that group.

Any help would be appreciated.

Posted: Thu Apr 19, 2007 2:21 am



Last edited by Anna on Fri Apr 20, 2007 9:57 pm; edited 1 time in total
Western Studios

Site Admin
Site Admin
~PHP Nuke User~

Platinum Subscriber

Posts: 3308
Staff
Next Group: 1692 posts
admin(Mark) wrote:

that should not be ), it should instead be }

To solve the issue if the user is already a member of the group, you should add a numrows check after this line

if ($uploaded_images ==5) {

[/code]

Posted: Thu Apr 19, 2007 2:40 am

Western Studios

X-perienced
X-perienced
~PHP Nuke User~

Platinum Subscriber

Posts: 110
Next Group: 40 posts
Anna wrote:

Thanks, will give that a try after dinner, but figured it was going to be something along those lines.

Why do the simplest problems result in the most hair loss?

Posted: Thu Apr 19, 2007 3:13 am

Western Studios

X-perienced
X-perienced
~PHP Nuke User~

Platinum Subscriber

Posts: 110
Next Group: 40 posts
Anna wrote:

Thanks, that got the syntax issue sorted, now just have to work out the best place to set this up within the script.

Using it through the upload code did not produce the correct results.

This is a job for tomorrow though. Appreciate the help.

Posted: Thu Apr 19, 2007 5:15 am

Western Studios

X-perienced
X-perienced
~PHP Nuke User~

Platinum Subscriber

Posts: 110
Next Group: 40 posts
Anna wrote:

I am adding a whole new dimension to the definition of the word confused.

I had the code below working, with the exception of the time not being correctly inserted into the database. I tested it a number of times, deleting the entries and reinstating them. All was going fine.

Then I decided to play with the time aspect. All of a sudden it stopped working. Not even replacing the original code below would make it work again.

I dont understand why it would work, then stop working????

Code:
if ($user_info['user_id'] != 0){
$userv_id=$user_info['user_id'];
$sql = "SELECT group_id
         FROM ".GROUP_MATCH_TABLE."
         WHERE  user_id = $userv_id";
    $user_grom = $site_db->query($sql);
    if ($user_grom = 0){
  $sql = "SELECT COUNT(image_id) AS totimg
         FROM ".IMAGES_TABLE."
         WHERE  user_id = $userv_id";
    $result = $site_db->query($sql);
   $row = $site_db->fetch_array($result);
   $uploaded_images = $row['totimg'];
if ($uploaded_images = 5) {
 $sql = "INSERT INTO ".GROUP_MATCH_TABLE."
                (group_id, user_id, groupmatch_startdate, groupmatch_enddate)
                VALUES
                ('3', '$userv_id', '$current_time', '0')";
        $site_db->query($sql);
       }
       }
       unset($user_grom);
  unset($row);
      }


Posted: Fri Apr 20, 2007 12:44 am

Post new topic   Reply to topic    Western Studios Forum Index -> 4 Images All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts Hundreds of Gmail invites to give away 2 Anna 607 Sat Feb 04, 2006 11:01 am
leachy View latest post
No new posts PHP Nuke klips 0 admin 608 Fri Mar 18, 2005 6:52 pm
admin View latest post
No new posts Paypal success.php 1 Jabba 780 Fri Mar 04, 2005 7:00 pm
admin View latest post
No new posts Testing PHP tags 2 admin 763 Thu Mar 03, 2005 6:06 pm
admin View latest post
No new posts PHP Nuke Icons 0 admin 810 Mon Aug 23, 2004 4:05 pm
admin View latest post
 
Forums ©