11
Kiwi_Chris
Re: Coding Help
  • 2009/7/3 11:16

  • Kiwi_Chris

  • Just popping in

  • Posts: 79

  • Since: 2009/1/3 2


Thanks for the reply Mamba,

I think I may not have explained what I need to do very well.

I will try again.

I run a fansite for a online game,
so members of this game, join my site they register with my site, but at this stage they could be pretending to be a player from the online game.

So my thought is, they login to the online game and in there profile there enter a code/number which was created using something like function rand().

Then my code would do something like file_get_content
and verify the data was added.

In this way I could be sure they were that character.

. I tried to register withhttp://dev.xoops.org but I think they are not taking registrations at the moment.



12
Kiwi_Chris
Coding Help
  • 2009/7/3 10:54

  • Kiwi_Chris

  • Just popping in

  • Posts: 79

  • Since: 2009/1/3 2


Hi all,

I have been trying to find some information about how to make a code do the following:

I want a code that with generate a random number
then after the user add's this code to another website,
have the code check that this number was added and if it was
add into the database that it was there.

This is so I can validate users on my site are the holder of an account on another site.

Any ideas on how I could do this.

I thought maybe the formulize module might do this type of thing.

but I have no idea of how I would go about doing this.

Second I notice there are Developers for hire, It would be nice if there was a Thread that allowed people like myself who need small jobs like this one done, that we could ask for help and offer a fee for the work. And the Developers could look there and choose to do such work.

I have other jobs/Projects I would like done also so this would be good for me.

Kind Regards.
Hope someone can help me here.



13
Kiwi_Chris
Re: HELP!!! xcgallery voting/Rate this pick
  • 2009/7/2 9:45

  • Kiwi_Chris

  • Just popping in

  • Posts: 79

  • Since: 2009/1/3 2


Perfect, can't see any other bugs,,,

well a couple of theme ones but I'll work that out another day.

Legend. Thank you so Much.



14
Kiwi_Chris
Re: xcgallery voting/Rate this pick
  • 2009/7/2 5:20

  • Kiwi_Chris

  • Just popping in

  • Posts: 79

  • Since: 2009/1/3 2


If anyone has any idea's of what I can try please post here.

I am in real need of help.

Please.



15
Kiwi_Chris
Re: xcgallery voting/Rate this pick
  • 2009/7/1 21:06

  • Kiwi_Chris

  • Just popping in

  • Posts: 79

  • Since: 2009/1/3 2


The issue is some users can vote many times on one picture.
It does not record in the database the user has voted, if another user has already voted on the same ip address.

e.g. 2 family members of the same house want to vote, the first person votes, and then can't vote anymore
the second person votes, and can vote as many times as they like.

The script checks and see's the user has not voted but as the ip address is the same as one already on record for that picture it does not record this new users info into the database, and for this reason they can continue to vote on the same picture over and over again.

I think all that needs to change is the area of ratepic.php

// Update the votes table
$sql = "INSERT INTO ".$xoopsDB->prefix("xcgal_votes")." ".
"VALUES ('$pic', '".$_SERVER['REMOTE_ADDR']."', '$curr_time', '$vid')";
$result = $xoopsDB->queryF($sql);
redirect_header($location,2,_MD_RATE_OK);


The following is the script for rating a pic, hope it helps.


include "../../mainfile.php";
define('IN_XCGALLERY', true);

require('include/init.inc.php');


// Check if required parameters are present
if (!isset($_GET['pic']) || !isset($_GET['rate'])) redirect_header('index.php',2,_MD_PARAM_MISSING);

$pic = (int)$_GET['pic'];
$rate = (int)$_GET['rate'];

$rate = min($rate, 5);
$rate = max($rate, 0);


// If user does not accept script's cookies, we don't accept the vote
if (!isset($_COOKIE[$xoopsModuleConfig['cookie_name'].'_data'])) {
redirect_header('displayimage.php?pid='.$pic.'&pos='.(-$pic),2,"Please enable Cookies!");
exit;
}

$location = "displayimage.php?pid=".$pic."&pos=".(-$pic);
// Retrieve picture/album information & check if user can rate picture
$sql = "SELECT a.votes as votes_allowed, p.votes as votes, pic_rating ".
"FROM ".$xoopsDB->prefix("xcgal_pictures")." AS p, ".$xoopsDB->prefix("xcgal_albums")." AS a ".
"WHERE p.aid = a.aid AND pid = '$pic' LIMIT 1";
$result = $xoopsDB->query($sql);
if (!$xoopsDB->getRowsNum($result)) redirect_header('index.php',2,_MD_NON_EXIST_AP);
$row = $xoopsDB->fetchArray($result);
$xoopsDB->freeRecordSet($result);
if (!USER_CAN_RATE_PICTURES || $row['votes_allowed'] == 'NO') redirect_header($location,2,_MD_PERM_DENIED);


// Clean votes older votes
$curr_time = time();
if ($xoopsModuleConfig['keep_votes_time'] > 0){
$clean_before = $curr_time - $xoopsModuleConfig['keep_votes_time'] * 86400;
$sql = "DELETE ".
"FROM ".$xoopsDB->prefix("xcgal_votes")." ".
"WHERE vote_time < $clean_before";
$result = $xoopsDB->queryf($sql);
}

