Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: 1 [2] 3 4   Go Down

Author Topic: signature code like mine...  (Read 67023 times)

0 Members and 1 Guest are viewing this topic.

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
Re: signature code like mine...
« Reply #20 on: January 27, 2006, 06:34:44 am »

ok, valid questions...
its definetely the database name, (could be database user, as my db user and db name are the same) database password - not cpg password, and data base name again.

Yes it works on bridged setup.

one thing i have noticed too, it wont take images from private albums unless you tell it to by using the pic#.jpg #=album number.
Logged
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Rush_To_Me

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 17
  • Crazy Mechanic Engineer
    • Enlaces Digitales
Re: signature code like mine...
« Reply #21 on: January 27, 2006, 06:54:21 am »

 ;D Thank you very much that helped

However if you try this www.enlaces-digitales.com/gallery/pic.php doesn't load any image if you see hard enough :P you can see a partial "w" to my website

do i have to add some code to the filepath question?

Thanx again in advanced and thank you very for both things the mod & support ;D

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
Re: signature code like mine...
« Reply #22 on: January 27, 2006, 07:38:41 am »

i'm not sure whats going on there... maybe a code junkie could help please?
Logged
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: signature code like mine...
« Reply #23 on: January 27, 2006, 07:50:50 am »

Could you post the code you are using, and star out confidential information?
Logged

Rush_To_Me

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 17
  • Crazy Mechanic Engineer
    • Enlaces Digitales
Re: signature code like mine...
« Reply #24 on: January 27, 2006, 07:59:00 am »

Sure.. the only difference is th URL....  ;D

Code: [Select]
<?php

define
('IN_COPPERMINE'true);
define('INDEX_PHP'true);

require(
'include/init.inc.php');
header('content-type: image/jpeg');

$mlink=mysql_connect('localhost','DATABASE''PASSWORD');
mysql_select_db('DATABASE'$mlink);
$sum_x=4;
$pos=4;

if(isset($_GET['q'])) {
$q=$_GET['q'];
} else {
$q=3;
}

if(isset($_GET['alb'])) {
$pics=mysql_query("select filepath, filename from cpg_pictures where aid=".$_GET['alb']." and pwidth>0 order by rand() limit 0,$q");
} else {
$pics=mysql_query("select filepath, filename from cpg_pictures, cpg_albums where cpg_albums.aid=cpg_pictures.aid and pwidth>0 and visibility=0 order by rand() limit 0,$q");
}
if(isset($_GET['txt'])) {
$txt=$_GET['txt'];
} else {
$txt="www.Enlaces-Digitales.com";
}


while($pr=mysql_fetch_array($pics)) {
$fname[]="albums/".$pr['filepath']."thumb_".$pr['filename'];
list($width$height$type$attr) = getimagesize("albums/".$pr['filepath']."thumb_".$pr['filename']);
$sum_x+=$width+4;
$ix[]=$width;
$im[]=imagecreatefromjpeg("albums/".$pr['filepath']."thumb_".$pr['filename']); //echo "albums/".$pr['filepath']."thumb_".$pr['filename']."--";
}

$im_total = @imagecreatetruecolor($sum_x128);
for($pn=0$pn<$q$pn++) {
imagecopy($im_total$im[$pn], $pos400$ix[$pn], 120);
$pos=$pos+$ix[$pn]+4;
}
$pos=$pos-$ix[$pn]-4;
//imagecopy($im_total, $im[1], $pos, 4, 0, 0, $ix[1], 120);
//$pos=$pos+$ix[1]+4;
//imagecopy($im_total, $im[2], $pos, 4, 0, 0, $ix[2], 120);

$textcolor imagecolorallocate($im_total255255255);
$last_x=max($pos,168);
imagefilledrectangle($im_total$last_x-168111$last_x+21260);
imagestring($im_total4$last_x-166111$txt$textcolor);
imagejpeg($im_total);

?>

AS you can see it's the same code....

Regards

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: signature code like mine...
« Reply #25 on: January 27, 2006, 08:09:26 am »

And you added the .htaccess file? If so, are you certain the server allows for mod rewrite?
Logged

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
Re: signature code like mine...
« Reply #26 on: January 27, 2006, 10:05:52 am »

Thanks TranzNDance for helping where I cannot.
Logged
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Rush_To_Me

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 17
  • Crazy Mechanic Engineer
    • Enlaces Digitales
Re: signature code like mine...
« Reply #27 on: January 27, 2006, 07:07:45 pm »

Yes i uploaded the .htacces file, but how can i know tha my webserver allows mod rewrite? is there something tu run like phpinfo()

Altough is uploaded in the root of my site or the galler...  ??? (kinda new here  ;D)

And as Deus pointed:

Thanks TranzNDance for helping where I cannot.

Thank you very much

Regards
Manuel

Rush_To_Me

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 17
  • Crazy Mechanic Engineer
    • Enlaces Digitales
Re: signature code like mine...
« Reply #28 on: January 27, 2006, 07:27:38 pm »

 8) I want to apologize to post so quickly, i found that the webserver allows the mod rewrite.. I'll show you how i noticed it :P


In deus's first post:

http://www.ripoffbritain.org/wallpaper/pic75/5/www.ripoffbritain.org.jpg If you try this and put another thing in the www.domain.com you can change it..

In my site http://www.enlaces-digitales.com/gallery/pic5/5/www.ripoffbritain.org.jpg you can do it too, (the problem is that the rectangle is so small... i think).

Sorry for this post

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
Re: signature code like mine...
« Reply #29 on: January 27, 2006, 07:54:54 pm »

well, I can tell you, its nothing to do with the database access, I've just entered for username "Any", Database "any", and password "any" so its not a typo in there.!! LOL
My suggestion would be to now ask your webhost to tell you if that mod rewrite is enabled for you, if not, ask them if they could enable it.

Logged
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Rush_To_Me

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 17
  • Crazy Mechanic Engineer
    • Enlaces Digitales
Re: signature code like mine...
« Reply #30 on: January 28, 2006, 12:13:32 am »

first of all i enter the panel and i saw that the hotlinking feature was enable, after that i took a look to the .htaccess from there an i found this:

Code: [Select]
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://enlaces-digitales.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://enlaces-digitales.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.enlaces-digitales.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.enlaces-digitales.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.enlaces-digitales.com/gallery/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.enlaces-digitales.com/gallery$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.enlaces-digitales.com/gallery/albums/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.enlaces-digitales.com/gallery/albums$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.google.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.google.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.google.com.mx/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.google.com.mx$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ www.juras.com [R,NC]

Do i have to deactivate this feature and add the lines or can just add the lines???

Code: [Select]
RewriteEngine on
RewriteRule ^([^/\&\?]*)pic\.jpg$ pic.php?$1
RewriteRule ^([^/\&\?]*)pic([0-9]*)\.jpg$ pic.php?alb=$2
RewriteRule ^([^/\&\?]*)pic([0-9]*)/([0-9]*)/(.*)\.jpg$ pic.php?alb=$2&txt=$4&q=$3
RewriteRule ^([^/\&\?]*)pic([0-9]*)/(.*)\.jpg$ pic.php?alb=$2&txt=$3

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
Re: signature code like mine...
« Reply #31 on: January 28, 2006, 09:14:42 am »

i believe you just add
Code: [Select]
RewriteRule ^([^/\&\?]*)pic\.jpg$ pic.php?$1
RewriteRule ^([^/\&\?]*)pic([0-9]*)\.jpg$ pic.php?alb=$2
RewriteRule ^([^/\&\?]*)pic([0-9]*)/([0-9]*)/(.*)\.jpg$ pic.php?alb=$2&txt=$4&q=$3
RewriteRule ^([^/\&\?]*)pic([0-9]*)/(.*)\.jpg$ pic.php?alb=$2&txt=$3
to the htaccess, try it anyway, it cant hurt.
Logged
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: signature code like mine...
« Reply #32 on: January 28, 2006, 10:01:11 am »

One very basic mistake in above given code.

Code: [Select]
if(isset($_GET['alb'])) {
$pics=mysql_query("select filepath, filename from cpg_pictures where aid=".$_GET['alb']." and pwidth>0 order by rand() limit 0,$q");
} else {
$pics=mysql_query("select filepath, filename from cpg_pictures, cpg_albums where cpg_albums.aid=cpg_pictures.aid and pwidth>0 and visibility=0 order by rand() limit 0,$q");
}

In all queries cpg_ should be replaced by the prefix you are using. This should solve the problem.
Logged
Chief Geek at Ranium Systems

Deus

  • Contributor
  • Coppermine frequent poster
  • ***
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 153
    • DJ-Daz
Re: signature code like mine...
« Reply #33 on: January 28, 2006, 11:54:02 am »

er... Hi Abbas, thanks for helping out here :D and helping get my site sorted.

Deus.
Logged
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: signature code like mine...
« Reply #34 on: January 28, 2006, 03:16:31 pm »

Good find, Abbas.

@Deus, what you can do is replace references to the tablenames with variables like these: {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_ALBUMS']}

It will take into account the user's table prefix. This would make your code work regardless of mysql setup.
Logged

Rush_To_Me

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 17
  • Crazy Mechanic Engineer
    • Enlaces Digitales
Re: signature code like mine...
« Reply #35 on: January 28, 2006, 11:25:37 pm »

 ;D Thank you very much Abbas but i can't geit it to work i've just changed the prefix to cpg143_ Because um using that version... :P

Thank you all ... i think i found the problem, it's Cpanel... if i use the hotlinking feature it mess up my settings so what i did was:

1. Change the prefix in pic.php  @Thank you Abbas.
2. Disable the hotlinking feature from CPanel.
3. Put my own .htaccess
But guess.... nothing happended   :'(

It shows a tiny vertical rectangle with a partial "w"

I have CPG configured in spanish... does the installation be different for the language???

Thanx again

Manuel

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: signature code like mine...
« Reply #36 on: January 30, 2006, 06:14:55 am »

If you have updated from cpg1.3.5 to cpg1.4.3 then your prefix would still be cpg135_ since upgradation doesn't change the prefix. I would recommend to use the method suggested by TranzNDance.... i.e. replace cpg_pictures with {$CONFIG['TABLE_PICTURES']} etc... in all queires.
Logged
Chief Geek at Ranium Systems

Rush_To_Me

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 17
  • Crazy Mechanic Engineer
    • Enlaces Digitales
Re: signature code like mine...
« Reply #37 on: January 31, 2006, 01:08:25 am »

Good find, Abbas.

@Deus, what you can do is replace references to the tablenames with variables like these: {$CONFIG['TABLE_PICTURES']}, {$CONFIG['TABLE_ALBUMS']}

It will take into account the user's table prefix. This would make your code work regardless of mysql setup.

If you have updated from cpg1.3.5 to cpg1.4.3 then your prefix would still be cpg135_ since upgradation doesn't change the prefix. I would recommend to use the method suggested by TranzNDance.... i.e. replace cpg_pictures with {$CONFIG['TABLE_PICTURES']} etc... in all queires.

Done i wasnt reading with attention until i found Abbas Post, i did that and the rectangle wont open wide enough to display the photos ;(

By the way my CPG its 143 Fresh, i mean i didn't upgrade it

Again Thankx a lot..

Manuel

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: signature code like mine...
« Reply #38 on: January 31, 2006, 12:28:43 pm »

I don't know what to suggest.... may be we need to debug that script. If you want you can you PM me your site access so that i can take a look.
Logged
Chief Geek at Ranium Systems

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: signature code like mine...
« Reply #39 on: February 01, 2006, 07:05:57 am »

After debugging i found that mysql_query() function was failing and hence was causing problem. I replaced mysql_query() with cpg_db_query() and it started working. I think now Rush_To_Me's script is working....

Abbas
Logged
Chief Geek at Ranium Systems
Pages: 1 [2] 3 4   Go Up
 

Page created in 0.033 seconds with 19 queries.