![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
Ninjakreborn
Members-
Posts
3,922 -
Joined
-
Last visited
Everything posted by Ninjakreborn
-
Ok, I have to ask about this. There is something wrong with php info ON my computer specifically. I was thinking about trying his other solution of wimp, but I couldn't give up on apache. It has nothing to do with apache. Apache, mysql, php, phpmyadmin, all work perfectly. NOTHING with php info come's up. I don't care how stupid I seem now, I am fairly competent. What happened was I installed wamp, it all went perfect, (except phpinfo() would not run on any page Then I did a manual install, everything finally went well, until phpinfo() wouldn't work, then I corrupted it by messing with it, trying to make it work. Then I tried XXamp, everything worked, again except phpinfo() Is there anything that could be related to my operating system, or my computer specifically I need to change, to allow me to use phpinfo()?
-
[code]1 ) Do you have to place SessionStart(); at the top of EVERY page that makes use of the session? 2 ) Do session variables carry over from 1 page to another automatically? IE I set up variables in 1 session on the login page then return to main, will it remember the same user name?[/code] 1. Yes unless session autostart is turned on, in the ini file 2. Yes. If the session start is at the top, as long as session destroy isn't called, and the browser isn't closed (iunless you modify there lifetime in the ini file.
-
Neither am I, I have been fighting with something with XMl for awhile. It can get tricky.
-
Still having loads of problems. I have ran out of xml parsing tutorials, and read the manual dry of each function. Any input at this point is appreciated.
-
[quote]i think what you may want to do is look into RSS feeds. converting the output of the search query into an XML format (temporarily) and then prompt the user to download the file.[/quote] Actually that was a very good idea, and very valid point.
-
By what it sounded you are trying to limit the amount of queries that can be ran. There really isn't a point. The only way I can think, is database the ip, and increment a number everytime someone run's a query. THen when they reach a certain amoutn stop there future queries for a specified amount of time. In the end you have used extra queries, and defeated the whole purpose anyway.
-
I still don't understand. They are running searches from a database? See generally to show a file, you just create the file, save it somewhere, present a download link. Optionally you can delete it later, or when they are done, if you can. [quote]Well the question was really how should I propose the download option? and really how should I go about creating a new file which the file name will already be provided[/quote] The download option, can only really be offered as a direct link. I guess you could start an auto-download when they do the search, but I really don'tt hink there is anything youc an do to start a download automatically, without them clicking on something, or something similar As far as how to go about it, there is only 1 way. Create the file. you can create it, and save it, or create it, and maybe there is a way to offer it directly, but I think it has to be saved, before it can be offered for download.
-
Ok, an array itself just depends If you are dymanically creating arrays, they stay in memory for the duration fo the script with no statesaving. For instance, if you made an array based on someone's actions, or something, it will clear when they close, the browser. Actually it will clear when they change pages. If a database, get, post, session, cookie or something isn't making the data stick, the array is cleared everytime they load a new page. Other than that, I don't still understand enough to help beyond that.
-
So, have you come to a solution to your problem. If so rephrase another question, so we can look into this more for you. I gave you the answers I could based on the understanding I gained of what you had originally said.
-
You really could clean that up a bit. Conventionally. it is just done with [code]<?php if (mail($to, $subject, $message, $headers)) { echo "success message here"; }else { echo "Failure message here"; } ?>[/code]
-
Yes, pass the timestamp into the date function. You can format it, using hte modifiers in this reference on the php manual. http://us2.php.net/manual/en/function.date.php It will be $date = date("modification based on that table goes here""timestamp", "modification based on that table goes here");
-
For open/close the window you can use javascript, but there has to be some form of action for that to happen. I am not 100% sure how your querie's, are saved. If they are saved through a get query, they can just bookmark the page. If you are wanting to allow them to generate a download temporarily, then delete it, You would have to somehow, unlink the file after they have downloaded it, by them giving some kind of signal, it was downloaded. Or you could email them the file. Create it, email it to them, and never save it anywhere.
-
[quote]header('Content-Type: image/png');[/quote] That is what you would want to look at. http://us2.php.net/header
-
Oh, you can fwrite it all into a temporary file, store it in a temporary directly, and give them a link dynamically to download that specific temporary file. Or save the search result's into a database, so you can replicate them later as needed.
-
[quote]Odd, I can't edit my own posts?[/quote] 15 minute limit on editing time for this form, 2 minutes for others (or it was last time I checked) About your other problem, maybe there is just a different in the way normal variables, and OOP references are used during extrapolation. I ran some searches on google, and didn't see anything about it. In this specific situation, you are calling a function. I don't know if you can directly just call a function in the middle of it like that.
-
Can you reexplain that one more time. I see a little of what you mean, but what kind of program/website is it. What kind of queries. How often do they need ran? WHat do you mean exactly.
-
Can you re-explain that one more time?
-
Ajax. You can use output buffering, to slowly display messages on the screen, as far as the status. Well even then I don't see that working. You can use a graphic, but with straight php that won't work either. Ajax, is what you would want to get something showing what is happening, while the page loads in the backaground.
-
First get the full number of id's in the array. Then take the total number of id's. Subtract 1, then run the same query, using the specific id, you got from the calculations.
-
Sorry, that was my lack of reading. After reviewing mktime, it seem's it will handle everything like that behind the scenes. Thank you for the advice.
-
[code]<?php // Build an array with all the channel names. $channels = array ("I11187", "I11829", "I11269", "I11768", "I11993", "I19556", "I11490", "I11479", "I11959", "I23319", "I18774", "I11287", "I12553", "I24634", "I23324", "I22564", "I23327", "I23328", "I23329", "I10240", "I10244", "I10241", "I18429", "I16585", "I24553", "I10243", "I10021", "I12852", "I16374", "I10142", "I10145", "I10139", "I10161", "I10162", "I10035", "I10057", "I10051", "I10153", "I11097", "I11163", "I11164", "I11207", "I10149", "I10989", "I14321", "I14909", "I10918", "I16409", "I45654", "I10179", "I12444", "I16485", "I12410", "I14899", "I14776", "I16011", "I20789", "I10986", "I16361", "I10138", "I11218", "I44228", "I11180", "I16331", "I11150", "I16615", "I18327", "I16617", "I16618", "I18284", "I16616", "I18544", "I18179", "I11158", "I14902", "I14771", "I12574", "I26784", "I10093", "I12131", "I10171", "I11006", "I16123", "I30103", "I21450", "I19059", "I18332", "I25354", "I31634", "I19283", "I18644", "I21852", "I21063", "I24935", "I24248", "I29323", "I28452", "I12324", "I16345", "I10239", "I11118", "I15377", "I27773", "I19247", "I18715", "I19979", "I25238"); // Build the file name's dynamically based on the above file names. // register empty array to hold the upcoming information $files = array(); // run through all the channels, assining there full file names into an array foreach ($channels as $k) { $files[] = $k . ".labs.zap2it.com.xml"; // assign each file name into the files array } // attempt to create an xml parser if (!$parser = xml_parser_create()) { exit("There was a problem creating the parser"); } // Functions To go into the element handlers, later on // variables to pass to user functions $currentdate = date(); $showstarttime = ""; $showstoptime = ""; $tag = "<programme></programme>"; $attributes = "@start, @stop, <title>, </title>"; // function to start searching function starttag($parser, $tag, $attributes) { } // function to end searching function endtag($parser, $name) { } // function to take data from tags function tagdata($parser, $data) { } xml_set_element_handler($parser, starttag(), endtag()); xml_set_character_data_handler($xmlparser, tagdata()); // use the file array created earlier to get to work // create an array to hold information on all the currently playing shows // from all the xml file's $nowplaying = array(); foreach ($files as $k => $v) { // run through all the file's if (!$open = fopen($v, "r")) { // opening them // we can't do anything if any file's didn't open, because we don't have all the // necessary data, so kill the script exit("File could not be opened"); } while ($data = fread($open, 4096)){ if (!xml_parse($xmlparser, $data, feof($open))) { $reason = xml_error_string(xml_get_error_code($xmlparser)); $reason .= xml_get_current_line_number($xmlparser); die($reason); } } }// close foreach ?>[/code] Ok, I went through about 8 tutorials, and got somethign together. I worked this up, and ran into a lot of error's. I checked some references, and did some fixes, and removed a lot of the errors. "I have another post open on misc about the date, I have to work that in after I get it doing the basics". I went over the tutorial on w3schools, and other places about xml/xsl and after thinking, because of WHAT I am wanting to do here, it's best to parse the file's with php, and return the results. since I have to get an updated copy everytime someone comes. Each channel is in a sepearet page, here is some example coding, that a channel might contain [code] <programme start="20070129140000 -0500" stop="20070129150000 -0500" channel="I44228.labs.zap2it.com"> <title lang="en">mtvU Video Hour</title> <category lang="en">Music</category> <category lang="en">Series</category> <episode-num system="dd_progid">SH684893.0000</episode-num> </programme> <programme start="20070129150000 -0500" stop="20070129160000 -0500" channel="I44228.labs.zap2it.com"> <title lang="en">mtvU Video Hour</title> <category lang="en">Music</category> <category lang="en">Series</category> <episode-num system="dd_progid">SH684893.0000</episode-num> </programme> <programme start="20070129160000 -0500" stop="20070129170000 -0500" channel="I44228.labs.zap2it.com"> <title lang="en">BFOC Student Film of the Week</title> <sub-title lang="en">Urban Shogun</sub-title> <date>20070126</date> <category lang="en">Art</category> <category lang="en">Limited Series</category> <episode-num system="dd_progid">EP895481.0001</episode-num> <episode-num system="onscreen">101</episode-num> </programme>[/code] I have to look at each file. Inside each file I have to look at all the contents of each pair of <programme> tag's. I have to check the start time and stop time doing this calculation if the start time is less than the current time, AND the stop time is greater than the current time, then pull the title out, and save it in an array (I guess I will call title). I need it to do that, for all of them, so I can get a list of 1 programme (the one playing now) for each and every channel. I know my current script has a long way's to go. However when I first did it, I ran into many errors. I am down to there. [quote]Warning: Wrong parameter count for date() in /home/wiltm/www/test/nowplaying.php on line 123 Warning: Missing argument 1 for starttag() in /home/wiltm/www/test/nowplaying.php on line 129 Warning: Missing argument 2 for starttag() in /home/wiltm/www/test/nowplaying.php on line 129 Warning: Missing argument 3 for starttag() in /home/wiltm/www/test/nowplaying.php on line 129 Warning: Missing argument 1 for endtag() in /home/wiltm/www/test/nowplaying.php on line 133 Warning: Missing argument 2 for endtag() in /home/wiltm/www/test/nowplaying.php on line 133 Warning: Missing argument 1 for tagdata() in /home/wiltm/www/test/nowplaying.php on line 137 Warning: Missing argument 2 for tagdata() in /home/wiltm/www/test/nowplaying.php on line 137 Warning: xml_set_character_data_handler(): supplied argument is not a valid XML Parser resource in /home/wiltm/www/test/nowplaying.php on line 142 Warning: xml_parse(): supplied argument is not a valid XML Parser resource in /home/wiltm/www/test/nowplaying.php on line 155 Warning: xml_get_error_code(): supplied argument is not a valid XML Parser resource in /home/wiltm/www/test/nowplaying.php on line 156 Warning: xml_get_current_line_number(): supplied argument is not a valid XML Parser resource in /home/wiltm/www/test/nowplaying.php on line 157[/quote] I have done a lot of legwork, before bringing this here, I didn't want to just come here, and dump a bunch of problems, so I ahve fixed what I can. Tutorials are good, I am about to also sign up (today) for the orielly bookshelve again. IN hte meantime I have done all the tutorials I could find, referencing the manual, as much as I could. Is there another tutorial I could look over (or 2) I may not have used, so I can try and refine my code more. Or pointers on how to get this going in the right direction for what I am going to do.
-
[quote]break it into substrings and use mktime(); Year, month, day, hour, minutes, seconds. 2007 01 29 00 00 00[/quote] Ok, thanks for the input. After looking up mktime http://us2.php.net/manual/en/function.mktime.php That is just what I need. Substr, will be easy since all of them are the same length. Last thing, do I need to take into account the -0500 or does mktime work independent on that, or is browser specific?
-
[quote]EST... I'm not sure what date/time format that is, but it's obviously indicating GMT -5 hours, which is EST[/quote] Thank you for the attempt. atleast the gmt part makes sense [quote]dont know what the 20 at the start is but the numbers that follow are year (07) month (01) and day (29) and rest of the zeros are hrs(00) minutes(00) and seconds(00) so if it was today and now(ish uk time) it would be 20070130191530 (timezone offset)[/quote] I thought the 20 was for 2007. Even after reading your description, all I can get is 2007 01 13 I was thinking 01-13-2007 for the date then the remaing 0191530 was a unixtimestamp I am still confused as to what this timezone is, or how I can work with it in php, thank you for the attempt [quote]I assume the 20 is for 2007 YYYYMMDDhhmmss -hhmm[/quote] That is what I was thinking, that was about all I could get out of it. [quote]good point ober how stupid of me[/quote] You tried [quote]Paul - think maybe the 20 is for, oh...2007? :-P The other 6 0's are likely H:i:s - so it's midnight. (edit: didn't preview, sorry.)[/quote] Good point, thanks for the insight. So with all of that said, in order to work with this date, in php. (For instance, I need to take a look at the current time There, we have the current time. $date = strtotime(time()); Now we have the current time. So from here I need to convert the other time into unix, so I pass that date strtotime("20070129000000 -0500"); Then I can do calculations, I need to do some mathematics with this. [quote]start="20070129000000 -0500" stop="20070129010000 -0500" start="20070129110000 -0500" stop="20070129113000 -0500"[/quote] There are hundreds more, these are the format's I have to work with. So I need to just convert these values to a unix timestamp all togehter, then I can transfer them into any date I want, and do calculations, or is that -0500 going to cause problems transfering it to a timestamp? Thank you so far for all the feedback, it is greatly appreciated and helpful.
-
20070129000000 -0500 What time setup is this?
-
Thanks both of you, I will look over these, and get some stuff done on it. Thanks for the advice.