Jump to content

justsomeguy

Moderator
  • Posts

    31,575
  • Joined

  • Last visited

  • Days Won

    77

Everything posted by justsomeguy

  1. You can also use PHP to create an image that shows the email address, but it wouldn't be able to be clicked on to email unless you still have javascript that obfuscates the address.
  2. I wasn't sure about that when I asked, I thought that maybe the operators also looked at the forum, or even just the suggestions area. I already emailed Hege Refsnes, so hopefully she can take a second to log into Network Solutions and make the change. Done and done. My suggestion was about the DNS, I just threw in the 1 line about guest accounts because I didn't want to create a forum account just to ask someone to update the DNS server. I didn't realize that would cause what it did, but it's not a big deal to me. It's your forum, you run it how you want.
  3. Interesting. Just for clarity, surround your variable with curly brackets (and add the single quotes): $insert = $_POST["sortorder{$row['id']}"];
  4. OK, let's back up. Post the relevant HTML and PHP code again.
  5. You can always just use a multidimensional array.$values[$x][$y][$z];Where 0 <= $x <= 80 <= $y <= 80 <= $z <= 3
  6. 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).
  7. 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']}'";
  8. 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)
  9. 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>";}
  10. Is there a question there somewhere that I missed?
  11. 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.
  12. 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.
  13. 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.
  14. 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.
  15. 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.
  16. 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.
  17. 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>";}
  18. Also take a look here:http://www.php.net/manual/en/features.file-upload.php
  19. 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/
  20. 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.
  21. 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.
  22. 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" />
  23. 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.
  24. 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
×
×
  • Create New...