PDA

View Full Version : Gah! Hacking woes...


Ember
01-29-2003, 01:39 PM
Ok, I have myself stuck again, here is what I have:

In functions.php


if ($post['showpet']!="0") {
eval("\$post[petbit] = \"".gettemplate("petbit")."\";");
} else {
$post[showpet] = " ";
}


Along with all the rest of my pet hack stuff - I've added ^^^ that stuff above it.

Then I have added a new template called petbit and posted what was previously in the postbit tempate into it.

Then I have added $post[showpet] into the postbit.

I also have a new field in the user CP called showpet and in that I have "0"....

What should happen is it should see that showpet is set to 0 and then show the petbit... but it doesnt, it shows nothing.

Then if I change whats in the showpet field to 1 - it shows the one (when its set to 0 it shows nothing)

Any ideas what the problem is? :D:D

geniuscrew
01-29-2003, 01:45 PM
Can members change this value?

Ember
01-29-2003, 02:07 PM
They will be able to yes.

Ember
01-29-2003, 02:12 PM
Edit that - they cant edit it directly - it will either be "0" or "1"

geniuscrew
01-29-2003, 05:39 PM
Like I said, see if

changing

if ($post['showpet']!="0") {

to


if ($post['showpet']!=="0") {

does anything.

Knowing me, it probably won't lol

Boofo
01-29-2003, 06:18 PM
Shouldn't that be?

if ($post['showpet']!=0) {
eval("\$post[petbit] = \"".gettemplate("petbit")."\";");
} else {
$$post[petbit] = "";
}

Ember
01-29-2003, 06:56 PM
ok, here's an update on the problem...

I have it storing a 0 or a 1 into the database now, which is good..

then i use $post[petbit]

it should show the template called petbit - thats goin on this bit of code:


if ($post['showpet']!=="0") {
eval("\$post['petbit'] = \"".gettemplate("petbit")."\";");
} else {
$post[showpet] = "";
}


However, it either shows nothing when the user has it on "yes" (0) or a 1 when they have it on "no" (1)

Any ideas?

Boofo
01-29-2003, 06:59 PM
Did you try the code I posted above?

Ember
01-29-2003, 07:05 PM
if ($post[showpet]!=0) {
eval("\$post[petbit] = \"".gettemplate("petbit")."\";");
} else {
$post[showpet] = "";
}


Thats what I have now - still isnt working... :'(

Ember
01-29-2003, 07:10 PM
Originally posted by Boofo
Did you try the code I posted above?

After removing the extra $ - I now have it displaying a "0" if they have selected "yes" and a "1" if they have selected "no".... so how can I get it to include the petbit template if its a "0" and nothing if its a "1"???

Ember
01-29-2003, 07:12 PM
Scrap that, I think i got it...

Boofo
01-29-2003, 07:14 PM
Try this:

if ($post[showpet]!=0) {
eval("\post[petbit] = \"".gettemplate("petbit")."\";");
} else {
$post[petbit]= "";
}

Ember
01-29-2003, 07:15 PM
edit:

Ok... so I now have it showing the petbit ok, but the stats dont show for each person... it shows blank stats, do I have to change the information in the petbit template to $post[php] for the pet hp etc.?

Ember
01-29-2003, 07:19 PM
GAWD. More trouble than its bloody worth...

It only selects wether to show YOUR pet... not EVERYONES :'(

*gives up*

*goes home*

*comes back to see if anyone can help*

Boofo
01-29-2003, 07:21 PM
First of all, what code did you finally get it to work with? Second, what are the contents of the template?

Ember
01-29-2003, 07:27 PM
Here's what I put to make it work:


if ($post['showpet']!=0) {
eval("\$post[petbit] = \"".gettemplate("petbit")."\";");
} else {
$post[petbit] = "";
}


and then this is the content of the template:


<table cellspacing="0" width="100%" cellpadding="1" style="border-left:1px solid {tablebordercolor}; border-top:1px solid {tablebordercolor};">
<tr>
<td colspan="2" bgcolor="$post[backcolor]" style="border-right:1px solid {tablebordercolor}; border-bottom:1px solid {tablebordercolor};"><smallfont>$post[username]'s pet - <b> $post[petname]</b></smallfont></td>
</tr>
<tr>
<td colspan="2" style="border-right:1px solid {tablebordercolor};">
<smallfont>
<b>Type:</b> $pettype1 <br>
<b>Gender:</b> $post[petgender1]
</td>
</tr>
<tr>

<td bgcolor="$post[backcolor]" style="border-bottom:1px solid {tablebordercolor};" width="50">
<smallfont><center>
<img src="images/pets/$post[pettype1]$post[petgender1].gif"></img>
</td>
<td style="border-right:1px solid {tablebordercolor}; border-bottom:1px solid {tablebordercolor};"><smallfont>
<b>Level: $pshowlevel<br>
HP: $php / $pmaxhp
<table width="90" style="border:1px solid {tablebordercolor};" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="$post[backcolor]"><img src="images/bar/pbhg.gif" width="$phpf%" height="5"><img src="images/bar/pbhb.gif" width="1" height="5"></td>
</tr>
</table>
Exp: $pep%
<table style="border:1px solid {tablebordercolor};" width="90" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="$post[backcolor]"><img src="images/bar/pbxg.gif" width="$pep%" height="5"><img src="images/bar/pbxb.gif" width="1" height="5"></td>
</tr>
</table>
</table>


It shows the users petname up fine... other than that its a no show!

Boofo
01-29-2003, 07:39 PM
Here's the line for the image, right?

<img src="images/pets/$post[pettype1]$post[petgender1].gif"></img>

Is it not showing the image or none of the template?

Ember
01-29-2003, 07:44 PM
I changed that to try to get it to work (it didnt)

the original was... $pettype$petgender.gif

i changed it to what you quoted in an attempt to get it to work.

Ember
01-29-2003, 07:45 PM
Its showing the template ok... but not showing the pet gender or type - or the pet stats.

Boofo
01-29-2003, 07:48 PM
Originally posted by Ember
I changed that to try to get it to work (it didn't)

the original was... $pettype$petgender.gif

i changed it to what you quoted in an attempt to get it to work.

What I quoted is what you have in the code you posted above. :) Why don't you just call the images directly? Do you need the gender and type if you already have a different name for each one?

If you want, send me all the code you have for the hack and I will see if I can get it going.

Ember
01-29-2003, 07:52 PM
I cant call the images directly, as the image used it based on what type of pet they have and what gender it is... so if its a male frog, the image will be FrogMale.gif - see? My e-mail is down at the moment, but post your address and I will send it tomorrow!

Boofo
01-29-2003, 07:57 PM
pm it to me on here.

Ember
01-29-2003, 08:02 PM
Ok done, there are a few template modifications too, i will put them into a text and send them as well.

geniuscrew
01-30-2003, 10:10 AM
Ember try these:

if ($post['showpet']) {

or

if ($post['showpet'] == 0) {

I think the first might work, but trial and error is the key!

Ember
01-30-2003, 08:27 PM
We've got it to show now, thats not the problem.

But its only showing that users personal preference to display their own pet (which is quite cool, but not what I wanted)

I am gonna clone the signature options, and try using them.