What have i changed that made my images not load

This is where you share YOUR scripts with others

Moderators: egami, macek, gesf

Post Reply
Artraifi
New php-forum User
New php-forum User
Posts: 2
Joined: Mon Oct 30, 2017 1:54 pm

Mon Oct 30, 2017 2:03 pm

Dear Al,

I have recently changed my functions.php under cpanel home directory. Please view the php source code below, specifically the bolded section:

function banner(){
## Actual Language
$lang = (!empty($this->data['lang']))? $this->data['lang'] : 1;
## Actual page
$page = (!empty($this->data['id']) && is_numeric($this->data['id']))? $this->data['id'] : 1;
## Artikull
$artikull = (!empty($this->data['a']) && is_numeric($this->data['a']))? $this->data['a'] : 0;

if(!empty($artikull)){
$s = $this->db->query("SELECT `img` FROM `artikujt` WHERE id = ".$artikull." AND lang = ".$lang." ORDER BY `id` ASC LIMIT 1");
}else{
$s = $this->db->query("SELECT `img` FROM `artikujt` WHERE kategoria = ".$page." AND lang = ".$lang." ORDER BY `data` DESC LIMIT 1");
}
if(mysql_num_rows($s) > 0){
$data = mysql_fetch_assoc($s);
if(!empty($data['img']) && $data['img'] != '#'){
return '<a href="?id=4&album=28&lang=1"><img src="/public_html/cms/data/669a789d844c6ed78d0efdf450c75b68.png" width="970" alt="" /></a>';
}else{
return;
}
}
return false;

P.S. the folder categories which links to the images is as follows
Public_html/data/img-name.jpg

I would really appreciate some guidance and im willing to provide additional info for some help!

User avatar
hyper
php-forum Fan User
php-forum Fan User
Posts: 583
Joined: Mon Feb 22, 2016 5:52 pm

Mon Oct 30, 2017 5:35 pm

I'm willing to provide additional info for some help
With an offer like that, how can I refuse. And fyi, Al doesn't post here any more.

There are two ways you can go from reading your post (and not fully understanding it), change your functions.php file back to the old one that worked (not recommended), or, learn to use PDO and update your script (recommended), the code you are using is insecure and out of date.

What errors are you getting when you run your script? (I'm sure that there are no prizes for guessing, or offers of code.)

If I'm really off base with this one, and haven't even come close to guessing what is wrong; can you explain what problems you are having - what is and what isn't working.

Artraifi
New php-forum User
New php-forum User
Posts: 2
Joined: Mon Oct 30, 2017 1:54 pm

Mon Oct 30, 2017 10:09 pm

My apologies, the problem is that when edditing the php code, i changed the entire return '<a href... section bolded in the above forum post.

Once i did that, i have not only lost the banner but also images from a slider on a completly different page. I do not remember what was in place - so that i can revert it to its previous state.

Sorry for sounding rude and i ment To write All*. Thank you for your help it is greatly appreciates.

User avatar
hyper
php-forum Fan User
php-forum Fan User
Posts: 583
Joined: Mon Feb 22, 2016 5:52 pm

Tue Oct 31, 2017 11:10 am

Sorry for sounding rude and I meant To write All*.
I was just having a bit of fun and pulling your leg.

There's very little we can do to find out what the file was or where it was before you changed it, however, have you searched for the files on your system to find their location?

Did you read the error messages?

I still recommend changing your script to PDO, once your server upgrades to PHP 7, your script will fail; it makes sense to change it now while you are learning and having problems with your current script.

Post Reply