Jump to content

dswain

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Everything posted by dswain

  1. I believe to use those variables (session and post variables) you need to change the quotations? <?php $sql = "INSERT INTO video VALUES ('0', '$_SESSION[id]', '$_POST[title]', '$_POST[video]', '$_POST[description_text]', '$_POST[category_text]', '$_POST[level_text]', NOW())"; ?> Should become: <?php $sql = "INSERT INTO video VALUES ('0', '" . $_SESSION['id'] . "', '" . $_POST['title'] . "', ..."; ?> I'm not 100% sure about that but I think that's the case. It might have to do with not specifying the columns you want to insert the data into.
  2. I'm not an expert on any mailing system, but how are you entering the addresses into the BCC line? For example, are you just dumping all of the addresses in as that variable or are you selecting ones with particular domains?
  3. No, sorry I don't believe it is. Check the ffmpeg docs maybe for that information.
  4. A templating class does sound nicer than any of the other solutions, so I'll agree with that (though I've never done it, so I don't know how involved it is). The only reason I say try to avoid the HTML within the PHP is because that's even harder to maintain, especially for other people who have to read your code. Just my experience talking at that point, but the templating system does sound good.
  5. If you have those files in the root of your directory, your code needs to point to those files all of the time. For example in your case since those files are in the root of your website (/) then you need to make sure you code points to the root of your website. If you just do an include with those files on each page, you're trying to tell PHP that the files are in the CWD and it won't be able to find them. Basically, just add the slash in front of the code (so instead of "include 'common_footer.php' make it "include '/common_footer.php'")
  6. Creating a good design and development page, as I've learned recently, is a bit of a challenge so I don't blame you. My advice would be to try and break down the code so that the hard processing (the actual upload and things) are done separated from the HTML itself as much as possible. For example, I try and make sure that my pages look something like this now: <?php Whatever PHP processing code I need to add here ... ?> <html> <head> <title>Whatever</title> Then you can add a link to a stylesheet here easily </head> <body> <form action=$_SERVER['PHP_SELF'] method=POST> Then you finish your upload form in here </form> </body> </html> Obviously there's a little more to it than that, but that's the idea. I try and break them up as much as possible now if I can. Hopefully that helps =)
  7. You should be able to do the include at the top of the file and have it display properly. To change the font, you'd have to use HTML and you should probably change it in the include file to keep it well organized. I'm assuming the menu is in HTML right?
  8. When you say "add" do you mean append the intro/outro video to the actual data of the movie or like display the video at the beginning and end of a page? If you mean append the data to the actual video, you'll have to use some command line tool and I guess you can execute it through PHP, but PHP won't do the video editing for you. If you mean display it on different pages of a web page, well then that's different.
  9. That sounds like something that the program you're executing will have to do, not really PHP. Maybe I'm mistaken, but I think that's the case.
  10. I believe you'll need to take the quotes off of the $profile_info variable within the if condition. I think you meant to put those around the level text. if ($profile_info['level'] > 0) { ... }
  11. Oh man, wow I'm sorry I'm an idiot. The thought didn't even occur to me to globalize the $counter variable. Talk about a duh moment! Thanks a lot! By the way, that was a very good explanation. I did know about globalizing variables but I wouldn't have thought to have called it the scope of the variable. Again, wow haha a real duh moment. Looks good now =)
  12. Haha yeah it happens to me also sometimes. Looks like fairly nice code otherwise though!
  13. Ah, it has to do with your form. Check this <label>Hackname: <input type="text" name="name" value="<?php echo $hackname; ?>" /></label><br /> <label>Description: <input type="text" name="name" value="<?php echo $description; ?>" /></label><br /> <label>Version: <input type="text" name="name" value="<?php echo $version; ?>" /></label><br /> See, you have each of those set to a name "name". Basically, you're setting $_POST['name'] three times over. Your variables are set up like this: $hackname = $_POST['hackname']; $description = $_POST['description']; $version = $_POST['version']; $hacksid = $_POST['hacksid']; So what you want to do is change those names in the form to match the variables. It'd be like this: <label>Hackname: <input type="text" name="hackname" value="<?php echo $hackname; ?>" /></label><br /> <label>Description: <input type="text" name="description" value="<?php echo $description; ?>" /></label><br /> <label>Version: <input type="text" name="version" value="<?php echo $version; ?>" /></label><br /> You did get the hidden value set right though for the hackid. I believe that should do it, however. Before you try that though, make sure those variables are outputting the appropriate data (so try and echo $hackname and such).
  14. What does the data in $_REQUEST['destination'] look like? I don't think you can just append the target='_blank' code to it and it would need to be inside of the <a> tag itself.
  15. I have a page which is I need to load multiple XML files in and then output certain data to. Using simplexml_load_file works fine for either of the streams (there are two in total so far) but they both cannot be used at the same time. <?php #Rewriting this Last.fm feed handler with SimpleXML. So much easier... it's asinine. include ("header.php"); #Setting up some vars. $username = 'dswain'; $total_items = 6; if (!isset($counter)) { resetCounter(); } function resetCounter() { $counter = 0; } ?> <html> <head> <title><?php echo $username . "'s last.fm data"; ?></title> </head> <body> <table width='65%' align='center'> <tr><td align='left'><h1>Top Artists</h1></td></tr> <td> <table width='50%' align='left'> <tr> <td><b>Artist</b></td> <td><b>Playcount</b></td> <td align='center'><b>URL<b></td> </tr> <?php $top_artists = simplexml_load_file("http://ws.audioscrobbler.com/1.0/user/$username/weeklyartistchart.xml"); while ($counter != $total_items) { echo "<tr>"; echo "<td>" . $top_artists->artist[$counter]->name . "</td>"; echo "<td align='center'>" . $top_artists->artist[$counter]->playcount . "</td>"; echo "<td>" . $top_artists->artist[$counter]->url . "</td>"; echo "</tr>"; $counter++; } ?> </table> </td> <td> <table width='50%' align='right'> <tr> <td><b>Artist</b></td> <td><b>Song</b></td> </tr> <?php resetCounter(); $recent_tracks = simplexml_load_file("http://ws.audioscrobbler.com/1.0/user/$username/recenttracks.xml"); while ($counter != $total_items) { echo "<tr>"; echo "<td>" . $recent_tracks->track[$counter]->artist . "</td>"; echo "<td>" . $recent_tracks->track[$counter]->name . "</td>"; echo "</tr>"; $counter++; } ?> </table> </td> </table> </body> </html> Basically, if I comment out one of the sections where it is trying to open the XML file, the other one will work fine, but not both at the same time. It seems like I would need to unload the simplexml data and then open up the new file, but I couldn't find any particular methods to do this in the PHP docs. http://swainnet.zapto.org/rss_more.php is the actual page which this code is being run from. Thanks in advanced, and sorry if this isn't very clear. Kind of awkward for me to explain.
  16. I'm not exactly sure if I understand what you're trying to do here, but it would really depend on your del_news.php file's code. The code you are showing us seems to just display the buttons for editing/deleting the entries, but none of the code to actually do the editing or processing of it. Maybe you can show us del_news.php, or maybe I'm just not understanding this well?
  17. Hm, no, I didn't. I just tried it now. I believe I have the syntax correct: $parser = xml_parser_create('UTF-8'); but that does not seem to have an effect either. I also tried to just leave it quoted (with no actual argument) and no luck with that either.
  18. Yes you can do exactly that with PHP and HTML. That's probably how this forum works here. Basically, you write the script so that if you tell it to execute a certain function, then it will give you a form and you can enter your text and whatever and the submit it. Then, you write another function in the script which will go grab that data you inserted into the database and output it as regular HTML. It basically looks like any other site, it's just getting the info from that database instead of a hardcoded webpage. It's tough at first, but it's well worth your time. I hate to spam, but if you want an example: http://swainnet.zapto.org/ is my site. That front page is MySQL/PHP/HTML running. I have another page where I can add/edit/remove entries from the database and this page gets the updates automatically.
  19. You have to make sure when you run the query you're checking this table. For example "Select * from deswo_list where id='$id'" needs to aim at that table in particular. Check that out firstly. The idea is basically you want that query to get all of the information from the table and pushed into an array. Once you do that, then you want to output this information (using a while loop and echo statements) so the users can see the current jobs in the database.
  20. Hey everyone. I'm pretty new here, and I'm fairly new to PHP in general, so I'm totally open to whatever you guys have to suggest. Anyway, here's what I'm trying to work on today: I have an RSS feed and I'm using PHP to output it onto my website. I have most of what I want working, except for one issue: http://swainnet.zapto.org/rss.php if you look here, you'll see that it shows that strange "–" character: in the XML, it looks as if it's suppose to be a dash. I tried to change the encoding of the XML parser trying something like this: <?php $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8"); xml_set_element_handler($parser,"startTag","endTag"); xml_set_character_data_handler($parser,"readTag");?> And I've set that to a variety of things (like US-ASCII, ISO-8859-1) but these changes had no effect. I also tried to strip the dash out with a strrpos and trim, but it seems to be acting like the character doesn't exist within the string. I also tried search for the strange character using strrpos, but it can't seem to find that either. Are there any ideas on what I may be doing wrong or what else I should look for? Thanks in advanced everyone. Oh and my code can be found here (if needed): http://swainnet.zapto.org/rss.txt
×
×
  • 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.