Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)

Reply
 
Thread Tools Display Modes
  #11  
Old 01-28-2005, 02:56 PM
agiacosa agiacosa is offline
 
Join Date: Dec 2004
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the script link but you can't parse php inside of templates. How would I go about doing this?
Reply With Quote
  #12  
Old 01-28-2005, 05:38 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That script is cool, however it tags the links to route you to some sales farm or something.
Reply With Quote
  #13  
Old 01-28-2005, 08:15 PM
base's Avatar
base base is offline
 
Join Date: Apr 2002
Posts: 133
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by agiacosa
Thanks for the script link but you can't parse php inside of templates. How would I go about doing this?
from the script itself -

"...4. You can run this script as an include file within an existing PHP page, cutting-and-pasting the script into your own PHP page, or as a standalone page. If you choose to run it as a standalone page, you'll need to add the appropriate HTML around it in order for it to display properly (<HTML><HEAD><BODY> etc...)...."

like i said, use it with either vbacmps, or another hack which allows you to make your own php pages that show your header/footer etc.

Quote:
Originally Posted by noppid
That script is cool, however it tags the links to route you to some sales farm or something.
no it doesn't.
Reply With Quote
  #14  
Old 01-28-2005, 08:33 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well then what in the world is this for?

Code:
ereg_replace("<a href=\"","<a href=\"http://www.sealfans.net/store.php?target=http://www.cafepress.com",$line);
With that line in the links they go to netster, removing that part of the URL's sends the user to the proper cafepress store.

Looks like spyware or spamware to me, but that's just a guess. User beware.
Reply With Quote
  #15  
Old 01-29-2005, 02:08 PM
base's Avatar
base base is offline
 
Join Date: Apr 2002
Posts: 133
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i can't find that line of code in the script at all. maybe you have an error between the computer and your seat? :ermm:
Reply With Quote
  #16  
Old 01-29-2005, 02:26 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by base
i can't find that line of code in the script at all. maybe you have an error between the computer and your seat? :ermm:

This is obviously something he has control of and changed IMO cause he got busted hijacking peoples links. This is the script that was there yesterday...

Every Link was hijacked with...

http://www.sealfans.net/store.php??target=

The other possibility is that they got the script and posted it not having any real clue what the code did. Not for me to judge I guess, but the facts are the facts, that script was changed overnight.

PHP Code:
<?

/*
------------------------------------------
RANDOM CafePress ITEM DISPLAY SCRIPT 1.0.9
------------------------------------------
This script is designed to allow CafePress store owners to feature a random item from
any of their CafePress stores on any page of their own web site.

Created and copyright by admin@notonebit.com Feb-16-2003
Last modified: Sept-29-2004

This code is released under the terms of the GNU General Public License
A copy of the GPL can be found at http://www.gnu.org/copyleft/gpl.html

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

Please retain this message at the top of this script if you modify it in any way.
---------------------------------------------------------------------------------
INSTRUCTIONS:

1. First, your web server must have PHP 4.1.0 or later installed for this script to function properly.
You must also be able to run the fsockopen function.

2. This script has three functions. First, the update function will create a text file on your web
server that contains a list of items from the stores you specify. Run this script like
http://www.yourserver.com/cprand.php?update to update the text file anytime you add/change/delete
an item from any of the stores you've setup the script to use. I used a local text file to greatly
increase the speed of the script. By storing the file locally it saves several seconds on the execution
by reading a local text file versus having to contact CafePress each time the script gets called.
Trust me, it helps.

3. To run the script as a PHP file, comment out the line after "//for javascript use:" that begins
with echo, and uncomment the line after "//for php use:". You can then drop this code in an existing
PHP page, or use the PHP include function.

4. To run the script as a JavaScript comment out the line after "//for php use:" that begins
with echo, and uncomment the line after "//for javascript use:". Then in your HTML page, use the following
code: <script src="cprand.php"></script> making sure that the path to the file is correct.

5. You may need to create a blank text file named cpitemfile.inc (the file that stores the data) and also 
change its permissions to 666. Some servers will need this, others won't. Try skipping this step first and
if you get an error during the update, then create the file with these permissions.

6. Finally, make sure to rename this file with a .php extension.

A few notes:
The script was designed to let you put a product's image and description on any page of your web site.
I have designed it to change the image dimensions from CafePress' 150x150 to 100x100. Feel free to 
change this by either modifying, deleting, or commenting out the line, "$line = ereg_replace("150","100",$line);". I also
designed it to not display the price of a product. To have the script display the price, delete or comment
out the line, "$line = ereg_replace("<b>(.*)</b>","",$line);". For those of you using fbomb's custom CP store script,
you can have this script link the random item to the detail page for that item on fbomb's script, in fact this is this
scripts default behavior. To have the random item linked to your CafePress store, delete or comment out the line:
"$line = ereg_replace("prod.aspx\?","prod&",$line);" and change the line "$line = ereg_replace("<a href=\"","<a href=\"http://
www.yourwebsite.com/store.php?target=http://www.cafepress.com",$line);" to "$line = ereg_replace("<a href=\"","<a href=\"http://www.cafepress.com",$line);
".

-Scanman20

-------------- SCRIPT BEGINS AFTER THIS LINE -----------------------------------------------*/

