Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
  1. #1
    Member
    Join Date
    Jun 2005
    Location
    Japan
    Posts
    93
    Member #
    10249
    Hi, I have just set up a t-shirt ranking site. It is a free service but I had intended to add an affiliate code and it would pay for itself that way.
    An I had done that or so I thought. I was able to add the affiliate code automatically to the script but I later found that the code was being stripped in the redirect.

    The link I am using is as follows...except it is on one line. I broke it up so it wouldn't break up the page.

    HTML Code:
     http://theshirtlist.com/cafepress/design_hit.php?
    design_id=eccbc87e4b5ce2fe28308fd9f2a7baf3&
    design_url=http://www.cafepress.com/deadhippo
    /1201429&pid=xxxxxxx&tid=SL1
    If you want to check out the link for yourself you can just look at my site - The Shirt List.

    I was given the following piece of advice.
    You haven't URL encoded the design_url value.
    You won't be receiving any commission with that link. It's stripping away at the ampersand before pid. So all that gets passed to your redirect script is: http://www.cafepress.com/deadhippo/12014929

    It should be formed like this:
    HTML Code:
    http%3A%2F%2Fwww%2Ecafepress%2Ecom%2Fdeadhippo
    +%2F1201429%26pid%3Dxxxxxxx%26tid%3DSL1
    You use a function called URLEncode to make the link look like that.

    Then you need to decode it on your redirect script. Then redirect. And hey presto you redirect with a pid and a tid. No stripping away at the ampersand.
    Unfortunately I don't know how to do this. If someone can help me I'd appreciate it.

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Right.

    First we will get the encoded value of the URL

    PHP Code:
    $encoded =
    urlencode("http://cafepress.com/deadhippo/12014929&pid=xxxxxx&tld=SL1"); 
    Now we need to produce the link..
    PHP Code:
    echo "<a href=\"http://theshirtlist.com/cafepress/design_hit.php?
    design_id=eccbc87e4b5ce2fe28308fd9f2a7baf3&
    design_url=
    $encoded\">link text</a>"
    Now, to decode, which would go in your redirect page, would look like
    PHP Code:
    $decoded urldecode($_GET['design_url'];
    header("Location: $decoded"); // assuming you redirect via PHP 
    That should be you.

  4. #3
    Member
    Join Date
    Jun 2005
    Location
    Japan
    Posts
    93
    Member #
    10249
    Hi, wow, thanks for the reply. You have given some great detail but unfortunately I don't know how to use it. The url that you are getting the encoded value of is only an example. It will be different for evey design. I don'treally knw how php works but below is a sectoin of the code. It includes some html with the php. Would you be able to tell me where it goes in here? The code just before $site_pid and <?=$site_pid?> is the where the url appears. The $site_pid and <?=$site_pid?> is how I added my affiliate and tracking code. The second piece of code I am proud to say is the first piece of php code I ever wrote, even though it is a pretty humble achievement.

    PHP Code:
    <?
                            $order_no 
    $order_no 2;
                            for(
    $i=0;$i<2;$i++){
                                
    $row_design[design_discription] = nl2br($row_design[design_discription]);
                                
    $row_design[design_image] = "<a href='design_hit.php?design_id=$row_design[design_id]&design_url=$row_design[design_url]$site_pid' target='_blank'><img src='img/design/$row_design[design_image]' style='border-color:#FFFFFF; border-width:1px' align='absmiddle' alt='$site_word #: $row_design[design_code]
    Member ID: 
    $row_design[member_name]'>";
                              
    $design_order $use_design_position $row_design['design_position'] : $order_no+$i;
                            
    ?>
                            <td width="50%" align="left"><table width="294" height="275" border="0" style="PADDING-RIGHT: 1px; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; PADDING-TOP: 1px;" background="http://www.theshirtlist.com/images/thumb.gif">
                              <tr>
                                <td colspan="3" class="tsLink" align="center" height="23"><a href="design_hit.php?design_id=<?=$row_design[design_id]?>&design_url=<?=$row_design[design_url]?><?=$site_pid?>" class="tsLink" target="_blank"><?= htmlspecialchars($row_design[design_title]) ?>

  5. #4
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,657
    Member #
    1234
    Liked
    137 times
    Quote Originally Posted by bfsog
    Right.

    First we will get the encoded value of the URL

    PHP Code:
    $encoded =
    urlencode("http://cafepress.com/deadhippo/12014929&pid=xxxxxx&tld=SL1"); 
    Now we need to produce the link..
    PHP Code:
    echo "<a href=\"http://theshirtlist.com/cafepress/design_hit.php?
    design_id=eccbc87e4b5ce2fe28308fd9f2a7baf3&
    design_url=
    $encoded\">link text</a>"
    Now, to decode, which would go in your redirect page, would look like
    PHP Code:
    $decoded urldecode($_GET['design_url'];
    header("Location: $decoded"); // assuming you redirect via PHP 
    That should be you.
    and why does your code say VBULLETIN?
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  6. #5
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Wired: sometimes when people post PHP, a weird message appears, this is a vbulletin issue.

    deadhippio: pretty simple.

    Just before you echo out your link, which currently is this code
    PHP Code:
                                <td colspan="3" class="tsLink" align="center" height="23"><a href="design_hit.php?design_id=<?=$row_design[design_id]?>&design_url=<?=$row_design[design_url]?><?=$site_pid?>" class="tsLink" target="_blank"><?= htmlspecialchars($row_design[design_title]) ?>
    You will need to use the function urlencode, here goes
    PHP Code:
                                <td colspan="3" class="tsLink" align="center" height="23"><a href="design_hit.php?design_id=<?=$row_design[design_id]?>&design_url=<?= urlencode($row_design[design_url])?><?=$site_pid?>" class="tsLink" target="_blank"><?= htmlspecialchars($row_design[design_title]) ?>
    Or if that does not work, try
    PHP Code:
    <?php
    $url 
    urlencode($row_design[design_url];
    <
    td colspan="3" class="tsLink" align="center" height="23"><a href="design_hit.php?design_id=<?=$row_design[design_id]?>&design_url=<?=$url?><?=$site_pid?>" class="tsLink" target="_blank"><?= htmlspecialchars($row_design[design_title]) ?>
    That is for encoding, to decode, use the code in my first post and as long as you have it before your redirect it should be fine.

  7. #6
    Member
    Join Date
    Jun 2005
    Location
    Japan
    Posts
    93
    Member #
    10249
    Hi, thanks for the reply. I really appreciate the help. I also need to include the $site_pid in the urlencode. So from what you have given me I tried the following on the top url.

    PHP Code:
    $row_design[design_image] = "<a href='design_hit.php?design_id=$row_design[design_id]&design_url=<?= urlencode($row_design[design_url]$site_pid)' target='_blank'><img src='img/design/$row_design[design_image]' style='border-color:#FFFFFF; border-width:1px' align='absmiddle' alt='$site_word #: $row_design[design_code]
    Member ID$row_design[member_name]'>";
    Is that valid code? X Scratch that. It isn't valid as it doesn't work.

    Another thing to let you know how ignorant I am ... I don't which is my redirect page or how to go about finding out. So I don't know where to put the decode. Is it the same page?

  8. #7
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Your redirect page is design_hit.php

    Do you echo $row_design[design_image] anywhere, as currently you are just assigning that image link to a variable.

  9. #8
    Member
    Join Date
    Jun 2005
    Location
    Japan
    Posts
    93
    Member #
    10249
    Hi,
    I searched the site and there is no
    PHP Code:
    echo $row_design 
    anywhere to be seen.

  10. #9
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    Well, not just $row_design, as thats an array.

    See in your code, where you have this:
    PHP Code:
    $row_design[design_image] = "<a href='design_hit.php?design_id=$row_design[design_id]&design_url=<?= urlencode($row_design[design_url]$site_pid)' target='_blank'><img src='img/design/$row_design[design_image]' style='border-color:#FFFFFF; border-width:1px' align='absmiddle' alt='$site_word #: $row_design[design_code] 
    Member ID$row_design[member_name]'>";
    That assigns all that gobbledegoop to $row_design[design_image]. So somewhere or other, you need to go:
    PHP Code:
    echo $row_design[design_image]; 
    Or, see everything inside the $row_design array, go:
    PHP Code:
    print_r($row_design[design_image]); 

  11. #10
    Member
    Join Date
    Jun 2005
    Location
    Japan
    Posts
    93
    Member #
    10249
    Sorry, I don't what those expressions mean. I have posted the entire page of code below. Maybe it can answer the questions that I can't.

    PHP Code:
    <?
    /* Displays design list

    to define in parent script before inclusion:
    $page_title -- page title
    $custom_condition -- custom condition for design list query
    $order_by -- order by clause for design list query
    $pagenavigator_url -- url for home_pagenavigator()
    $use_design_position -- true=use ts_design.design_position field; false=enumerate from 1
    $use_arrow_images -- true=use uparrow/downarrow.gif images; false=use even.gif only
    */
    ?><html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="description" content="<?=$site_description?>">
    <meta name="keywords" content="<?=$site_keywords?>">
    <meta http-equiv="Refresh" Content="1800">
    <meta http-equiv="Expires" Content="600">
    <meta name="author" content="<?=$site_author?>">
    <meta name="copyright" content="<?=$site_copyright?>">
    <meta name="email" content="<?=$site_email?>">
    <link rel="stylesheet" href="css/tshirt.css" type="text/css">
    <script language="JavaScript" src="js/tshirt.js"></script>
    <title><?=$site_title?> - Ranking <?=$site_word?>s</title>
    </head>
    <body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" bgcolor="<?=$site_colour?>">
    <table width="760" align="center" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
      <? include"include/top_menu.php"?>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top"><? include"include/left_menu.php"?></td>
            <td width="100%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <? include"include/sub_top_menu.php"?>
              <tr>
                <td>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="20" valign="bottom" class="tsTitle">
                        &nbsp;&nbsp;&nbsp;<font size="+2"><?= $page_title ?> </font></td>
                    <td height="20">&nbsp;</td>

               </tr>
                  <tr>
                    <td colspan="2" width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                       <?
                        $limit
    =20$page_size=5;
                        
    $page=intval($page);
                        if (!
    $page || $page==0) {  $page=1; }
                        if(
    $_POST[go_page]){
                            
    $page ceil(intval($_POST[go_page])/20);
                            
    $go_page=intval($_POST[go_page]);
                        }
                        
    $offset=($page-1)*$limit;

                        
    $condition_design " WHERE 1=1 ";
                        
    $condition_design .= " AND design_isview=1 ";
                        if(
    $category_id)
                          
    $condition_design .= " AND MD5(category_id) ='$category_id' ";
                        if(isset(
    $custom_condition))
                            
    $condition_design .= $custom_condition;

                        
    $sql_count "SELECT COUNT(*) AS total_msg FROM ts_design".$condition_design;
                        
    $rs_count execSQL($sql_count);
                        list(
    $design_numrec)=mysql_fetch_row($rs_count);
                        
    $order_no=-+ ($page-1)*20;
                        
    $sql_design "SELECT md5(d.design_id) as design_id,
                                                d.member_name,
                                                design_title,
                                                design_url,
                                                design_code,
                                                design_image,
                                                design_discription,
                                                design_counter,
                                                design_price,
                                                design_createdate,
                                                design_ranking,
                                                design_position,
                                                design_previous_position,
                                                COUNT(comment_id) as comment_count,
                                                v.vote_createdate as vote,
                                                w.design_id as watch,
                                                r.report_id as report
                                            FROM ts_design d
                                            LEFT JOIN ts_comment c ON d.design_id=c.design_id AND c.comment_isview=1
                                            LEFT JOIN ts_vote v ON d.design_id = v.design_id AND vote_ip = '"
    .GetHostByName($REMOTE_ADDR)."'
                                            LEFT JOIN ts_design_watch w ON d.design_id=w.design_id AND w.member_id='
    $_SESSION[member_id]'
                                            LEFT JOIN ts_report r ON d.design_id=r.design_id AND r.member_id='
    $_SESSION[member_id]' AND r.type='design' ".
                                            
    $condition_design.
                                            
    " GROUP BY d.design_id
                                            ORDER BY 
    $order_by
                                            LIMIT 
    $offset,$limit";
                        
    /*$sql_design = "SELECT md5(d.design_id) as design_id,
                                                d.member_name,
                                                design_title,
                                                design_url,
                                                design_code,
                                                design_image,
                                                design_discription,
                                                design_counter,
                                                design_price,
                                                design_createdate,
                                                design_ranking,
                                                design_position,
                                                design_previous_position,
                                                COUNT(comment_id) as comment_count,
                                                DATEDIFF( CURDATE(), MAX( v.vote_createdate ) ) < 30 as vote,
                                                w.design_id as watch,
                                                r.report_id as report
                                            FROM ts_design d
                                            LEFT JOIN ts_comment c ON d.design_id=c.design_id AND c.comment_isview=1
                                            LEFT JOIN ts_vote v ON d.design_id = v.design_id AND vote_ip = '".GetHostByName($REMOTE_ADDR)."'
                                            LEFT JOIN ts_design_watch w ON d.design_id=w.design_id AND w.member_id='$_SESSION[member_id]'
                                            LEFT JOIN ts_report r ON d.design_id=r.design_id AND r.member_id='$_SESSION[member_id]' AND r.type='design' ".
                                            $condition_design.
                                            " GROUP BY d.design_id
                                            ORDER BY $order_by
                                            LIMIT $offset,$limit";*/
                        
    $rs_design execSQL($sql_design);
                        
    $pages=home_pagenavigator($page,$design_numrec,$limit,$page_size,"tsPageTitle"$pagenavigator_url);
                        
    $row_design mysql_fetch_array($rs_design);
                      
    ?>
                                    </td>
                      <tr>
                        <td height="10"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
    <td class="tsPageTitle" align="left" width="9">&nbsp;</td>
                            <td class="tsPageTitle" align="left" valign="bottom"><?=$pages?></td>
                            <td class="tsPageTitle" align="right" valign="bottom">Total: <?= plural($design_numrec$site_word?></td>
                          </tr>
                        </table>
                        </td>
                      </tr>
                      <tr>
                      <?
                        
    while($row_design){
                      
    ?>
                        <td><table width="100%" border="0" cellspacing="10" cellpadding="0">
                          <tr>
                            <?
                            $order_no 
    $order_no 2;
                            for(
    $i=0;$i<2;$i++){
                                
    $row_design[design_discription] = nl2br($row_design[design_discription]);
                                
    $row_design[design_image] = "<a href='design_hit.php?design_id=$row_design[design_id]&design_url=$row_design[design_url]$site_pid' target='_blank'><img src='img/design/$row_design[design_image]' style='border-color:#FFFFFF; border-width:1px' align='absmiddle' alt='$site_word #: $row_design[design_code]
    Member ID: 
    $row_design[member_name]'>";
                              
    $design_order $use_design_position $row_design['design_position'] : $order_no+$i;
                            
    ?>
                            <td width="50%" align="left"><table width="294" height="275" border="0" style="PADDING-RIGHT: 1px; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; PADDING-TOP: 1px;" background="http://www.theshirtlist.com/images/thumb.gif">
                              <tr>
                                <td colspan="3" class="tsLink" align="center" height="23"><a href="design_hit.php?design_id=<?=$row_design[design_id]?>&design_url=<?=$row_design[design_url]?><?=$site_pid?>" class="tsLink" target="_blank"><?= htmlspecialchars($row_design[design_title]) ?></a></td>
                              </tr>
                              <tr>
                                <td align="center" width="54" height="160"><table width="52" height="99" border="0" cellpadding="0" cellspacing="0">
                                  <tr>
                                    <td height="99" align="center" valign="middle" background="images/ranking.gif" width="52">
                                    <table width="52" height="99" border="0" cellpadding="0" cellspacing="0">
                                      <tr>
                                        <td align="center" class="tsTitle"><font size="-5">&nbsp;</font><br>
                                        <font color="#FF0000" size="+1"><?=$design_order?></font></td>
                                      </tr>
                                      <tr>
                                        <td>&nbsp;</td>
                                      </tr>
                                      <tr>
                                        <td>&nbsp;</td>
                                      </tr>
                                    </table>
                                    </td>
                                  </tr>
                                  <tr>
                                    <td align="center"><table width="52" height="61" border="0" cellpadding="0" cellspacing="0"><tr><td align="center"><FONT face=arial size=2><B>Viewed:</B></FONT><BR>
                                      <FONT face=arial size=1><B>(<?=$row_design[design_counter]?>)</B></FONT></td></tr></table>
                                  </td>
                                      </tr>
                                         </table></td>
                                <td align="center" bgcolor="#FFFFFF"><table width="190" height="160" border="0" cellpadding="0" cellspacing="0"><tr><td align="center"><?=$row_design[design_image]?></td></tr></table></td>
                                <td align="center" width="30"><table width="30" height="99" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                  <td height="61" align="center" valign="middle">
                  <?
                                
    if($row_design['vote']!=1)
                                {                                
    ?>
                    <FONT face=arial size=3><B><A class="tsLink" onClick="return openwin500500('design_vote.php?design_id=<?=$row_design[design_id]?>')" href="<?=$base_url?>">V<BR>O<BR>T<BR>E</A></B></FONT>
                            <?
                        
    ?>
                                </td>
                </tr>
                                  <tr>
                                    <td height="61" align="center" valign="middle">
    <table width="100%" height="61" border="0" cellpadding="0" cellspacing="0"><tr><td align="center">
    <img src="images/<?
    if($use_arrow_images)
        if((
    $row_design[design_previous_position]>=$row_design[design_position]) || ($row_design[design_previous_position] == "0"))
            echo 
    "uparrow";
        else
            echo 
    "downarrow";
    else
        echo 
    "even"?>.gif" width="29" height="29"></td></tr></table>
                                                                    </td>
                                  </tr>
                                </table></td>
                              </tr>
                              <tr>
                                <td height="37" colspan="3" valign="top" class="tsDes" align="center"><?=$row_design[design_discription]?>                            </td>
                               </tr>
                       <tr>
                           <td height="18" colspan="3" align="center" class="tsLink1"><B>[</B><A class="tsLink1" onClick="return openwin500500('design_comment.php?design_id=<?=$row_design[design_id]?>')" href="<?=$base_url?>"><?= plural($row_design['comment_count'], "Comment"?></a><B>]</B>
                        <?
                        
    if($_SESSION[tshirt_name])
                        { 
    ?>
    - <B>[</B><A class="tsLink1" onClick="return openwin500500('design_email.php?design_code=<?=$row_design[design_code]?>&design_title=<?= urlencode($row_design[design_title]) ?>&member_name=<?=$row_design[member_name]?>')" href="<?=$base_url?>">E-mail</a><B>]</B>
                                        <?
                                        
    if($row_design['watch']=='')
                                        {    
    ?>
    - <B>[</B><A class="tsLink1" href="designs_watching.php?add=1&design_id=<?=$row_design[design_id]?>&back=<?= urlencode($_SERVER['REQUEST_URI']) ?>">Watch</a><B>]</B>
                                            <?
                                        
    }
                                        if(
    $row_design['report']=='')
                                        {    
    ?>
    - <B>[</B><A class="tsLink1" onClick="return openwin500500('report.php?design_id=<?=$row_design[design_id]?>')" href="<?=$base_url?>">Report</a><B>]</B>
                                            <?
                                        
    }
                                    }
                                    else
                                    { 
    ?>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="tsLink" style="color:red" href="my_account.php">NOT LOGGED IN</a>
                                        <?
                                    
    ?>
                                    </td>
                       </tr>
                     </table></td>
                             <?
                                      $row_design 
    mysql_fetch_array($rs_design);
                                        if(!
    $row_design) break;
                                    }
    //endfor
                                    
    if(!$row_design){
                                        for(
    $k=$i+1;$k<2;$k++){

                             
    ?>
                            <td width="50%"><table width="250" height="250" style="BORDER-RIGHT: gray 2px dashed; PADDING-RIGHT: 1px; BORDER-TOP: gray 2px dashed; PADDING-LEFT: 1px; PADDING-BOTTOM: 1px; BORDER-LEFT: gray 2px dashed; PADDING-TOP: 1px; BORDER-BOTTOM: gray 2px dashed">
                            </table></td>
                            <?
                                     
    }
                                }
                            
    ?>
                            </tr>
                        </table></td>
                      </tr>
                      <?
                        
    }//end while
                      
    ?>
                      <?
                      
    if(!$design_numrec){
                      
    ?>
                      <tr>
                        <td height="50" align="center" class="tsTitle"><font color="#FF0000"><br><br>No <?=$site_title?> <?=$site_word?>s!<br><br><br><br></font></td>
                      </tr>
                      <?
                      
    }
                      
    ?>
                      <tr>
                        <td height="5"></td>
                      </tr>
                      <tr>
                        <td height="20"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                          <tr>
                            <td class="tsPageTitle" align="left" width="9">&nbsp;</td>
                            <td class="tsPageTitle" align="left" valign="bottom"><?=$pages?></td>

                            <td align="right" valign="top" class="tsPageTitle">Total: <?= plural($design_numrec$site_word?></td>
                          </tr>
                        </table>
                        </td>
                      </tr>
                    </table></td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    <!--
    DO NOT MAKE ANY CHANGES OR REMOVE THE CODE BELOW.  MODIFYING OR REMOVING THE CODE BELOW WILL VIOLATE THE CONDITIONS OF THE SCRIPT THAT YOU AGREED TO WHEN PURCHASING THE SCRIPT.  THIS CODE MUST STAY INTACT AND WORK PROPERTLY ON THE WEBSITE.
    -->
      <? include"include/bottom.php"?>
    <!--
    DO NOT MAKE ANY CHANGES OR REMOVE THE CODE ABOVE.  MODIFYING OR REMOVING THE CODE ABOVE WILL VIOLATE THE CONDITIONS OF THE SCRIPT THAT YOU AGREED TO WHEN PURCHASING THE SCRIPT.  THIS CODE MUST STAY INTACT AND WORK PROPERTLY ON THE WEBSITE.
    -->
    </table>


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 05:42 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com