View Full Version : Does anyone know PHP?


gemma86
24-08-2005, 22:20
I have a problem with a bit of PHP coding. It's a really simple piece, involving dynamic includes that I copied and pasted from a tutorial site, but I'm having a little problem with it and as I'm a complete novice, I haven't clue what's wrong.
Can anyone help?

Lurch
25-08-2005, 00:39
Er, yeah. I can see exactly what the problem is.

gemma86
25-08-2005, 00:42
I was going to see if anyone knew and would be able to help before I posted up the problem....

adaline
25-08-2005, 02:24
Show us what you got then gemma

widemonk
25-08-2005, 08:43
Is this what you're after. Say you have a series of webpages that all need the same title and navigation bar etc.

Now, you could have the same code on each page but if you update a menu item, you have update ALL your pages.

The alternative is to have a separate page, lets call it 'header' then just call it from each of your other pages

Start of each page

<?php
include($_SERVER['DOCUMENT_ROOT']."/header.htm");
?>

Rest of page

Now you can just update that 1 'header' page and all the other pages that call it are automatically updated.

Hope this is what you were after.

Skatiechik
25-08-2005, 09:09
That is static rather than dynamic though

sccsux
25-08-2005, 12:22
simple index.php.

Called with index.php?page=itemX



<?php
switch ($page) {
case "item1";
$content = "content1.php";
break;
case item2";
$content = "content2.php";
break;
case "item3";
$content = "content3.php";
break;
case item4";
$content = "content4.php";
break;
case "item5";
$content = "content5.php";
break;
case item6";
$content = "content6.php";
break;

default;
$content = "default.php";
}

include ("header.php");
include ("$content");
include ("footer.php");
?>


header.php:


<?php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>$Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<a href="?page=item1>Item1</a>-
<a href="?page=item2>Item2</a>-
<a href="?page=item3>Item3</a>-
<a href="?page=item4>Item4</a>-
<a href="?page=item5>Item5</a>-
<a href="?page=item6>Item6</a>
?>








footer.php:


<?php
</body>
</html>
?>



You'll need to customise the file "header.php" which contains html for your nav menu, etc. and the one called footer.php which closes all the open html tags from the header. Each content page can then be simple text (with html formatting if required) and saved as contentXX.php (add more case items in "index.php" as required).


I don't know if that makes sense?? It's far easier to do & show than it is to explain through text

Martin_s
25-08-2005, 13:03
Small note... the above script includes a bunch of syntax errors so you would need to check that it all was valid php syntax...

Not knocking the example though... just to avoid confusion of the "it doesn't work" variety.

sccsux
25-08-2005, 13:33
Originally posted by Martin_s
Small note... the above script includes a bunch of syntax errors so you would need to check that it all was valid php syntax...


Looking @ it now, it's a total *&%%$ UP:D.

A corrected version is below (with a minor addition):


index.php:


<?php
switch ($page) {
case "item1";
$title = "Content 1";
$content = "content1.php";
break;
case "item2";
$title = "Content 2";
$content = "content2.php";
break;
case "item3";
$title = "Content 3";
$content = "content3.php";
break;
case "item4";
$title = "Content 4";
$content = "content4.php";
break;
case "item5";
$title = "Content 5";
$content = "content5.php";
break;
case "item6";
$title = "Content 6";
$content = "content6.php";
break;

default;
$title = "Default Page";
$content = "default.php";
}

include ("header.php");
include ("$content");
include ("footer.php");
?>


header.php:


<?php
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><? echo $title ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<a href="?page=item1">Item1</a>-
<a href="?page=item2">Item2</a>-
<a href="?page=item3">Item3</a>-
<a href="?page=item4">Item4</a>-
<a href="?page=item5">Item5</a>-
<a href="?page=item6">Item6</a>


footer.php:


<?php
?>
</body>
</html>



Teach me not to rush things next time:thumbsup:.

Martin_s
25-08-2005, 14:35
Originally posted by sccsux
Teach me not to rush things next time:thumbsup:.
Heh... I couldn't exactly flame you because I'd be reminded of the upteen times I "might" have done something similar...