// SET VARIABLES //
srand ((float) microtime() * 10000000);
$start = '<!-- ### Items ### -->';
$end = '<!-- ### end of ITEMS ### -->';
$stores = 'riderinfo';
$url = 'http://www.cafepress.com/' . $stores;
$itemfile = '/home/lakecs/vbg_photos/cpitemfile.inc';
$mode = $_SERVER['QUERY_STRING'];

if ($mode == "update") {
    echo "Beginning CP item file update...<br>\n";

    // connect to CP
    $reqheader = "GET /$stores HTTP/1.0\r\nHost: www.cafepress.com\r\nUser-Agent: MS Internet Explorer\r\n\r\n"; 
    $socket = @fsockopen("www.cafepress.com", 80, &$errno, &$errstr); 
    if ($socket) 
    { 
        fputs($socket, $reqheader); 
        while (!feof($socket)) 
        { 
            $cpfile .= fgets($socket, 4096); 
        } 
    } 
    fclose($socket);


    $items = eregi("$start(.*)$end", $cpfile, $cparray);

    $newcparray = split ("\n", $cparray[1]);

    foreach ($newcparray as $line) {
    if (strlen($line) > 100)
        {
        $newestcparray[] = $line;
        }
    }

    $handle = fopen($itemfile, "w");
    foreach ($newestcparray as $line) {
    $line = ereg_replace("<td align=\"center\" valign=\"top\"><p>","",$line);
    $line = ereg_replace("</td>","",$line);
    $line = ereg_replace("150","100",$line);
    $line = ereg_replace("<b>(.*)</b>","",$line);
//    $line = ereg_replace("\\$(.*)\r", "\r", $line);  // Uncomment to hide prices
    $line = ereg_replace("prod.aspx\?","prod&",$line); //this line is just used to integrate with custom store. delete to use regular cp store.
    if (eregi("<td colspan=3>",$line)) {unset ($line);}
    if (eregi("<tr>",$line)) {unset ($line);}
    $line = ereg_replace("<a href=\"","<a href=\"http://www.sealfans.net/store.php?target=http://www.cafepress.com",$line);
    $line = ereg_replace("src=\"/cp/img","src=\"http://www.cafepress.com/cp/img",$line);
    if (!empty($line)) {
        $lastcparray[] = $line;
        fwrite($handle, $line);
        }
    }
    fclose($handle);
    echo "CP item file update completed.\n";
}
else {
    $itemhandle = fopen($itemfile, "r");
    $itemarray = fread($itemhandle,filesize("$itemfile")); 
    fclose($itemhandle);
    $lastcparray = split ("\r", $itemarray);

    $item = $lastcparray[rand(0,count($lastcparray)-2)];
    $item = ereg_replace("[\x27]",'',$item);
    $item = trim($item);

    //for javascript use:
    //echo "document.write('<div align=\"center\">" . $item . "</div>');";

    //for php use:
    echo $item;
}
?>
Reply With Quote
  #17  
Old 01-29-2005, 02:41 PM
base's Avatar
base base is offline
 
Join Date: Apr 2002
Posts: 133
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

actually, that wasn't the script that i was referring to in my original post, it was the first one on the download page.
Reply With Quote
  #18  
Old 01-29-2005, 06:06 PM
noppid noppid is offline
 
Join Date: Mar 2003
Location: Florida
Posts: 1,875
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by base
actually, that wasn't the script that i was referring to in my original post, it was the first one on the download page.
Well that explains us not uderstanding each other.

It's still interesting how this seems to have played out. Others must have asked for the revision seen on that site to be posted.

Folks need to be aware of the difference.
Reply With Quote
  #19  
Old 01-29-2005, 06:22 PM
SVTBlackLight01's Avatar
SVTBlackLight01 SVTBlackLight01 is offline
 
Join Date: Jan 2003
Location: Texas
Posts: 504
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I threw together a quick Cafe Press store with the script at this link posted earlier. For being so simple it's not too bad. Check it out here
Reply With Quote
  #20  
Old 01-29-2005, 09:59 PM
Creed's Avatar
Creed Creed is offline
 
Join Date: May 2002
Location: The Matrix
Posts: 281
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very nice, happen to want to share with us? I'd really like to add it to my forums as well!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:35 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04841 seconds
  • Memory Usage 2,292KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete