Jump to content

justsomeguy

Moderator
  • Posts

    31,575
  • Joined

  • Last visited

  • Days Won

    77

Posts posted by justsomeguy

  1. The username field is a unique field, it's the primary key. That means that it needs to be different for each record in the table. So you are getting the error because there is already a record with username "t". You need to search the database before you insert that.

  2. Well, do a search in the code for "<html". You are looking for the second one. There's one at the top of the page, and one near the bottom, so find the one near the bottom. Remove all of this:

    <html> <head> <title>Thanks for your comments.</title> </head> <body>

    You include all that code once to start the document, you can't have it anywhere else. So you also have to remove the ending code that shows up twice. Search for "</html" and look for this part:

    </textarea> </body> </html><br>

    Remove the </body> and </html> tags. Those tags end the document, and since you have more stuff after this, I'm assuming you don't want to end the document yet.Try that and see what happens.

  3. to justsomeguy: while i know there are many viruses which can capture key strokes, i am not aware of any malware which can read a document opened in an application such as word. am i underinformed?
    It doesn't have anything to do with Word, it can read the file itself from disk. Open a Word doc in a text editor, and see how much you can read from it.
  4. The escape character (/) provides a lot of characters: \n - newline\t - tab\' - single quote\" - double quote\\ - slashYou don't need space around them. And no, you cannot change text formatting in plain text emails.

  5. Maybe try something like this:

    <?php######################################################################## Copyright (c) 2006 TIArts.org# Coded by # http://.com#######################################################################include '../includes/header-members.php';// This will display by order of lastname then the rest just fills ininclude '../includes/db.php';$left_column = true;$col1 = "";$col2 = "";$result = mysql_query("SELECT * FROM users ORDER BY lastname ASC");while ($r = mysql_fetch_assoc($result)){  if ($left_column)    $col1 .= "<a href=\"http://www.tiarts.org/members/{$r['id']}.php\" title=\"{$r['title']}\"  onmouseover=\"main.src='http://www.tiarts.org/images/mem/{$r['image']}'\" onmouseout=\"main.src='http://www.tiarts.org/images/mem/bg.jpg'\" class=\"footer2\">{$r['name']}</a><br />\n";  else    $col2 .= "<a href=\"http://www.tiarts.org/members/{$r['id']}.php\" title=\"fabric artist\"  onmouseover=\"main.src='http://www.tiarts.org/images/mem/{$r['image']}'\" onmouseout=\"main.src='http://www.tiarts.org/images/mem/bg.jpg'\" class=\"footer2\">{$r['name']}</a><br />\n";  $left_column = !$left_column;}?><link href="../includes/tia.css" rel="stylesheet" type="text/css" /><table width="700" height="10" align="center"border="0" cellspacing="0" cellpadding="0"><tr>  <td><div align="center"></div></td></tr></table><table border="0" cellspacing="0" cellpadding="0" width="700" height="300" align="center"> <tr valign="top"  align="left">   <td width="125" height="225" rowspan="2" align="left" valign="top"><?php include '../includes/links-members.php'; ?></td>   <td width="153" align="center" valign="middle">       <div align="left"><?php echo $col1; ?></div></td>  <td width="228" align="center" valign="middle">       <div align="left"><img src="http://www.tiarts.org/images/mem/bg.jpg" name="main" id="main" style="height:200px;width:150px;" /></div></td>  <td width="194" align="center" valign="middle">       <div align="left"><?php echo $col2; ?></div></td> </tr></table><?phpinclude '../includes/footer.php';mysql_close();?>

  6. "MODULE_PAYMENT_MONEYORDER_TEXT_EMAIL_FOOTER"That's a ###### of a constant name.That's a plain text email, not html email. Line breaks are "\n". You can't add text formatting in plain text. Unless you have a good reason to use html, it's probably better to stay with plain text, it's more universal.edit: I can't say '######'?

  7. What do you the middle part of the table? It would be really easy to use CSS and position any image as a background image behind any part of the table.

  8. So you are saying you want to stay on the same page (don't reload the page) and have a message show up? That's fairly difficult to do with something as complex as email. You could do some tricks through javascript, but if they had javascript turned off it wouldn't do anything.It's probably just easiest to send it to another page. You can always send it to the exact same page, only have a message in the label this time.

  9. Apache only needs to know what the server it is running on is called. If you want to install Apache on a development machine on your local network, make sure that machine has a static IP address first. Then you can enter the IP address for both of those questions.If you are only trying to install Apache on a single machine (not access it from across a network), then you can just type in "localhost" in both of those questions.I tell this to everyone else, so if you are serious about learning PHP then I recommend you pick up Programming PHP, it will give you a good indication of what PHP is about.

  10. You can also use PclZip (they list PHPZip as one of their projects, I'm not sure what that's about):http://www.phpconcept.net/pclzip/index.en.phpAnd here's the documentation:http://www.phpconcept.net/pclzip/man/en/in...907b0d831a8b30bThis code extracts a zip file, and adds each of the files (images, in this case) to a database:edit: it also deletes the extracted files once finished.

    <?phprequire_once("pclzip.lib.php");//...$zipfile = new PclZip($filename);$zipfile->extract(PCLZIP_OPT_PATH, "zip_temp/", PCLZIP_OPT_SET_CHMOD, 0777, PCLZIP_OPT_REMOVE_ALL_PATH);$path = $temp_save . "zip_temp";	$dir_handle = opendir($path);	$path .= "/";while (false !== ($file = readdir($dir_handle))){	$valid = false;  if ($file != "." && $file != ".." && !is_dir($path . $file))  {    $components = explode(".", $file);    switch (strtolower($components[count($components) - 1]))    {      case 'gif':      case 'jpg':      case 'jpeg':      case 'wbmp':      case 'png':        $valid = true;        break;    }  }  if ($valid)  {    $data = fread(fopen($path . $file, "rb"), filesize($path . $file));    //add_image_to_db($path . $file, $data, $galID, $file);    $nr++;  }  if ($file != "." && $file != "..")  {  	chmod($path . $file, 0777);  	if (is_dir($path . $file))      rmdir($path . $file);    else      unlink($path . $file);  }}closedir($dir_handle);?>

  11. Well I'm sure the function does work, I highly doubt that the PHP group would include a function that just doesn't work. It might not work in your situation, or it might not do what you are trying to do, but I'm sure it works.All of the servers I've managed online have been Linux servers, and I've used cPanel to administer them. I haven't looked into the code for cPanel and I'm not sure specifically how they do it, but I'm sure they use perl scripts to interface with the OS to create another user account and set up a home directory for them. I'm not sure how they do it on Windows, anything that can access the Windows API I'm sure can do it, like .NET or C++.You might also try asking in the cPanel forums, but you have to register to even look at the posts.http://forums.cpanel.net/

  12. another advantage of IE.LG
    It's not an advantage of IE, it's a disadvantage of Firefox. Every browser should be able to do this.
    im sick of having to minimise the browser, right click on the file and go to open with->notepad
    You don't have to my brother, let me show you The Light.
  13. It sounds like you have scope issues.Scope is sort of the 'range of vision' that each function has. So take this for example:

    <?php#this is the root PHP code (scope 0)$some_var = array();global $another_var;$another_var = "test";$still_another = "test2";function func1(){  #this is a new scope block.  variables defined inside func1 are only available inside func1  global $another_var;  //use the global copy of another_var  if (!isset($some_var))    echo "some_var is not set in this scope";  echo $another_var;  //will print "test"  echo $still_another;  //will not print anything}?>

    Hopefully you can sort of see what's going on. There are 'global' variables and 'local' variables. Global variables are visible everywhere, but local variables are only visible in the scope they are declared in. Since func1 has it's own scope, it cannot see the $still_another variable because that variable is a local variable in another scope. However, it can see $another_var because $another_var was declared to be a global variable (with the 'global' keyword).When you include or require a file, it brings all of the code in the new file into the same scope where the include or require statement shows up. So if you have your include/require at the top of the page, the included code will be in the global scope. In order to use the global copy of the variable (like the users array), if you use it in a function you need to declare the variable globally. All this sounds confusing, but it's pretty easy.

    <?phprequire_once("users.php");$size = count($users); //same scope, we can use $usersfunction login_user($username, $password){  global $users; //make sure we are using the global version  $size = count($users);  //this will work, we are using the global version of $users}?>

    http://www.php.net/manual/en/language.variables.scope.phpAlso, if you are trying to get the user's IP but you are getting the server's IP, you are looking for the wrong thing (the user's IP will never equal the server's IP). $_SERVER['SERVER_ADDR'] gets the server IP, $_SERVER['REMOTE_ADDR'] gets the user's IP.http://www.php.net/manual/en/reserved.vari...ariables.server

  14. What kind of extensions does it come with? Do you find yourself wanting anything included in the manual PHP zip install that is not included in XAMPP?Also, scotty - if you're learning PHP and are serious about learning it, I recommend you pick up Programming PHP (I should be getting a cut from sales..)

  15. There are enough "mediocre" web developers out there that, unless you make yourself stand out from them, it's really easy to get lost among everyone else. People who know HTML/CSS are a dime a dozen, if you want to be able to pull in jobs you need another skill. You can either focus on graphics and make yourself stand out in design, or you can take on something like PHP and focus on functionality, but being plain old HTML/CSS probably won't get you very far. If you want to learn PHP, it's never a bad idea to take a 1 or 2-year college course on programming. If you want a good book to start with, try Programming PHP.codehtml.jpg

  16. OK, I think you're a little bit confused. When you send email from a web page, there are basically two options. This is the first one:

    <a href="mailto:test@test.com">Click here to email</a>

    When someone clicks on the link, their own mail client will launch. So they click the link, and Outlook, or Thunderbird, or M2, or (god forbid) Goldmine or whatever opens with a new message to the address in the link. The person writes the email, hits send, and the email gets sent through the mail server that the user normally sends all their other email through. In this scenario, the web server doesn't do anything.The second option is to have someone fill out a form, press a submit button, and the web server creates and sends an email to some address. If you want to do this, you need the form to submit to some server-side scripting page (PHP, ASP, JSP, etc). The webserver running the page probably needs an email server installed on it, or at least have communication with another email server that it can get a message to. The server-side page will process the form, create an email, and pass it along to the mail server to send.If you want to do the second option, you need to find a web host that supports the language you want to use, either PHP or ASP or JSP. PHP is probably the easiest for a beginner. You can do this on your own computer if you really want to, but you will need to install and configure web server and email server software on your computer, in addition to installing PHP itself. It's much easier to get web space, or have your teacher provide you with web space.To set the form action, you do this:

    <form method="post" action="process.php">

    The process.php file will receive all of the submitted data.

  17. Also, I just have to ask..

    a form and a fourm are 2 very different things...fourms easy the basics
    What exactly is a "fourm"? I thought it was a misspelling of something else, but you used it twice. What are you talking about?
  18. The sidebar shows up at the bottom because you aren't telling it to be anywhere else. The CSS for the sidebar only sets the width and which side clears.I'm not sure specifically why people can't post comments, but you do have a closing body tag, closing html tag, and a new html, head, and body right in the middle of the document. I'm not sure what the browser is doing with that, but I guarantee it's not doing what you expect it to. It's like you pasted an entire html page right in the middle of another one.Also, just a side note. There's no way to stop your users from viewing source code or saving images, or whatever the reason is for capturing right mouse clicks. Anyone can just turn off javascript and right-click as much as they want. All that does is irritate your users.f12.jpg

  19. I tried to use else, but i didn t know how, especialy hot then write response.write. So,... If user have value select from one tbl and give me selected data if not slected ( default ) form second tbl and give data from second tbl in DB
    That made my eyes cross.I'm a little confused what you are asking, but this is how you format an if-else statement:
    if <condition> then  <statements>else  <statements>end if

  20. Yeah, cookies, sessions, all that type of stuff are all contained in headers. There is an HTTP header called set-cookie that specifies a cookie to save on the client. The session itself is actually just another cookie, which contains a session ID number that the PHP engine uses to look up all the info saved in the client's session.

×
×
  • Create New...