:)

sccsux
25-08-2005, 14:46
Originally posted by Martin_s
Heh... I couldn't exactly flame

Tis cold today, the warmth would've been welcome:hihi:.

gemma86
25-08-2005, 15:39
Right, I'm finally here to tell you what's wrong!

I've used a tutorial on another site:
http://codegrrl.com/tutorials/php/dynamic_includes.php

And this is my problem:
I've got it the site working, with the index file using the dynamic includes script, but, the ? feature doesn't work for me for some reason...

I was thinking, the idea of putting the pages in another directory is to hide them, so in my navigation, instead of having pages/blah.php, I thought it should probably be ?/blah.php or ?blah.php. Before I tried this, my navigation was set up to be pages/blah.php but putting in index.php?blah.php didn't work, and also it doesn't work using ?/blah.php or ?blah.php in the navigation. Using both of these directory methods, the header and footer stuff shows up, just not the main content that varies on the page, it's saying that the page cannot be found.

I hope someone understands that! If you want to have a look at what I've done so far, you can visit the site (http://www.starstruk.net/tom/index3.php). I've changed it back so the navigation is pages/blah.php

gemma86
25-08-2005, 15:40
Btw, thank you to you all who replied earlier!

gemma86
26-08-2005, 20:29
Um, help?

(sorry to be a pest and bump it up ;) )

sniperwookie
26-08-2005, 20:42
Originally posted by gemma86
Before I tried this, my navigation was set up to be pages/blah.php but putting in index.php?blah.php didn't work, and also it doesn't work using ?/blah.php or ?blah.php in the navigation. Using both of these directory methods, the header and footer stuff shows up, just not the main content that varies on the page, it's saying that the page cannot be found.

A quick look would suggest trying

/?blah

and not

/?blah.php

your code checks for the file at this line:

if(file_exists('pages/'.$page.'.php')){

which would mean you are trying to get

pages/blah.php.php

instead of

pages/blah.php

which doesn't exist.

gemma86
26-08-2005, 20:46
Originally posted by sniperwookie
A quick look would suggest trying

/?blah

and not

/?blah.php

your code checks for the file at this line:

if(file_exists('pages/'.$page.'.php')){

which would mean you are trying to get

pages/blah.php.php

instead of

pages/blah.php

which doesn't exist.

Ah, yes - what a silly mistake! I shall try it out! Thanks.

gemma86
26-08-2005, 21:39
Originally posted by sniperwookie
A quick look would suggest trying

/?blah

and not

/?blah.php

your code checks for the file at this line:

if(file_exists('pages/'.$page.'.php')){

which would mean you are trying to get

pages/blah.php.php

instead of

pages/blah.php

which doesn't exist.

That does work, but, because I have the header and footer on the index page and on all the other pages, I get the header and naviagtion twice... I'm guessing, in the navigation, I should just put ?blah, like on the end of the index.php, and also get rid of the header and footer from the other content pages....
*goes to try*

UPDATE: the navigation will have to be index.php?page
Sorry for rambling!

UPDATE AGAIN: Nope, ?page will work fine in the navigation, I just clicked on a link I forgot to change. :rolleyes:

sniperwookie
27-08-2005, 08:36
Cool! Glad it sorted it :)

gemma86
07-09-2005, 21:50
Yeah, I did have another problem, but I've solved it now, but it wouldn't let me delete the post :p

LL200
07-09-2005, 22:16
Originally posted by gemma86
Yeah, I did have another problem, but I've solved it now, but it wouldn't let me delete the post :p

hmm, thats annoying after i've just spent 10 minutes trying to work out what the heck you were on about ;)

gemma86
07-09-2005, 22:18
Originally posted by LL200
hmm, thats annoying after i've just spent 10 minutes trying to work out what the heck you were on about ;)
lol, sorry!
The problem was me being generally thick, and forgetting to upload the now named .php pages, rather than there being the .htm pages still in the directories ;)

KenDodd
07-09-2005, 22:23
As a side note, you can implement similar header/footer and navigation bar features using server-side includes, without the need for PHP, assuming the host server properly implements server-side SHTML parsing.

here sort of explains it

http://www.smartwebby.com/web_site_design/server_side_includes.asp

At its simplest, you create your regular content page, and then put the following tag where your navbar or whatever needs to go: <!--#include virtual="include.htm" --> and save the page as a .shtml (note the s) document, which instructs the server processes the include.

Then your include page, here 'include.htm' needs writing, which will contain the navbar/header, etc. And this can be done just using normal HTML mark-up. Then just updating the one page, again updates all content pages.

Admittedly it's a little off topic, but an alternative way of achieving a similar aim.

gemma86
07-09-2005, 22:25
Originally posted by KenDodd
As a side note, you can implement similar header/footer and navigation bar features using server-side includes, without the need for PHP, assuming the host server properly implements server-side SHTML parsing.

here sort of explains it

http://www.smartwebby.com/web_site_design/server_side_includes.asp

At its simplest, you create your regular content page, and then put the following tag where your navbar or whatever needs to go: <!--#include virtual="include.htm" --> and save the page as a .shtml (note the s) document, which instructs the server processes the include.

Then your include page, here 'include.htm' needs writing, which will contain the navbar/header, etc. And this can be done just using normal HTML mark-up. Then just updating the one page, again updates all content pages.

Admittedly it's a little off topic, but an alternative way of achieving a similar aim.

Would doing it that way allow it to be previewed on the computer before uploading it? I use dreamweaver and I can't preview a php page without setting up a testing server...

KenDodd
07-09-2005, 22:28
Sorry, no again, you'd have to set up a local server to test it. The only benefit is the coding is all HTML based.

LL200
07-09-2005, 22:28
glad you sorted it, i went through it a number of times thinking that there was nothing actually wrong :)

