Jump to content

Quoth

Members
  • Posts

    16
  • Joined

  • Last visited

    Never

Everything posted by Quoth

  1. I guess i am looking for a way to specify the server that is sending the email? or looking for a way to force it to be seen as being sent from a different domain? (which just sounds duplicitous to me - I don't care if the domains are owned by the same person or not) I can't see why the email would not be sent properly from the domain, even if it's mail server was routed to the other domain... the domains in question are blackgum.com.au and ellisonhawker.com.au . I originally took some of the domain info out at a stab at a bit of privacy for those business', but now I realise that what i am asking actually sounds dodgy, as if I was planning a spam campaign or the like, I guess this kind of thing could come in handy to implicate a different web server. I don't need the headers to say that it was coming from the EH mail server, I would prefer it to be only referenced to the blackgum one. I am just trying to figure out if I can actually re-route it through the script, or wether it is something these guys need to deal with because of the way they have set up the mail handling... Cheers EDIT -- Thanks teamatomic, I'll check it out and have a play with it
  2. Quoth

    post a video?

    in a way... the embed tag is depreciated, so you will have to use the object tag, and that has a few more parameters that you will need to specify. read through all the information on w3schools to get a better understanding of the object tag, and make sure the video is in a format that will be accepted by the object tag: http://www.w3schools.com/media/media_object.asp
  3. Quoth

    post a video?

    no, you can't use the path in quite that way, you will have to embed an object. You may need to change the video format too. Check out this link for a basic understanding of what you need to do: http://www.w3schools.com/media/media_browservideos.asp
  4. I have a script that sends an email of an order when one is placed on the site. It is sent to the user and to an admin. I have been having some issues with the emails to the admin going astray, which is a big problem The person I made the site for has a number of other sites too, all for business' he runs from a building in the city. He uses some IT guys to rent the hosting space etc. for his websites, and they also set up his servers in the office for the pc's in the shops. They configured the email on the different domains to point to just one domain, and that then deals with all the email that is recieved from the different sites, dishing it out to who ever needs it. This is somewhat confusing to me, but there you go. I mention to the IT guys that we are having emails go astray, and go to the wrong places - usually it ends up going to the default address on the domain that gets all the mail re-routed to it. so I get this in an email: "It appears from the header that the emails are routing to the webserver – bg.com, which is strange, because the primary mail server (mail.bg.com) points to the EH Server. Ive tested this and also sent an email to [email protected] which went straight to the EH server. I can only guess it may be the PHP script automatically routing to the webserver’s mail server. Maybe because that’s where the php script resides? The best way to determine this is by changing the script to route through a different mail server, possibly the EH mail server? Could you modify the PHP script to do this?" And my first reaction to that is... how the hell am I supposed to do that?!? So I am having a look at the PEAR smtp stuff, and generally flaling around the internet to see what I might need to learn in order to do this. I have no real idea where to start. Can anyone point me in the right direction with suggestions? Cheers!
  5. I record a unix timestamp with every entry, because to begin with I thought I'd be able to use it to do anything I needed with the date (as you say) I thought it might be easier to store the month name as a string and the week number in the row aswell, because these are really the two things I need the most (though the timestamp does help in allowing me to sort it from earliest to latest in any given week.) I thought trying to use the timestamp to make the query's might make the code convoluted, or even harder for me to understand what I was doing. I like the sound of that "WHERE date between '$date1' and '$date2'" didn't realise you could do that! my SQL knowledge certainly leaves a lot to be desired so far as finding the most efficient ways of doing things goes, but I also have to learn it at uni this semester, so that should kick me in the bum or help a bit. So to use that, I get a timestamp of the start of the week, a timestamp for the end of the week, then feed those into the query (instead of using my month and weeknums) for each iteration of the loop to make the weeks.... hmmmm..... (lol, looking at the code posted I am seeing so many silly logic errors in my php.... ) Thanks, all these little comments fire me off on tangents that are helping me get my head around this Cheers!
  6. I think I am having a problem with this portion of the code: // create query $query = "SELECT * FROM calendar_events WHERE month='".$monthName."' AND week=".$weekNum." AND auth=1 "; //see if there are any more conditions of sorting to add to the query $game = 'all'; $game = $_POST['sortGame']; if (!($game == 'all')) { $query = $query."AND game='".$game."' ORDER BY time ASC;"; } else { $query = $query."ORDER BY time ASC;"; } or it might be this part, that runs when the the submit button is clicked: <form method='POST' action='calendar.php' name='calendarSort'> Would this reset the form values? The month one seems to work fine, (outlined in the code above this post), but when I am trying to sort by game it does not work. For this to work, I need to pass three AND statements to the query, is this too many? do I need to enclose them in brackets? I am echoing the query into the page each time it is executed, just to see what the query ends up being, and the AND game=gamename never makes an appearance. Any ideas? The link to the page is here, if you want to see what I mean. It also shows that no events are shown untill you press the sort button (with the default options picked) but thats another problem..... http://www.area52.com.au/calendar/dynamicCalendar/calendar.php
  7. ok, i discovered the sql query's werent too hard :D by chopping up the example calendar given above, and utilising a week range finding method from php builder forums, I managed to come up with just what I wanted! :D I started adding a bit of functionality to it, which is where it got broken, numerous times, but I managed to fix it mostly. As I kept adding things it makes me wonder if there is a more streamlined way to create the function, or break it up more. The database table has columns for event name, authorised (0 or 1), week number, timestamp, id, info, link, and more text fields for information basically by default the script gets the current date, then figures out how many weeks it needs to display. for each week it goes through and gets all entries that are authorised, have a corresponding week number and displays them by earliest date in the week to the latest. The method to find the week range of dates is used to create the week headers. I added the sorting method on the left hand side, so that the events can be sorted by last or next month too, and also so that the calendar can display just a certain game. then it broke, sort of, where it will not display events untill the results are sorted with the form, though it does go through and get all the week headers. I'm pretty sure its got something to do with this where the query is created, and obviously something to do with the sorting form, and I get the feeling its relatively simple, but after banging my head on this and squeezing so much into my brain it is a blur :D any ideas, or comments on the code below? [code] <!-- InstanceBeginEditable name="PageContent" -->   <div id="sideNav">   <div class="module_heading">   Monthly Events </div> <div class="sortBox"> <span class="bold">Sort by month or game</span>   <form method='POST' action='calendar.php' name='calendarSort'>   <select class="sortbox" name='sortMonth'>           <option value='current'>Current Month</option>           <option value='last'>Last Month</option>           <option value='next'>Next Month</option>         </select>   <select class="sortBox" name='sortGame'>           <option value='all'>All</option>   <option value='Area 52'>Area 52</option>           <option value='Confrontation'>Confrontation</option>           <option value='D&D'>Dungeon and Dragons</option>           <option value='FOW'>Flames of War</option>           <option value='GW'>Games Workshop</option>           <option value='L5R'>Legend Of The Five Rings</option>           <option value='Magic'>Magic: The Gathering</option>           <option value="Pokemon">Pokemon</option>           <option value="SG">Sabertooth Games</option>           <option value="V:TES">Vampire: The Eternal Struggle</option>           <option value="WOW">World Of Warcraft</option>           <option value="Yugioh">Yu-Gi-Oh</option>           <option value="Other">Other Games</option>         </select> <input type='submit' value='Sort Events' name='butSubmit' />   </form>   </div>   <div id="sideNavFooter">   </div>   <div class="module_heading">   Constant Events </div>   <div class="moduleTextOnly"><span class="bold">Wednesdays and Thursdays</span><br />   blah blah removed some html paragraphs here<br /> </div>     <div id="sideNavFooter">   </div>   </div> <div id="content"> <?php // set variables: include("include/config.php"); $now = getdate();// get array of current date $monthNum = date('m');// get the month number to give to the display calendar function //see if we are sorting by month if ($_POST['sortMonth'] == 'last') { $monthNum = $monthNum-1; } if ($_POST['sortMonth'] == 'next') { $monthNum++; } // open connection $connect = mysql_connect($host, $account, $login) or die ("Unable to connect!"); // select database $db = mysql_select_db("area52co_phpbb2", $connect) or die ("Unable to select database!"); //display calendar of chosen month displayCalendar($monthNum, $now['year']); function displayCalendar($month, $yearNum) { $dayTotal = cal_days_in_month(0, $month, $yearNum);//get total days for month specified in parameters $weekRange = $dayTotal / 7;// generate the amount of weeks we want to show in this months calendar (includes enough to oveerlap into following month) $firstWeekNum = date('W', mktime(0, 0, 0, $month, 1, $yearNum));//find the week number we want to start showing the calendar at by getting the date for the 1st of the month specified $weekNum = $firstWeekNum;//set the weeknum variable initially to the week we want to start at, weeknum increments at the end of each week displayed $monthName = date('F', mktime(0, 0, 0, $month, 1, $yearNum));//get the name of the month to feed into the SQL query //Display month header echo '<div class="subHeading">Calendar of events for '.date('F Y', mktime(0,0,0,$month,01,$yearNum)).'</div>'; echo '<div class="textCenter">All events take place at Area 52 unless otherwise specified.</div>'; //Loop displays all events in the database grouped by weeks, loop goes for as many times equal to the amount of weeks we need to show for a given month for ($i =0; $i <= $weekRange; $i++) { // create query $query = "SELECT * FROM calendar_events WHERE month='".$monthName."' AND week=".$weekNum." AND auth=1 "; //see if there are any more conditions of sorting to add to the query $game = 'all'; $game = $_POST['sortGame']; if (!($game == 'all')) { $query = $query."AND game='".$game."' ORDER BY time ASC;"; } else { $query = $query."ORDER BY time ASC;"; } // execute query $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); //create week header $desiredMonday = StartOfWeek($yearNum, $weekNum);//get a timestamp of the monday of the week we are up to $weekMon = date('l jS \of F', $desiredMonday);//format the date of the monday into something friendly $weekSun = date('l jS \of F', strtotime('+ 6 days', $desiredMonday));//calculate the days untill the sunday of that week and format that one too //print week header echo '<div class="weekHeader">'.$weekMon.' to '.$weekSun.'</div>'; // see if any rows were returned if (mysql_num_rows($result) > 0) { // yes // print them one after another while($row = mysql_fetch_row($result)) { echo '<table class="calendarEntry"> <tr> <td colspan="2"><div class="bold">'.$row[6].' :: '.$row[5].'</div></td> </tr> <tr> <td><p>'.$row[7].'</p><br />'; $link = $row[8]; echo 'this is link:<br />'.$link; echo strlen($row[8]); if (strlen($row[8]) == 0) { echo '<a href="http://'.$row[8].'>Click here for more information</a>"'; } echo '</td> <td class="calDetails"><span class="bold">When: </span>'.date('l j/M H:i', $row[1]).'<br /> <span class="bold">Contact:</span> <a href=mailto:'.$row[10].'>'.$row[9].'</a><br /> <span class="bold">Cost: </span> $'.$row[11].'</td> </tr> </table>'; } }else { // no // print status message echo "No events for week found! <br />"; } $weekNum++; } } // Method to get the range of the week to put in the header week for each display //thanks to weedpacket from www.phpbuilder.com function StartOfWeek($year, $week) {     $Jan1 = mktime(1,1,1,1,1,$year);     $MondayOffset = (11-date('w',$Jan1))%7-3;     $desiredMonday = strtotime(($week-1).' weeks '.$MondayOffset.' days', $Jan1);     return $desiredMonday; } // free result set memory //mysql_free_result($result); // close connection mysql_close($connect); ?> </div> [/code]
  8. ok, thanks very much for your advice guys :D I'll go and check out SQL then, we have one spare available database, so i may as well use it. You guys would know better than me wether it is more efficient to create a DB or to do flat files so thanks for that. Probably saved me a giant headache! I might revive this topic for technical questions when I start writing the php code. Cheers!
  9. Thanks for your advice tomfmason, that definately gives me something to play around with to get familiar with the methods that should be used to manipulate date data. The more I think about it though, I wonder if I am approaching this the wrong way. If you look at the example link (which I want the dynamically generated one to look like), all it really is is a list of events, and they happen to be sorted by date. It would also be useful (as these are gaming events of various kinds) to sort the list by showing just game genres, or specific games. So if I think about it as a dynamically generated list, then I would go the way of creating an object for each event. Then, when generated would show list by date (descending) by default. So each object (event) has a date, a game type, a title, a time and information. I could then use a conditional statement to insert objects that have a date that coincides with the week it should be in, if the date doesn't fit, then it doesn't go in until the right week comes up. Then I am able to minimise the amount of date functions I need to use, and just use them to specify the month at the top of the page, and the weeks of the month. this would make it easy to sort the list by game type etc. Does this sound more sensible than creating an actual calendar, as I dont want days displayed if they have no events (as the events most often happen on the weekends anyway, and rarely during the week) I'll start writing out a draft of an algorithm (that makes more sense than the previous one) and see how we go. Thoughts?
  10. nope what i suggested was rubbish :D sorry
  11. I am starting on an algorithm outline that may make it easier to understand what Ia m saying I want to do: Algorith outline: // files of events will be named eg: 15-1-01 (ie 15th of the first, first file of that day). When there is another event falling on the same day it will be named 15-1-02 get current date //assign variables for use in this month variable $currentMonth becomes the name of this month(eg: January) variable $week1Mon becomes formatted date (eg: Monday 2nd January) variable $week1Sun becomes formatted date (eg: Sunday 8th January) variable $week2Mon becomes formatted date (eg: Monday 9th January) variable $week2Sun becomes formatted date (eg: Sunday 15th January) variable $week3Mon becomes formatted date (eg: Monday 16th January) variable $week3Sun becomes formatted date (eg: Sunday 22nd January) variable $week4Mon becomes formatted date (eg: Monday 28th January) variable $week4Sun becomes formatted date (eg: Sunday 3rd February) variable $eventFiles becomes array scandir($currentMonth) //start organising and displaying the page Display "Special events for $currentMonth" Display "$week1Mon to $week1Sun" Display all events in array from week start date to week end date. maybe: a counter to keep track of which day we are processing, starts at start of month date (ie 01). $endWeekDate becomes int equal to the last date in the week (have to research methods) while (counter < $endWeekDate +1) display 1st file with first two numbers of file name equal to counter while (next file has same two numbers at start of file name (ie their on the same day) then display those too. once events for that day are displayed, then counter increments. so this loop will go untill the end of the week Display "$week2Mon to $week2Sun" then do the same loop as before, probably best to put it in a method called displayWeek(), untill we hit the last end date of the month. any OOP i have done before I have issues with flow of control, and algorithm design, but I thought I'd put this up to give people an idea of the kind of thing the code might be doing from what I explained above. thoughts? suggestions for improvement, or any kind of built in methods that might help? Cheers
  12. hmmm, I am very new to php, so sorry if I go off on the wrong track or suggest to use things the wrong way. I am sure someone will correct me if I am wrong :D apparently if you try to open a file to read and append, "if the file does not exist, php attempts to create it" (using: fopen("filename.php, "a+"); ) you dont have to do anything with it if it does exist, but if it doesn't you could write what you need and close the file. just a thought, I've been trying to learn about files, and that was my first thought. Cheers!
  13. Hi, I am planning on writing a script that dynamically creates a calendar, that will be displayed like this: http://www.area52.com.au/calendar/current.htm I haven't got any real experience with php, though I have done some OOP with Java. This will take me a while to develop as I am learning as I go :D I would like to write the script using flat files, as I dont know anything about databases either, and I think learning one thing at a time will be quite enough :D The data for each event to be displayed will be entered via a form, then stored in a directory for the month that it falls in. When the calendar script is run, it will use the date function to display all events happening in that particular month (with a header specifying the month), devided by each week (mon to sun), and then the events in order mon to sun. So what I am thinking is that the form to enter an event will then be turned into a string of HTML code, styled with CSS, so each event can simply be a string of info converted to HTML code when it is submitted. (as in, they enter "event name" but on submission I enclose it in the appropriate div class tags for styling etc) I am thinking of saving the files with the file name to be the date of the event - say the day first. Use the date function to get the current month, then use scandir() to put the files in an array that are in that months directory. Do something to create the headers of each week with the date function, then a loop to go through the array, echoing the files that fall with day dates in that week. This way there can be links to preceeding and following months that will run in the same way allowing users to see whats happening in the future or happened before. I can periodically clean out old directories after 6 months or a year. So my question is, is this an inefficient way to go about writing the script? will it take a long time to run? It will have to traverse the array about four or five times to display the whole month, or I could use a loop to only read the files with the days in that week. I am thinking of using file_get_contents() to read the data in the file to put it all into a string to echo. Any thoughts or comments? more technical questions will come when I start to write the script, but I need to have the method I am going to use in my mind before I start to write anything. Another method i thought of was using linked classes, like a class for event, class for week, and class for month, but I dont think I need to do that if I can store and retrieve the files properly? Cheers!
  14. as far as I can guess, it would be easier for them to create their document in excell and save it as a CSV file? then I can create code to display that file in the page I want? These people know nothing of web pages and coding. They have previously been able to just throw a word document at their server and it is displayed in their site (though very poorly.) I would like to keep this functionality for them. Any ideas? I would also prefer not to have to tell them they need to create the CSV file, but....
  15. Also, their server has php, but no databases if that makes any difference :D
  16. I know very little about php and just what its functions can do. I have read you can read and write to files, but I am unsure wether what I would like to do is even possible. If it is, I dont mind doing the hard yards to learn how to implement it, but it is pointless if it is not possible. I have a client that has a timetable on their website. They used to drop a word document into a folder, and it would be read as an html file (though they didnt give it an html extension) It was a very old and clunky website, and I think it was written with some sort of microsoft application. (many of the files seem to be publisher documents, but anyway) What they would like to do is drop the word doc into a folder, and have it displayed on their site. (they accidentally fried and lost their old website, so I dont have it all as a reference to see how it worked) What I would like is for it to be displayed within the normal layout of the rest of the site. If I could take an html page (or php script) to inject the table in the word doc into the normal site layout then we are both winners. I relaise it is possible to make a script that displays a form for them to fill out, and then have this displayed as a table, but they are going to have to sit there for half an hour or more every week to write it up, and they would prefer not to have to take all this time out to do it. is it possible? :D Cheers!
×
×
  • 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.