Jump to content

ShogunWarrior

Members
  • Posts

    528
  • Joined

  • Last visited

    Never

Everything posted by ShogunWarrior

  1. This should work nicely: [code] <?php if(preg_match('/firefox/i',((isset($_SERVER['HTTP_USER_AGENT']))?($_SERVER['HTTP_USER_AGENT']):('')))) {         //Firefox only code } [/code]
  2. Ok, let's begin: [b]1)[/b] Internet Explorer incorrectly displays the ALT tag an mouse-over, it is meant only as an alternative to the image, but we have got used to the IE behaviour as normal. [b]2)[/b] The URL [b]index.php?image=th000001.jpg[/b] isn't limited to displaying the image, what it does is give the name of the image to the script, which will search the XML and display the Description, Caption etc. [u]in whatever way you want[/u]. [b]3)[/b] As for the static pages, the best way to do this is to leave the <url></url> tag empty where it should be dynamic and where it is not empty, the script should output the link to the static page, simple enough. [b]4)[/b] As for know, I think you should go through the XML, emptying the [b]<URL>[/b] tag where not needed and adding categories in the [b]<category>[/b] tag. It's all within scope, if the information's there. [b][u]I've implemented the following:[/u][/b] [b]1)[/b] Caption should display by using link's title tag. [b]2)[/b] Implemented dynamic display page for a single image. [b]3)[/b] Static pages can be used by adding the URL to <url> tag. Check it out: http://igoradio.com/xmlMenu/ I haven't yet done the categories, need clarification.
  3. Well if you have users you need a way to have them logged in etc. and since cookies are only for long term re-sign-in then sessions are the only way, and as far as I know the PHP standard for tracking users. Unless you're expecting thousands of users at once I wouldn't worry at all.
  4. You can put session_start() at the very start of the file, session_start() doesn't rely on anything else as far as I know.
  5. There are a number of implementations, it needs carefully client-side and server-side coordination, have a start here: http://www.raditha.com/php/upload.php
  6. Is there a way to specifiy the working directory for the cron job?
  7. I'm not aware of a way to change the value of a file input but I have seen implementations of multiple uploads through Javascript, but it still seems a bit intrusive which may mean that it is not supported.
  8. Well if that's the way it works. I think I gave a safer version, I thought Karma was about someone being obnoxious, ignorant or unhelpful, not because you think their solution is worse. Oh don't smite me almighty smiter.
  9. Yeah, I always presumed that sessions were a given, and that cookies were the thing that were on/off sometimes, hmmm.
  10. Here's it nicely wrapped up. PS, you should include a foreign file "http:// etc.." many PHP systems will have it blocked anyway. You should include it locally like [b]include("/wes/header.php");[/b] Here's the code: [code] <?php include ("http://www.evermoreforums.com/wes/header.php"); $page = ((isset($_REQUEST['page']))?($_REQUEST['page']):('')); switch($page) {         case "basics":         {                 echo ( "blah, content goes here" );                 break;         }         case "likes":         {                 echo ( "blah, content goes here" );                 break;         }         case "dislikes":         {                 echo ( "blah, content goes here" );                 break;         }         default:         {                 echo ( "this is the page that shows up as 'about.php'like, the main page");                 break;         } } ?> [/code]
  11. Maybe the cron job should be run as [b]www-data[/b] so it has server write access?
  12. Although maybe they are mutually exclusive since the PHP script is running under Apache, hmm.. Anyway, you could do this: [code]$result = shell_exec('C:\path\to\apache.exe -k restart');[/code] May do the trick.
  13. Try putting whatever you would put on the command line into a shell_exec because I don't know much about executing python.
  14. $amount = mysql_num_rows($rs); Should do it.
  15. Hmmm, it works for me with these pages, modifications of yours: Start: [code] <?php                 $username = 'joan';                 $password = 'tinky';                 if ( $password!=false) {                         session_start();                         $_SESSION = array();                         $_SESSION['username'] = $username;                         $_SESSION['user_id'] = $password;                         header("Location: idx.php");                 } else {                         echo 'Log-in failed';                 } [/code] Index: [code] <?php require('header.php'); $id = 'home'; switch ($id) {         case 'home':                 echo('./home.html');                 break;         case 'news':                 echo('./news.php');                 break;         case 'about':                 echo('./about.html');                 break;         case 'calendar':                 echo('./calendar.html');                 break;         case 'home':                 echo('./forums.forums');                 break;         case 'email':                 echo('./email.html');                 break;         case 'crew':                 echo('./crew.html');                 break;         case 'extras':                 echo('./extra.html');                 break;         default:                 echo('./home.html');                 break; } echo $_SESSION['username']; ob_flush(); ?> [/code] Header: [code] <?php ob_start(); session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <link rel="stylesheet" type="text/css" href="includes/pirate.css" /> <script type="text/JavaScript"> <!-- AJAX call --> var XMLHttpRequestObject = false; if (window.XMLHttpRequest) {         XMLHttpRequestObject = new XMLHttpRequest(); } else if (window.ActiveXObject) {         XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP") } function getData(datafile, divID) {         if (XMLHttpRequestObject) {                 var obj = document.getElementById(divID);                 XMLHttpRequestObject.open("GET", datafile);                 XMLHttpRequestObject.onreadystatechange = function() {                         if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {                                 obj.innerHTML = XMLHttpRequestObject.responseText;                         }                 }                 XMLHttpRequestObject.send(null);         } } <!-- Menu RollOver Images function MM_swapImgRestore() { //v3.0   var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0   var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();     var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)     if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {     d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);   if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0   var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> </head> <body> <table width="100%" cellpadding="0" cellspacing="0" border="0">         <tr>                 <td class="top" height="136" colspan="10"> header </td>         </tr>         <tr>                 <td valign="top" class="menu"> <!--menu -->                         <center>                                 <div class="menu_header"></div>                                 <a href="index.php?content=home" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('home','','images/menu/home_hover.jpg',1)"><img src="images/menu/home.jpg" alt="Home" name="home" width="67" height="26" border="0" id="home" /></a><br />                                 <a href="index.php?content=news" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('news','','images/menu/news_hover.jpg',1)"><img src="images/menu/news.jpg" name="news" width="55" height="21" border="0" id="news" /></a><br />                                 <a href="index.php?content=about" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('about','','images/menu/about_hover.jpg',1)"><img src="images/menu/about.jpg" name="about" width="47" height="20" border="0" id="about" /></a><br />                                 <a href="#" onclick="getData('about.php', 'main_content')" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('calendar','','images/menu/calendar_hover.jpg',1)"><img src="images/menu/calendar.jpg" name="calendar" width="67" height="20" border="0" id="calendar" /></a><br />                                 <a href="index.php?content=forums" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('forums','','images/menu/forums_hover.jpg',1)"><img src="images/menu/forums.jpg" name="forums" width="59" height="19" border="0" id="forums" /></a><br />                                 <a href="index.php?content=email" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('email','','images/menu/email_hover.jpg',1)"><img src="images/menu/email.jpg" name="email" width="50" height="19" border="0" id="email" /></a><br />                                   <a href="index.php?content=crew" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('crew','','images/menu/crew_hover.jpg',1)"><img src="images/menu/crew.jpg" name="crew" width="84" height="24" border="0" id="crew" /></a><br />                                 <a href="index.php?content=extras" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('extra','','images/menu/extrastuff_hover.jpg',1)"><img src="images/menu/extrastuff.jpg" name="extra" width="102" height="20" border="0" id="extra" /></a>                         </center>                         <div class="menu_footer"></div>                 </td><!--/menu -->                 <td valign="top">                         <table border="0" width="100%" cellpadding="0" cellspacing="0">                         <tr>                         <td style="width: 82px; height: 65px; background-image: url('images/main content/main_content_top_left.jpg');"></td>                         <td align="left" style="height: 65px; background-image: url('images/main content/top_span.jpg');"></td>                         <td style="width: 82px; height: 65px; background-image: url('images/main content/main_content_top_right.jpg');"></td>                           </tr>                         <tr>                         <td style="width: 82px; background-image: url('images/main content/vertical_span_left.jpg');"></td>                         <td id="main_content"> [/code] It will output "joan" on idx.php as it should so because the database stuff is working, that doesn't matter that I changed it, so is there a problem with the persistency of sessions on the server?
  16. I think (think) that there may (may) be a conflict between session_start() and ob_start() but that's speculation, plucking at straws here.
  17. Hmm.. not sure now, I'd start printing out the session on both ends, testing with a control page etc. but you seem competent enough that you'll be able to seek it out our show some more code, because what you have seems fine.
  18. So it works on that page, quite strange then. I hesitate to ask certain things I might check like refreshing index.php etc. maybe a bit of investigation will reveal something.
  19. Sure, this method is called a ternary, because there are three parts: The test: [b](isset($_GET['page']))[/b] True value: [b]($_GET['page'])[/b] False value: [b]('')[/b] We wrap this in a parentheses and now we can assign the variable a value based on a test: $page = ((isset($_GET['page']))?($_GET['page']): ('')); You can use this for many things, to test if a variable is not null, and then assign it to something etc.. hope it helps.
  20. You can loop through them and [b]mysql_query[/b] for each one.
  21. No, sorry. What this does is take the value of page from the browser address and put it into $page, the modified code is: [code] <?php   $page = ((isset($_GET['page']))?($_GET['page']):(''));   if ($page == "desc"){include("pages/description.php");}   elseif ($page == "groundfloor"){include("pages/floors.php");}   elseif ($page == "firstfloor"){include("pages/floors.php");}   elseif ($page == "photos"){include("pages/photos.php");}   elseif ($page == "vp"){include("pages/pic_display.php");}   elseif ($page == "contact"){include("pages/contact.php");}   else{echo "arse";} ?> [/code]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.