just as a minor aside, there -could- be a security issue with what you're doing, although I can't prove it.

imagine the page is called with index.php?../../../test/somefile

now, i know you're 'basename'ing the querystring, but if you weren't, or basename for some reason didnt remove the ../ bits, you could end up including pages/../../../test/somefile.php, which wouldnt be what you intended.

(in case you're unaware, ../ means 'go up' a directory)

just something to think about when including files like this. i just rang some alarm bells with me.

gemma86
07-09-2005, 22:32
Originally posted by LL200
glad you sorted it, i went through it a number of times thinking that there was nothing actually wrong :)

just as a minor aside, there -could- be a security issue with what you're doing, although I can't prove it.

imagine the page is called with index.php?../../../test/somefile

now, i know you're 'basename'ing the querystring, but if you weren't, or basename for some reason didnt remove the ../ bits, you could end up including pages/../../../test/somefile.php, which wouldnt be what you intended.

(in case you're unaware, ../ means 'go up' a directory)

just something to think about when including files like this. i just rang some alarm bells with me.
To be honest, I don't understand that one bit! I don't know php at all, the code I have is just copied and pasted from a website (http://codegrrl.com/tutorials/php/dynamic_includes.php) which claims that its totally secure, but I wouldn't have a clue.... Without you going out of your way or anything, if there is a security issue, what could solve it?

LL200
07-09-2005, 22:40
there probably isn't one, but I do PHP professionally and you can sense these things after a while :)

a lot of the time, security problems stem from taking data from a user and using it in some way. here, you're taking data on the query string, which I could change in any way I want if I was a malicious user.

You're 'cleaning' it using basename, which is good, but then you're using the data in a way which I would not be comfortable doing - ie, using it in a filename.

this:
\directory\another\again\test.php

is the same as this:
\directory\another\..\another\again\..\again\test. php

can you see how they are the same?

so, if you're not careful, I -could- get your code to include (and potentially display) -any- file on the server. I'm fairly sure that this isn't the case with your code though.

however, if it was me, I would be more comfortable doing something like:

switch($page) {
case 'page1' :
include ('pages/page1.php');
break;
case 'page2':
include('pages/page2.php');
break;
default:
echo 'page not found';
}

thats the end of class for today ;)

sccsux
08-09-2005, 07:45
Originally posted by LL200
I -could- get your code to include (and potentially display) -any- file on the server.

Only on a poorly configured server;).

karl101
08-09-2005, 12:05
Originally posted by gemma86

I was thinking, the idea of putting the pages in another directory is to hide them, so in my navigation, instead of having pages/blah.php, I thought it should probably be ?/blah.php or ?blah.php. Before I tried this, my navigation was set up to be pages/blah.php but putting in index.php?blah.php didn't work, and also it doesn't work using ?/blah.php or ?blah.php in the navigation. Using both of these directory methods, the header and footer stuff shows up, just not the main content that varies on the page, it's saying that the page cannot be found.p

Why not do:

www.url.com/?link=blah

then in your php code (index.php):

if ($_GET['link'] == 'blah') {
include 'blah.php';
}

K.

LL200
08-09-2005, 12:09
i guess short urls are (for some reason) more 'cool'

www.url.com/?blah

is 'better' than

www.url.com/?page=blah

spiffymonkey
08-09-2005, 12:12
Originally posted by LL200
however, if it was me, I would be more comfortable doing something like:

switch($page) {
case 'page1' :
include ('pages/page1.php');
break;
case 'page2':
include('pages/page2.php');
break;
default:
echo 'page not found';
}

thats the end of class for today ;)

A less 'code-rich' way would be to do this:


$pagearray = array ('page1' => 'pages/page1.php',
'page2' => 'pages/page2.php',
'page3' => 'pages/page3.php');

if (array_key_exists($page, $pagearray))
{
include($pagearray[$page]);
}


Using a switch to just select different values always seems like a waste of flow control to me :)

spiffymonkey
08-09-2005, 12:14
Originally posted by LL200
imagine the page is called with index.php?../../../test/somefile

now, i know you're 'basename'ing the querystring, but if you weren't, or basename for some reason didnt remove the ../ bits, you could end up including pages/../../../test/somefile.php, which wouldnt be what you intended.

Basename gives you all the characters after the last un-escaped /, so would be about as much as could reasonably done here short of some regexp magic, which would actually just duplicate what basename does :)

LL200
08-09-2005, 12:15
Originally posted by spiffymonkey
Using a switch to just select different values always seems like a waste of flow control to me :)

...but is easier to understand for the newbie and is considerably less intensive than creating an array and doing an array_key_exists on every page hit :)

karl101
08-09-2005, 12:30
Originally posted by LL200
i guess short urls are (for some reason) more 'cool'

www.url.com/?blah

is 'better' than

www.url.com/?page=blah

I suppose. But it is easier to unterstand.

for the particular problem I've been using:

www.url.com/?blah


$tmp=each($_GET); // change the get into an array
$myid = substr($tmp[0],0,6); // limit to the first 6 chars

if ($myid == 'blah') {
include('blah.php');
}



I suspect the ISP won't allow rewrite in .htaccess so you can't do clever stuff like

www.url.com/blah

K.

gemma86
23-01-2006, 21:11
It's been a while but I have a new problem now...

I've got 4Images installed on the server. I didn't upload it myself, it was done through Fantastico (I don't think that's relevant but, just in case...)

The url http://www.tom-tied.com/gallery/ which should take you to the index of the gallery is coming up as:
Parse error: parse error, unexpected '{' in /home/glg4186/public_html/tom/gallery/lang/english/main.php on line 80

I don't understand what's happened because I've not touched any of these files.
Line 80 in the mentioned file is:
$lang['register_download'] = "Please register to download images.<br />&raquo; <a href="{url_register}">Register now/a>";


I thought it might be to do with the Register now/a>"; as it doesn't have a "<" at the beginning of the "/a>", like the standard closing link tag... But then, I'm still non-the-wiser on PHP, so, any help please?

Joelc
23-01-2006, 22:14
It wont be that, it'll be a few lines above somewhere no doubt, cant actually see without the full code of the script.

Joel

gemma86
23-01-2006, 22:18
It wont be that, it'll be a few lines above somewhere no doubt, cant actually see without the full code of the script.

Joel
That was line 80 according to Dreamweaver btw...
Thought it'd be ok to post this up as there's nothing specific to my site in this code. Sorry it's so long!
<?php
/************************************************** ************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: main.php *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.7 *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
************************************************** ************************
* *
* Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (Lizenz.txt) für weitere Informationen. *
* --------------------------------------------------------------- *
* This script is NOT freeware! Please read the Copyright Notice *
* (Licence.txt) for further information. *
* *
************************************************** ***********************/

/************************************************** ************************
* *
* English translation by Thomas (http://www.japanreference.com) *
* *
************************************************** ***********************/

$lang['no_settings'] = "ERROR: Could not load configuration settings!";

//-----------------------------------------------------
//--- Templates ---------------------------------------
//-----------------------------------------------------
$lang['charset'] = "iso-8859-1";
$lang['direction'] = "ltr";

//-----------------------------------------------------
//--- Userlevel ---------------------------------------
//-----------------------------------------------------
$lang['userlevel_admin'] = "Admin";
$lang['userlevel_user'] = "Member";
$lang['userlevel_guest'] = "Guest";

//-----------------------------------------------------
//--- Categories --------------------------------------
//-----------------------------------------------------
$lang['no_categories'] = "No categories found.";
$lang['no_images'] = "There are no images in this category.";
$lang['select_category'] = "Select category";

//-----------------------------------------------------
//--- Comments ----------------------------------------
//-----------------------------------------------------
$lang['comments'] = "Comments:";
$lang['no_comments'] = "There are no comments for this image";
$lang['comments_deactivated'] = "Comment deactivated!";
$lang['post_comment'] = "Post comment";

//-----------------------------------------------------
//--- BBCode ------------------------------------------
//-----------------------------------------------------
$lang['bbcode'] = "BBCode";
$lang['tag_prompt'] = "Enter the text to be formatted:";
$lang['link_text_prompt'] = "Enter the text to be displayed for the link (optional)";
$lang['link_url_prompt'] = "Enter the full URL for the link";
$lang['link_email_prompt'] = "Enter the email address for the link";
$lang['list_type_prompt'] = "What type of list do you want? Enter '1' for a numbered list, enter 'a' for an alphabetical list, or leave blank for a list with bullet points.";
$lang['list_item_prompt'] = "Enter a list item. Leave the box empty or click 'Cancel' to complete the list.";

//-----------------------------------------------------
//--- Image Details -----------------------------------
//-----------------------------------------------------
$lang['name_required'] = "Please enter a name.";
$lang['headline_required'] = "Please enter a headline.";
$lang['comment_required'] = "Please add a comment.";
$lang['spamming'] = "You cannot repost so soon, please try again after a short while.";
$lang['download_error'] = "Download error!";
$lang['register_download'] = "Please register to download images.<br />&raquo; <a href="{url_register}">Register now/a>";
$lang['voting_success'] = "Thank you for rating this image";
$lang['voting_error'] = "Rating invalid!";
$lang['already_voted'] = "Sorry, you've already rated for this image once recently.";
$lang['prev_image'] = "Previous image:";
$lang['next_image'] = "Next image:";
$lang['category'] = "Category:";
$lang['description'] = "Description:";
$lang['keywords'] = "Keywords:";
$lang['date'] = "Date:";
$lang['hits'] = "Hits:";
$lang['downloads'] = "Downloads:";
$lang['rating'] = "Rating:";
$lang['votes'] = "Vote(s)";
$lang['file_size'] = "File size:";
$lang['author'] = "Author:";
$lang['name'] = "Name:";
$lang['headline'] = "Headline:";
$lang['comment'] = "Comment:";
$lang['added_by'] = "Added by:";
$lang['allow_comments'] = "Allow comments:";

// IPTC Tags
$lang['iptc_caption'] = "Caption:";
$lang['iptc_caption_writer'] = "Caption writer:";
$lang['iptc_headline'] = "Headline:";
$lang['iptc_special_instructions'] = "Special instructions:";
$lang['iptc_byline'] = "Byline:";
$lang['iptc_byline_title'] = "Byline title:";
$lang['iptc_credit'] = "Credit:";
$lang['iptc_source'] = "Source:";
$lang['iptc_object_name'] = "Object name:";
$lang['iptc_date_created'] = "Date created:";
$lang['iptc_city'] = "City:";
$lang['iptc_state'] = "State:";
$lang['iptc_country'] = "Country:";
$lang['iptc_original_transmission_reference'] = "Original transmission reference:";
$lang['iptc_category'] = "Category:";
$lang['iptc_supplemental_category'] = "Supplemental category:";
$lang['iptc_keyword'] = "Keywords:";
$lang['iptc_copyright_notice'] = "Copyright Notice:";

//-----------------------------------------------------
//--- Postcards ---------------------------------------
//-----------------------------------------------------
$lang['send_postcard'] = "Send eCard";
$lang['edit_postcard'] = "Modify eCard";
$lang['preview_postcard'] = "eCard preview";
$lang['bg_color'] = "Background Color:";
$lang['border_color'] = "Border Color:";
$lang['font_color'] = "Font Color:";
$lang['font_face'] = "Font Face:";
$lang['recipient'] = "Recipient";
$lang['sender'] = "Sender";
$lang['send_postcard_emailsubject'] = "An eCard for you!";
$lang['send_postcard_success'] = "Thank you! Your eCard has been sent!";
$lang['back_to_gallery'] = "Back to Gallery";
$lang['invalid_postcard_id'] = "Invalid eCard ID.";

//-----------------------------------------------------
//--- Top Images --------------------------------------
//-----------------------------------------------------
$lang['top_image_hits'] = "Top 10 images by hits";
$lang['top_image_downloads'] = "Top 10 images by downloads";
$lang['top_image_rating'] = "Top 10 images by rating";
$lang['top_image_votes'] = "Top 10 images by votes";

//-----------------------------------------------------
//--- Users -------------------------------------------
//-----------------------------------------------------
$lang['send_password_emailsubject'] = "Send password for {site_name}"; // Mail subject for password.
$lang['update_email_emailsubject'] = "Update email for {site_name}"; // Mail subject for activation code when changing email address
$lang['register_success_emailsubject'] = "Register at {site_name}"; // Mail subject for activation code
$lang['admin_activation_emailsubject'] = "Account Activation"; // Mail subject for account activation by admin.

$lang['activation_success_emailsubject'] = "Account activated"; // Mail subject after account activation by admin.

Joelc
23-01-2006, 23:46
Well it looks like its something in Index.php, that file is probably included somewhere and its throwing the error position out somewhat.

Joel

gemma86
24-01-2006, 13:04
Any suggestions as to what to do?

dosxuk
24-01-2006, 15:53
try changing the line from
$lang['register_download'] = "Please register to download images.<br />&raquo; <a href="{url_register}">Register now/a>";
to:
$lang['register_download'] = "Please register to download images.<br />&raquo; <a href=\"{url_register}\">Register now/a>";

gemma86
25-01-2006, 22:27
try changing the line from
$lang['register_download'] = "Please register to download images.<br />&raquo; <a href="{url_register}">Register now/a>";
to:
$lang['register_download'] = "Please register to download images.<br />&raquo; <a href=\"{url_register}\">Register now/a>";
Thanks, that's worked. Kind of.
http://tom-tied.com/gallery/
There's some random odd link in the sidebar now, and the gallery is misplaced at the bottom of the template...
However, I can't get onto the admin section to edit the template, or do any other admin stuff, as it's giving me this error:
Parse error: parse error, unexpected T_STRING in /home/glg4186/public_html/tom/gallery/lang/english/admin.php on line 38
Line 38 according to Dreamweaver is:
$lang['admin_no_lang'] = "No language set found. Please upload the <b>"english"</b> language set into your <b>"lang"</b> directory.";.
Obviously the file before, which I've just edited was part of the "lang" directory...

Thank you for all your help in the whole of this thread btw! It's much appreciated.

adaline
25-01-2006, 22:43
try:

$lang['admin_no_lang'] = "No language set found. Please upload the <b>english</b> language set into your <b>lang</b> directory.";

on that line.

gemma86
25-01-2006, 22:55
Thank you.
Not sure if that's worked, as I'm now getting this message:
Parse error: parse error, unexpected T_STRING in /home/glg4186/public_html/tom/gallery/lang/english/admin.php on line 67

Line 67 being:
$lang['date_format'] = "<br /><span class="smalltext">(Format of date: yyyy-mm-dd hh:mm:ss)/span>";


Out of interest, does anyone have any idea how this might have happened? We've not had the gallery up and running for the past couple of months. We closed the site while we sorted some bandwidth stuff out, and had a temporary index page up (which is still up) however, cos people had the gallery in the favourites or history etc, they were still accessing the site. I renamed the directory of the gallery, temporarily, but I don't see how this could have affected these files and in the ways that they're broken...

adaline
25-01-2006, 23:05
lol ok here we go

$lang['date_format'] = "<br /><span class=\"smalltext\">(Format of date: yyyy-mm-dd hh:mm:ss)/span>";
This seems rather strange, like all ' (single quotes) were turned into doubles, a bad search and replace maybe?

gemma86
25-01-2006, 23:12
lol ok here we go

$lang['date_format'] = "<br /><span class=\"smalltext\">(Format of date: yyyy-mm-dd hh:mm:ss)/span>";
This seems rather strange, like all ' (single quotes) were turned into doubles, a bad search and replace maybe?
Thanks for that. Looks like it's worked again, but yet again it's come up with another error. I can see what you're adding in here, so I'll have a go.
But once again, thank you so much!

I'm just a bit concerned at the moment as to how it's got like this. Then my next problem is, after trying to fix all the errors and failing (worst case scenario), how to get the gallery back up with out reuploading all the pictures (and, preferably, with all the keywords still) :|

gemma86
25-01-2006, 23:26
Once again thank you very much. I've managed to fix the admin file and am now logged in on the gallery. Just a bit of a problem in the navigation bar of the admin panel now :rolleyes:

gemma86
04-05-2006, 22:00
I'm back yet again with another problem....

This time it's for CuteNews - which is a dead simple script for posting up articles/news on a site...
http://cutephp.com/cutenews/

I think what's needed here is a bit of code for the index file for the site, but I still don't know PHP one bit so I'm hoping someone will know what to put!

Right, onto the problem...

I'm having problems with the link that's come up for the comments.

My index file for the site has an include for the header, includes for the various folders for the different pages and the footer. I have CuteNews installed in a seperate folder, so it all looks something like this:

ROOT FOLDER
--> Index
--> CuteNews

Now when I click on the comments it comes up saying "This page does not exist" and, looking at the link for the comments, it's missing out the part to the CuteNews folder, for example:
www.starstruk.net/site/index.php?subaction=showcomments&id=1146691200&archive=&start_from=&ucat=&

Instead of:
http://www.starstruk.net/site/cutenews/index.php?subaction=showcomments&id=1146748701&archive=&start_from=&ucat=&

I had a look at those example pages that's included in the zip file for all the installation and the links to the comments work fine.

I was originally wondering if there was anyway of adding/changing the path for the comment links so it works, but after a think, it's most likely to do with where the index file of the site is looking to complete the url.... But I'm not too sure because if you click on 'view source', the link is in full....

Also, if you add the 'missing' bit to the address in the browser it takes you to the CuteNews admin panel... So now I'm guessing I need to have the directory as one of my includes on the index page, but I tried that and it didn't work...

I was just going to put it all in the same directory, but that'd mean having two index files, and seems a bit risky with the access to CuteNews...

Any suggestions on the code or what to do?

btw, it's www.starstruk.net/site

Thanks

evildrneil
04-05-2006, 23:37
Looking @ it now, it's a total *&%%$ UP:D.

A corrected version is below (with a minor addition):

And of course (well assuming standard PHP!) should be $_GET['page']...

...not that I would ever forget such a thing of course :blush: