Jump to content

Err

Members
  • Posts

    1,009
  • Joined

  • Last visited

Posts posted by Err

  1. Hi, guys.

     

    This question is a bit off-topic, but I rather ask it here than any other site because I know there are some very good developers on here and I'd appreciate their answers more.

     

    I've recently started re-skinning HTML pages, as in, moving the content of a page into a different page layout. Basically changing the footers and headers and leaving the content the same. I had an issue of coming across a badly coded page, which I fixed and submitted to the customer. The problem is, the customer doesn't want those errors fixed because it affects the CSS a bit, a CSS bug which I tried to fix but the customer would not accept it. He wanted the re-skinning of that page with those errors still there. I explained to the customer that I do not code that way I would never submit low quality work like that. The customer acknowledged, and feeling a bit conflicted I went ahead with the customer's request.

     

    I know some customers don't know about HTML rules and what not, but this customer has no excuse for not knowing this. What can I do about doing this type of work? Technically I am meeting the requirements the customer is requesting and it's not like I can complain to my boss because its within the work that I'm suppose to do. I want to avoid giving myself a bad reputation and I certainly do not want other employers seeing that I even touched this.

     

    It does not stop there, it is very likely that I will be having to do this again very soon. I don't want to lower my standards, but I am obligated to do my job. It's a bit of a conundrum.

  2. $file = $dir.$conn_id;if (file_exists($file)) {  echo "file does exist";}

    Try that. If that fails put var_dump($dir,$conn_id); and post the output of that here on the forums.

    • Like 1
  3. It's JavaScript that is doing that. You are messing with DOM stuff and it will try to close any tags you don't close. The only way I know to go around that is to simply load the response into the variable instead of printing it on the screen.So instead of doing this:

    document.getElementById("idn1").innerHTML=xmlhttp.responseText;

    Do this:

    var str = xmlhttp.responseText;

    After you do that, append anything you want to that string, THEN use innerHTML:

    document.getElementById("idn1").innerHTML=str;

    • Like 1
  4. $_POST['firstname'] gets assigned to $firstname in that line but it does more than that, so you should do the same for all variables. So something like this:

    $firstname = (isset($_POST['firstname'])) ? preg_replace("/[^A-Za-z0-9]/","",$_POST['firstname']) : "";$lastname = (isset($_POST['lastname'])) ? preg_replace("/[^A-Za-z0-9]/","",$_POST['lastname']) : "";$company = (isset($_POST['company'])) ? preg_replace("/[^A-Za-z0-9]/","",$_POST['company']) : "";$phone = (isset($_POST['phone'])) ? preg_replace("/[^0-9]/","",$_POST['phone']) : "";

  5. That's great. Can I offer some suggestions?I know you got your coding working like you like but there is a better way you can write your variables. Instead of doing this:

    $firstname = "";[...]$firstname = $_POST['firstname'];[...]$firstname = ereg_replace("[^A-Za-z0-9]", "", $_POST['firstname']);$firstname = strip_tags($firstname);$firstname = stripslashes($firstname);

    You can do this:

    $firstname = (isset($_POST['firstname'])) ? preg_replace("/[^A-Za-z0-9]/","",$_POST['firstname']) : "";

    You can put that at the very beginning. Basically, it checks if there a POST variable named firstname, if there is only allow A-Z a-z 0-9 and apply it to $_POST['firstname'], else just make it an empty variable. You should be using the preg* function since the ereg* function are outdated, even more so than mysql*. Since you are using the replace function to remove any characters you don't want, using strip_tags() and stripslashes() won't do anything more. You can do the above code with all your POST variables.

  6. I see the $con variable but I don't see from where you are getting it from, it just suddenly appears.

    $firstname = mysqli_real_escape_string($con, $firstname);

    I think you meant to make a connection first, then do the above code.

  7. If chater is an array you can loop through the numbers and assign back3 every time.

    var cnt = chater.length;for (var i = 0, i < cnt; i++) {  $("#mem"+chater[i]).class.back3;}

  8. I'm glad I'm getting feedback but if you can't think of a reason then I'm sorry to hear that. It's freeware as of now but maybe donationware later. Very neat trick. I saved the snippet for reference, could come in handy.

  9. I never claimed that my program is secure because it is different than phpMyAdmin. It is one feature that the file name can be changed but it is by no means my only security measure. That is the main point of posting my program here, I need debuggers; I am actively trying to find bugs and vulnerabilities in it, then I try to address them as quickly as I can. Of course, I am a single person that's doing this but my program is no where near as complex as phpMyAdmin. As for people installing phpMyAdmin. Great, if you can install or use phpMyAdmin then do that. If you can't get access to it or don't have permission to install it (as in people saying 'no') for whatever reason, then my program is a reasonable alternative.

  10. Links like that won't work. You would have to do something like <img href="mysite.com/xxx-xxx-xxx-xxx.jpg"> so instead of 0000.txt it is xxx-xxx-xxx-xxx.txt. Inside of xxx-xxx-xxx-xxx.txt could be the link to the image and the name:xxx.xxx.xxx.xxx.txt:

    img: http://mysite.com/xxx-xxx-xxx-xxx.jpgnam: Homer Simson

    Or, you can use just one text file and just put the ips, names, and images inside there.data.txt:

    ipx: 255.255.255.115img: http://mysite.com/255.255.255.115.jpgnam: Homer Simpsonipx: 255.255.255.120img: http://mysite.com/255.255.255.120.jpgnam: Lisa Simpsonipx: 255.255.255.125img: http://mysite.com/255.255.255.125.jpgnam: Bart Simpson[more... more... etc]

    Then you can use functions to extract the data based on the IP address.

  11. If your using the same page, you can simply remove document.php from the form. It will self reference without any help. The line is different because I put php code into the HTML which screws with it here on the forums. But don't worry, it's perfectly fine the way it is. GET is fine too. I'm simply used to using POST is all. I'm not sure why it's not working. That code there works fine, even how you have it set up. Can you post everything that you have so far?

  12. Yes, doing a 'real-time' form is possible. You have to use JavaScript. Doing something like that would require some basic JavaScript knowledge. As for your form reseting, that's because you need a server-side script to fill the form back in. You're in the PHP section so I'm gonna assume you have PHP. To keep the input boxes filled in, you need to get the value that was passed using PHP. Take a look at the below example, it's very plain and straight-foward. Forms:

    <form action="" method="post">  <input type="text" name="txtName" value="<?php echo $txtName; ?>" />  <input type="submit" name="btnName" value="Click Me" /></form>

    PHP (on the same page, but at the top):

    <?php  $txtName = $_POST['txtName'];?>

  13. I figured it out... sort of; in that I came to compromise.I created a file named error.php, inside of that I have:

    <?php  include('../error/index.php');?>

    The above code includes the index.php file from the /error/ directory. Then all I had to do is configure my .htaccess file:

    <Directory /var/www/mycoolsite>  ErrorDocument 404 /error.php?err=404  [etc...]</Directory>

    Thanks for the help.

  14. When I try /../error/index.php?p=404 I get:Not Found The requested URL /mycoolsite/error/ was not found on this server. Additionally, a 400 Bad Request error was encountered while trying to use an ErrorDocument to handle the request. /var/www/error/index.php?p=404:Not Found The requested URL /mycoolsite/error/ was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

  15. So I have an apache server with subdomains with subdirectories. I turn my directories into subdomains. So instead of example.site.com/mycoolsite it's mycoolsite.example.com. I do this with the .htaccess file with the below code.

    RewriteCond %{HTTP_HOST} ^mycoolsite.site.com$ [NC]RewriteCond %{REQUEST_URI} !^/mycoolsite/RewriteRule ^(.*)$ /mycoolsite/$1 [L]

    Great. Now it turns the directory into the subdomain. The problem now is that .htaccess can't reference the ErrorDocument I setup for my original subdomain. I can go to example.site.com/mycoolsite/aNonExistantDirectory/ and get the proper 404 I have setup, but when I try mycoolsite.site.com/aNonExistantDirectory/ I get the basic server 404 error page, not the one I have setup. Both are on the same server. To get around the problem, I can make a copy of the error documents and put them inside the /mycoolsite/ directory but I'm hoping I can simply reference the original error documents. The problem is, I don't know how to reference the error documents in /var/www/error/ to /var/www/mycoolsite/ I've tried:

    ErrorDocument 404 ../error/index.php?p=404ErrorDocument 404 /www/error/index.php?p=404ErrorDocument 404 www/error/index.php?p=404ErrorDocument 404 error/index.php?p=404ErrorDocument 404 /error/index.php?p=404

    None of those work. When try it without the first / or preceding .. it will display the error document line on the page. I'm stumped. I hope I included enough information, but if not, let me know.If I can't get my ErrorDocument's to work, would I be able to edit the first code above to allow for it?

×
×
  • Create New...