Jump to content

Help With Script?


Barles

Recommended Posts

hey everyone, I have a script that allows a user to view content after 5 other people clicked their referral link which is different for everyone based off of their IP address.

 

I have a button that i want it to open the content .

i made it work in the sense that it does open the content when clicked, HOWEVER, it ignores the "you need 5 referrals to access this",

however, it also shows the user they dont have enough clicks at the top of the page.

 

this is my code for the button:

<input name="req" type="submit"  id="req" style="background: url(images/index_17.gif);  width:141px; height:27px;border:0;" onClick="javascript:window.open('picture.php')" value=" ">

 

the part of the site where it shows the user they dont have enough referrals after the button is clicked:

 <form name="form1" method="post" action="">
    <p><? echo"$message"; ?></p>

 

and the javascript that calls the form i think:

<script type="text/javascript">
function clsv(sObj)
{
if(sObj.value=='Email'){
	sObj.value='';
}
}
</script>

 

 

There is also this code at the very top:

<? 
include "inc/functions.php"; 
$r=$_GET['r'];
$p=$_GET['p'];


$querys2=mysql_query("SELECT   * FROM prizes  LIMIT 1");
$p2 = mysql_fetch_object($querys2);


if (empty($p['p'])){
$p=$p2->id;
}

$sql_p_checkp = mysql_query("SELECT id FROM prizes WHERE id='$p'");
$ip_checkp = mysql_num_rows($sql_p_checkp);

if($ip_checkp > 0){
}else{
$p=$p2->id;
}

$querys=mysql_query("SELECT   * FROM prizes WHERE id='$p' LIMIT 1");
$p = mysql_fetch_object($querys);


$sql_ip_check2 = mysql_query("SELECT ip FROM user WHERE ip='$ip'");
$ip_check2 = mysql_num_rows($sql_ip_check2);

if($ip_check2 > 0){
}else{
mysql_query("UPDATE user SET hits =hits+1 WHERE id='$r'");
}



$sql_ip_check = mysql_query("SELECT ip FROM user WHERE ip='$ip'");
$ip_check = mysql_num_rows($sql_ip_check);

if($ip_check > 0){
$message="";
}else{
mysql_query("INSERT INTO user (`id` , `ip` , `hits`)
VALUES ('', '$ip', '0')") or die (mysql_error());
echo"<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"0\">";
}

$page=$p->id-1;
$page2=$p->id+1;

if (($_POST['reqp'])){
$email=mysql_real_escape_string(strip_tags($_POST['email']));
mysql_query("INSERT INTO requests (`id` , `ip` , `desc`, `email`)
VALUES ('', '$ip', '$p->desc', '$email')") or die (mysql_error());
mysql_query("UPDATE user SET hits =hits-$p->points WHERE ip='$ip'");
$message="Your prize has been requested and will be sent soon!";
}

if (($_POST['req'])){

$amm="$p->points";
if ($amm> $u->hits){
$message= "You don't have referral hits!";
}elseif ($amm <= $u->hits){

$message="<input  id=\"email\" name=\"email\" value=\"Email\" onClick=\"clsv(this);\" type=\"text\"/>
<input type=\"submit\" name=\"reqp\" id=\"reqp\" value=\"Request Prize\">
$s->cpa
";
}}
?>

 

 

Basically all I want is for picture.php to open when request is clicked, ONLY if the user has had 5 other people click/go to their referral link

 

I am not familiar with PHP, i bought this script, maker has not been too helpful, so any help is appreciated please

 

Link to comment
https://forums.phpfreaks.com/topic/223601-help-with-script/
Share on other sites

I feel like it would be a lot easier to have it like this:

 

if ref. clicks are less than 5 display text no link then if they are >5 display the link 

 

exp.

 

 

<?

 

if($refclick < 5) {

echo "image and name or whatever";

}

 

else {

echo "the actual link";

}

Link to comment
https://forums.phpfreaks.com/topic/223601-help-with-script/#findComment-1155816
Share on other sites

Thank you for the prompt reply.

It seems like it would work, I just have a question,

 

a. Do I have to take out any code from the code seen in my first post?

b. Do I add the code you posted lets say under the last part of the last code?

 

Sorry if I sound confusing its cause I am.

I only know HTML and never dealt with code like this before....

Link to comment
https://forums.phpfreaks.com/topic/223601-help-with-script/#findComment-1155822
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.