// Check if user already rated this picture
if (is_object($xoopsUser)){
$vid = $xoopsUser->uid();
$sql = "SELECT * ".
"FROM ".$xoopsDB->prefix("xcgal_votes")." ".
"WHERE pic_id = '$pic' AND v_uid = '$vid'";
}
else {
$vid = 0;
$sql = "SELECT * ".
"FROM ".$xoopsDB->prefix("xcgal_votes")." ".
"WHERE pic_id = '$pic' AND vote_time > '".(time()-86400)."' AND ip='".$_SERVER['REMOTE_ADDR']."'";
}

$result = $xoopsDB->query($sql);
if ($xoopsDB->getRowsNum($result)) redirect_header($location,2,_MD_RATE_ALREADY);


// Update picture rating
$new_rating = round(($row['votes'] * $row['pic_rating'] + $rate * 2000)/($row['votes']+1));
$sql = "UPDATE ".$xoopsDB->prefix("xcgal_pictures")." ".
"SET pic_rating = '$new_rating', votes = votes + 1 ".
"WHERE pid = '$pic' LIMIT 1";
$result = $xoopsDB->queryf($sql);


// Update the votes table
$sql = "INSERT INTO ".$xoopsDB->prefix("xcgal_votes")." ".
"VALUES ('$pic', '".$_SERVER['REMOTE_ADDR']."', '$curr_time', '$vid')";
$result = $xoopsDB->queryF($sql);
redirect_header($location,2,_MD_RATE_OK);

?>

Love any help that can be given.



16
Kiwi_Chris
Re: xcgallery voting/Rate this pick
  • 2009/7/1 20:45

  • Kiwi_Chris

  • Just popping in

  • Posts: 79

  • Since: 2009/1/3 2


Ghia Thank you,

I have found a potential big bug with the voting system and I am hoping there is already a fix as I was in the middle of competition on my site.

The issue is that the database seems to only record the UID if the ip address for that PID is unique.

Issue is when a second uid on the same IP votes on a PID, they are able to vote without end, so allowing them to vote over and over again.

So I desperately need a fix, I mean this could have very negative effects for my site.



17
Kiwi_Chris
HELP!!! xcgallery voting/Rate this pick
  • 2009/7/1 3:01

  • Kiwi_Chris

  • Just popping in

  • Posts: 79

  • Since: 2009/1/3 2


Hi all, with xcgallery it has a voting system where you can
rate a pic 0/5 through to 5/5

My question is, if you had say 100 pictures with votes being made over all of them, how with this rating would you decide a winner?



18
Kiwi_Chris
Re: Yogurt.. let's start hacking
  • 2009/6/27 7:28

  • Kiwi_Chris

  • Just popping in

  • Posts: 79

  • Since: 2009/1/3 2


is yogurt your front page? or is it when you go to view yogurt?
is it possible to get a link to your site?

have you had yogurt working previously?
or is this after fresh install



19
Kiwi_Chris
Re: Yogurt.. let's start hacking
  • 2009/6/12 7:21

  • Kiwi_Chris

  • Just popping in

  • Posts: 79

  • Since: 2009/1/3 2


I realized today there was an issue when clicking on names in Who is online, and also from within inbox, I have reverted back to my way, I don't use newwbb and wordpress seems to work o.k.

I don't know why I didn't pick that up earlier.



20
Kiwi_Chris
Re: Yogurt Scrapbook Timestamp
  • 2009/6/11 4:35

  • Kiwi_Chris

  • Just popping in

  • Posts: 79

  • Since: 2009/1/3 2


there is a field in the database for date.

surely there must be a way to include this with the post.
Maybe edit submit_scrap.php??

I don't know what to add to make this work,

this is where I think the code could be added

$myts =& MyTextSanitizer::getInstance();
$scrapbook_uid = $_POST['uid'];
$scrap_text = $myts->displayTarea($_POST['text'],0,1,1,1,1);
$mainform = (!empty($_POST['mainform'])) ? 1 : 0;
$scrap = $scraps_factory->create();
$scrap->setVar('scrap_text',$scrap_text);
$scrap->setVar('scrap_from',$xoopsUser->getVar('uid'));
$scrap->setVar('scrap_to',$scrapbook_uid);
$scraps_factory->insert($scrap);
$extra_tags['X_OWNER_NAME'] = $xoopsUser->getUnameFromId($scrapbook_uid);
$extra_tags['X_OWNER_UID'] = $scrapbook_uid;
$notification_handler =& xoops_gethandler('notification');
$notification_handler->triggerEvent ("scrap", $xoopsUser->getVar('uid'), "new_scrap",$extra_tags);
if ($mainform==1){
redirect_header("scrapbook.php?uid=".$scrapbook_uid,1,_MD_YOGURT_SCRAP_SENT);
}else{
redirect_header("scrapbook.php?uid=".$xoopsUser->getVar('uid'),1,_MD_YOGURT_SCRAP_SENT);
}




TopTop
« 1 (2) 3 4 5 ... 7 »



Login

Who's Online

157 user(s) are online (96 user(s) are browsing Support Forums)


Members: 0


Guests: 157


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits