News:

CPG Release 1.6.28
added submissions from {406man}
cleaned up a few PHP (8.4) deprecations
fixed PHP deprecation in calendar
removed security vulnerability
(please upgrade when possible)

Main Menu

signature code like mine...

Started by Deus, October 12, 2005, 01:15:59 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Deus

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.
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Rush_To_Me

 ;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

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

Tranz

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

Rush_To_Me

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

<?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

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

Deus

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

Rush_To_Me

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:

Quote from: Deus on January 27, 2006, 10:05:52 AM
Thanks TranzNDance for helping where I cannot.

Thank you very much

Regards
Manuel

Rush_To_Me

 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

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.

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

Rush_To_Me

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:

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???


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

i believe you just add 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.
https://daz-stuff.uk
DJ tutorials, E-Bikes, Movies and videogames.
(https://daz-stuff.uk/daz/signature.png)

Abbas Ali

One very basic mistake in above given code.

Quote from: Rush_To_Me on January 27, 2006, 07:59:00 AM

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.
Chief Geek at Ranium Systems

Deus

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

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

Tranz

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.

Rush_To_Me

 ;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

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.
Chief Geek at Ranium Systems

Rush_To_Me

#37
Quote from: TranzNDance 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.

Quote from: Abbas Ali 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.

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

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.
Chief Geek at Ranium Systems

Abbas Ali

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
Chief Geek at Ranium Systems