Jump to content
MakeWebGames

[HELP][V2]I need Mod Help [I Know I'm in Wrong Forum]


CainFool

Recommended Posts

I know I'm in the wrong forum, I just wanted to grab attention here first, but if any moderator wants it moved, move it, I just want some attention as this is a-needed mod for my game.

I'm looking to display a javascript alert when users go to loggedin.php, yes?

Well if I put it into the header, it will come up on every single page, won't it!

I'm not 100% what include_once is, but here is the code I have in my header after include('globals.php');

include_once('alert.php');

And in my alert file, it shows:-

<?php
echo "<body onload='javascript:alert('testing')'>";
?>

 

Basically I am going to hook this up to a database so in my Staff Panel I can change "testing" by the database (I can do that)

But I think I need include_once explained first.

Does that mean that it will only show the page once following your cache?

I do need help, yes this is a long post.

But when I go onto my game, I get a PHP Error inside the alert.php file,

I'm sure it's easy to spot, but if you seen my other modifications I am quite a noob. ::)

So if anybody can help me it would be appreciated, thanks!

(ps, I can do databases and hook it up, so it's okay.)

Note: If you seen in my header text script, you seen I used the table "header" well i'm going to use "footer" (another.. table, is it?) inside "header" and use that and basically use the same stuff from the header text mod.

Alright,

here's a summary what I need.

  • Whats wrong with my alert.php file
  • include_once explained noob way

Thanks!

Also if I can't do it by include_once, can you tell me another way?

Link to comment
Share on other sites

Re: [HELP][V2]I need Mod Help [i Know I'm in Wrong Forum]

Okay here's a little update,

<?php
$name = mysql_fetch_object($db->query("SELECT `footer` FROM `header`"));
echo sprintf("<body onload='javascript:alert(%s);'>
",stripslashes($name->text));
?>

 

I did some editing there, and now I get this:-

Fatal error: Call to a member function query() on a non-object in ***/alert.php on line 2

Link to comment
Share on other sites

Re: [HELP][V2]I need Mod Help [i Know I'm in Wrong Forum]

Sorry for triple post, but i'm getting somewhere.

 

<?php
include('globals.php');

$name = mysql_fetch_object($db->query("SELECT `footer` FROM `header`"));
echo sprintf("<body onload='javascript:alert(%s);'>
",stripslashes($name->footer));
?>

 

Comes up with my main game template, with nothing in where the content usually is. Just blank.

In my table "footer", I have "testing" wrote in it. Any suggestions?

Link to comment
Share on other sites

Re: [HELP][V2]I need Mod Help [i Know I'm in Wrong Forum]

 

<?php
include_once('globals.php'); 
//Include once which mean's that 
//if globals.php is including globals.php again 
//it won't and no error's will be displayed 
//(thats what i think if im wrong some one prove me);

$content = mysql_query('SELECT `footer` FROM `header`');
$content = mysql_fetch_object($name);
echo '<body onload="alert(\''.$content->footer.'\');">';

?>
Link to comment
Share on other sites

Re: [HELP][V2]I need Mod Help [i Know I'm in Wrong Forum]

Alright, here's a brief description what I want to happen.

Depending on their cookies, I want a Javascript alert to come up when they login.

So it's only going to come up once because my website is already viewed in their cookies.

Getting what I mean?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...