Jump to content

justsomeguy

Moderator
  • Posts

    31,575
  • Joined

  • Last visited

  • Days Won

    77

Everything posted by justsomeguy

  1. You could also just configure the server to send html files to the PHP engine, but that would slow down response times slightly for html pages. But you wouldn't have to rename anything.You can also use:include()include_once()require()require_once()Depending on what your requirements are (no pun intended).
  2. Wow, I missed a glaring step. Here's your query: $sql = "UPDATE page SET `sortorder` = '$insert' ORDER BY `id` DESC"; You are missing your WHERE clause, so all rows get updated with the same value (whatever the last value was, all rows will have that value). UPDATE queries also do not have an ORDER BY clause. Here you go: $sql = "UPDATE page SET `sortorder` = '{$insert}' WHERE id = '{$row['id']}'";
  3. You can't use fopen to write a file over http. The http protocol doesn't support that. One thing you can do is to create the file locally first, save it and everything, and then open a ftp connection to the subdomain and transfer it across.Here are the FTP functions:http://us2.php.net/manual/en/ref.ftp.phpYou will use functions in this order:ftp_connect (connect to the server)ftp_login (login to the server)ftp_chdir (change to the subdomain folder)ftp_put (upload the file)ftp_close (close the connection)
  4. There are a few things I would change. First, in your html you call the variable 'sortorder', and in the php you just say 'order'. That's an error.One thing I would change is not to use an array to pass post variables, just separate it with an underscore: echo "<td class='alt2'><input type='text' name='sortorder_{$row['id']}' value='{$row[sortorder]}'></td></tr>"; Which makes this part easy (there are a few changes):page.php?action=order: $sql = "SELECT * FROM `page` ORDER BY `id` DESC";$result = mysql_query($sql) or die(mysql_error());while ($row = mysql_fetch_assoc($result)){ $insert = $_POST["sortorder_" . $row['id']]; $sql = "UPDATE page SET `sortorder` = '$insert' ORDER BY `id` DESC"; mysql_query($sql) or die(mysql_error()); echo "<script type=\"text/javascript\">location.href=\"page.php?show=all\";</script>";}
  5. Is there a question there somewhere that I missed?
  6. It should be safe to change this option.I'm not entirely sure how webservers execute PHP (and each host I'm sure can do it however they want), but changing this should not affect others on the shared host. For security risks, there is only a risk if you make the directory world-readable. Make sure that only your account can access it, not the anonymous web account. Also browse to the directory (in a web browser) and make sure it does not show the contents. If it does, you can always add an empty index.php.You need to change the option every time you use sessions, it will not carry over from one execution of PHP to the next. Each time PHP executes, it loads the options from php.ini, so you will have to change it each time. If you have an include file with configuration options that you use on every page, that would be a good place for it.
  7. Wow.All I can say is this:http://us2.php.net/manual/en/install.windows.manual.phpThere's an entire section of the PHP website devoted to this, it's not something that can be listed in 1 post in a forum.
  8. Well, you can actually dynamically set where session info is stored. This is the ini option:session.save_pathYou can use the ini_get function to see the current value (ini_get("session.save_path")), and you can also use session_save_path to get/set this option:http://us2.php.net/manual/en/function.session-save-path.php (see the comments on that page as well)Just make sure you set the save path before any calls to session_start are made.
  9. Dan is correct, you are sending the javascript code before you send the actual page. You will want to send all of the page information, and display the javascript last (ideally, you will want the javascript to appear before the closing </body> tag, so you may need to indicate an error in message_rep.php, but have message.php or index.php check if an error occurred and actually send the javascript). This is the reason why both the page is blank and the content is misaligned - the browser doesn't know how to handle the javascript code coming first. If you want the popup over the page with the content already on it (not a blank page), send the page first, then send the javascript code.
  10. Hmm.. well, depending on what kind of access you have to the server, you could probably locate the directory where PHP is storing the session information (specified in php.ini), and simply delete all the files. You can go one step further, and get your own session ID, and delete all other files, so that you stay logged in. Of course, you can also just manually delete the files.
  11. I'm not quite sure I'm understanding correctly. I think though that you can only destroy sessions you have created, you don't have access to destroy a session that you haven't created.
  12. What you have: $query = "SELECT * FROM challanges WHERE (challanger = '$user' OR challanged = '$user') AND declined != '$user' ORDER BY id DESC";$result = mysql_query($query)or die(mysql_error());while($row = mysql_fetch_array($result)) {extract($row);echo "<a href='console.php?p=EditChallenges&cid=$id'>$challanger vs. $challanged</a> - $date<br>";} When you make the query, and start the while loop, you are using mysql_fetch_array, which results in $row[0], $row[1], $row[2], etc. If you want $row['id'], $row['challanger'] (btw, it's "challenger") you need to use mysql_fetch_assoc instead. Try this: $query = "SELECT * FROM challanges WHERE (challanger = '$user' OR challanged = '$user') AND declined != '$user' ORDER BY id DESC";$result = mysql_query($query) or die(mysql_error());while($row = mysql_fetch_assoc($result)) { extract($row); echo "<a href=\"console.php?p=EditChallenges&cid={$id}\">{$challanger} vs. {$challanged}</a> - {$date}<br>";} You can also do this: $query = "SELECT * FROM challanges WHERE (challanger = '$user' OR challanged = '$user') AND declined != '$user' ORDER BY id DESC";$result = mysql_query($query) or die(mysql_error());while($row = mysql_fetch_assoc($result)) { echo "<a href=\"console.php?p=EditChallenges&cid={$row['id']}\">{$row['challanger']} vs. {$row['challanged']}</a> - {$row['date']}<br>";}
  13. Also take a look here:http://www.php.net/manual/en/features.file-upload.php
  14. You need a webserver to execute your PHP files and send the result to the browser. When you have your browser visit an address that ends in .php (like you are now), your browser asks the server for that PHP file. The server in turn executes the PHP code, and instead of sending your browser the PHP code, the server sends the browser what PHP tells it to.The easiest thing to do in your case, unless you want to install your own webserver for testing (Windows does include one you can use), and then install PHP on the server, is rent a server online (or find someone willing to let you use theirs). Here's a good host for $2/month:http://geekhosting.com/Then what you have to do is connect to the server through FTP, upload your PHP files, and visit them in your browser. If your site is called mysite.com, and your PHP file is page.php, you would FTP to mysite.com, upload page.php, and then in your browser visit http://mysite.com/page.php to see the result. ASP works the same way, except it only works on Microsoft servers. If you want to learn PHP well, I can recommend this book:http://www.oreilly.com/catalog/progphp/
  15. justsomeguy

    SQL or PHP?

    If you are using MySQL:http://www.php.net/manual/en/function.mysql-error.phpAlso, it would be helpful to describe what happens when you execute the code instead of saying that it doesn't work.
  16. justsomeguy

    PHP Editors...

    Notepad is terrible for coding.I prefer ConTEXT (http://www.context.cx/), but I also like some of the features of PSPad (http://www.pspad.com/). It's hard to beat a logo that features a dog with a butthole.
  17. One thing you might try is to remove the </input> closing tag, it's not necessary. IE might be confused over that. If you are going for XHTML conformity, you can close the input tag like this: <input type="image" name="msearchitem" src="butt_chairs.jpg" value="CHAIRS" />
  18. You probably want to ask hotmail about this. Also try copying and pasting the headers for an email you received (not the code, the headers that the actual email contains). You may need to reconfigure the mail server to send out different headers.
  19. You can use this function to bring all request variables into the global scope:http://www.php.net/manual/en/function.impo...t-variables.phpOnce you do that, you would have to use 'variable variables' to refer to the individual request variables: inport_request_variables("p", "varprefix_");$varname = "varprefix_" . $fileinfo[0];echo "the value of {$varname} is {$$varname}"; //note the double $ signs More on variable variables:http://www.php.net/manual/en/language.variables.variable.phpHowever, your example should still work. You should also be able to do this: $varname = $fileinfo[0];echo $_POST[$varname]; If you are getting an array index error, you could try changing the error reporting in php.ini to not report those errors (the value would just be ""), or you can also check to see if the value has been set before using it: $varname = $fileinfo[0];if (isset($_POST[$varname])){ echo $_POST[$varname];} More on the isset function:http://www.php.net/manual/en/function.isset.php
  20. There's also the reference on php.net for sessions:http://www.php.net/manual/en/ref.session.phpNot a tutorial per se, but still very helpful.
  21. That's the guest's problem, not the community's, or maybe they simply just want to remain anonymous. I am 26. I have a BS in computer science from Arizona State, I hold a job working four 9 hour days per week (currently writing hardware simulation for a military project), and I also co-operate a home-based web development business out of my house on the 3 remaining days of the week, as well as nights. I also own my own house, and have built a porch, a garage, laid a wood floor, and painted the entire interior over the past 2 years. I'm not trying to be condescending here, but if your title is 'moderator', I would expect that you would indeed take the responsibility that comes with the title (and before you get angry at me, I'm not trying to imply that you aren't doing your job). I wasn't trying to imply anything else, but the replies I have gotten over the guest suggestion have mostly revolved around not wanting to deal with messages that require moderation. No I'm not, I was replying directly to the author of the quote I referenced. I didn't make that clear, but I was. I'm only trying to give my reasons for why I think guest accounts should be allowed, and rebutting other people's reasons for not wanting them if I think the argument is incorrect. Yes, Opera will fill in the extra parts, but it requires a few extra seconds of waiting while it sends out the various DNS requests. Not a big deal, but my main reason for asking the DNS fix is so that I can simply refer people to "w3schools.com", and have the web site respond when they type that in. Of course not, that's why moderators are required. Which is why the requirements don't change for guest accounts, moderators are still required either way. Now I never made that claim or accusation, that's not the language that I used. I'm not trying to be offensive here, I apologize if I came off that way.The arguments against guest accounts have been:1) aspnetguy's argument to promote long-term involvement, which is a valid argument that I haven't argued against.2) an increase in spam will follow. I don't consider this argument valid, because a bot could already create an account and post a spam. There already is no spam protection and I haven't seen any spam (I haven't looked for it either, and I doubt any would be left regardless).3) leet-speak will follow. This argument is completely without logic. I fail to see how guest accounts and people who use leet-speak are related.Now this thread is completely off-topic from the point of the forum, so at this point I'll drop it. I didn't mean to ruffle any feathers, I was genuinely trying to suggest that it would be an improvement, I think it would encourage more people to seek help. If that's not the consensus, then I'll drop it.
  22. That's simply not true. The link I posted above is to a forum for a programmer's text editor, and the rules are almost always followed, even by guests. If they aren't, then like I said, that's what moderators are for. If everyone always followed the rules, then you wouldn't need mods.Also, I just have to say this. Make sure I get it right:leet-speak: badgiant pictures of tired web cliches in your signature: goodIs that about right? If that's the attitude you want to project, fine, but that's not very conducive to having a helpful, inclusive community.From what I see the mods saying, I realize that this isn't going to happen, I'm just trying to point out that your reasons for not wanting to do it are not very good reasons, based on the forums that I visit. It seems that the mods would rather not do the extra work of actually moderating. I'm simply trying to reason with you. That, however, cannot be reasoned with.
  23. Sheilds UP is a free service from Steve Gibson, I don't think he advertises anywhere.I should also mention that Steve Gibson has his web site at grc.com (Gibson Research Corp.).
  24. One example would be the forums at http://forum.context.cx, granted there is the occasional Asian language ringtone spam, but I guess that's what moderators are for. But there I have seen a lot of people start off as guests and later register once they realize no one bites.
  25. 1. Update your DNS server to redirect all requests for w3schools.com on port 80 to www.w3schools.com. Seriously. There's no technical reason why you can't. It looks lazy, and considering the site's content, it looks incompetent. It would be nice to be able to refer people to go to w3schools.com, it's easy to remember, but instead I have to make sure I specify and they understand that they have to type in the www subdomain for it to work, or else I field questions from people saying they can't get to the server.2. Allow guests to post on the forum for people who don't plan on posting more than 1 message.Thanks.
×
×
  • Create New...