Jump to content

JonnoTheDev

Staff Alumni
  • Posts

    3,584
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by JonnoTheDev

  1. Add the addresses to a table. You will have to run the query on all pages of your site, so a common include is best: $res = mysql_query("SELECT * FROM table WHERE ip='".$_SERVER['REMOTE_ADDR']."'"); if(mysql_num_rows($res)) { // redirect user header("Location:http://www.google.com"); exit(); } However this query is going to have to run on every page access. You are far better just adding addresses to an .htaccess file rather than updating your httpd.conf and restarting apache.
  2. $getinfo is the result of a mysql_query() function call, not a string. You are using it as a string in the following code. $getdetails = mysql_query("SELECT * FROM $getinfo WHERE post_subject='Details'"); There should be the name of a table in its place $getdetails = mysql_query("SELECT * FROM tablename WHERE post_subject='Details'");
  3. Of course it is possible however it is probable that your results can be achieved with a single query.
  4. Read the STICKY (link posted above) This must come before any screen output. header("Location: survey.php"); i.e. <?php if($_GET['x']) { header("Location: survey.php"); exit(); } ?> <html> <body> <p>some content</p> On another note, the code you have posted contains the username and password from your database connection. Be careful when posting snippets of code.
  5. Using ftp requires your users to have access to an ftp client (and be able to set it up). Using ftp functions through a server side script within a browser will still require the user to upload a file to the server. Server side ftp is used to transfer files from the server to another ftp server. PHP is server side, not client side! For large file uploads I often use http://uber-uploader.sourceforge.net/ This at least shows the progress of the file upload.
  6. I cannot believe that you are allowing users to post adsense javascript into your forms! Javascript can be malicious! If this is displayed within your blogs then you are in trouble. You could have trojans and all sorts being downloaded from your site. It is an attackers playground! Also, why would you even use client adsense. Why not put your own adsense code within the blogs and make ppc yourself. There will be little or no return for a blogger to even bother using adsense on your site.
  7. Via a web service. It may be requested via SOAP call, XML-RPC, REST, or you may be provided with an API. However don't just expect companies to give you immediate access to make requests to their servers, there is quite a complex approval procedure with some of them. Your client should have researched this and know the third parties where the data will come from. They should apply for accounts with them. It is not upto you as the developer to get involved in this procedure, only to implement whatever is required in the codebase of the system.
  8. To maintain persistence you would store data in session variables. i.e <?php // test1.php session_start(); $_SESSION['abc'] = 'foo'; $_SESSION['def'] = 'bar'; ?> <?php // test2.php session_start(); print $_SESSION['abc']; print $_SESSION['def']; ?>
  9. As mentioned earlier in the thread I think, if your client is making a return on his investment in your time then your rates are perfectly acceptable to him. It is the relationship between you and the client that is most highly valued. If the client can converse with you about exactly what they require and you deliver, he will be happy to pay your given rates. Of course development costs can vary and your client may get cheaper rates elsewhere, however they may not get the same business relationship that they require. I have had many a client go elsewhere (usually overseas) for cheaper rates. The funny thing is that most of them return as they cannot get the same business relationship that they originally had, and usually have had some issues communicating their needs to other developers. Do not worry about what other developers charge. You may actually be undervaluing yourself.
  10. Put the anchor under the form further down the page! </form> <a name="results"></a> It does work. I use this method a lot.
  11. As I have stated, the example I have posted will do this. LOOK AT THE FORM ACTION ATTRIBUTE! Just add your validation code into the appropriate place.
  12. The example that I have just posted does this. It will post the form and return to the anchor point. If you use a header redirect you will lose all the data on the page including any errors. That is why I have stated you should only use a header redirect when the form is correctly validated and you have finished with the post data. headers should only be used prior to sending any output to the screen or you will receive an error. Look closely at the example I have posted again. You should not be trying to reload the page to scroll to an anchor point.
  13. Yeah, but it looks messy. Why create a variable when the value is already stored in the post array. Just clean the array values in one go. <?php $fields = array('city_name','city_desc','city_meta_keywords','city_meta_desc'); foreach($fields as $field) { $_POST[$field] = mysql_real_escape_string($_POST[$field]); } $result = mysql_query("INSERT INTO ".$tbl_name." (city_name, city_desc, city_meta_keywords, city_meta_desc) VALUES('".$_POST['city_name']."', '".$_POST['city_desc']."', '".$_POST['city_meta_keywords']."', '".$_POST['city_meta_desc']."')"); ?>
  14. Dont do this! if ($error!=""){header('Location: mypage.php#error');echo "<span id='red'><font size='2'>Please fill out the following required fields:</font><br />$error</span>";} Submit the form to the page along with an anchor tag where your errors will be displayed. Only redirect the user to a new page if the form was filled out successfully i.e <a name="results"></a> <?php if($errors) { // display errors } ?> <form method="post" action="process-form.php#results">
  15. Also why use php to echo static text? <form action="<?php echo 'UpdScroll.php';?>" method="post"> <form action="UpdScroll.php" method="post"> <div><input type="submit" name="UpdateSubmit" value="<?php echo 'CHANGE';?>" class="SubmitOn" /></div> <div><input type="submit" name="UpdateSubmit" value="CHANGE" class="SubmitOn" /></div>
  16. <?php $result = mysql_query("INSERT INTO ".$tbl_name."(city_name, city_desc) VALUES('".mysql_real_escape_string($city_name)."', '".mysql_real_escape_string($city_desc)."')"); ?>
  17. Swearing frantically, followed by smoking half a pack of cigs.
  18. Sorry wrong way round. ereg is obsolete not preg, my bad I knew it was one of them. $result = preg_replace('/[0-9a-z]/i', '', $subject);
  19. Use ereg as opposed to preg. eregi is case sensitive. preg is obsolete or will be soon $result = eregi_replace('[^0-9a-z]', '', $bookISBN);
  20. This line is bad. You cannot compare 2 arrays. You must compare values if ($authns == $resns){ Try this <?php $results['success'] = 0; $results['failure'] = array(); foreach($response->authority as $k => $result) { // Get Authoritative DNS servers $authns = array(gethostbyname($result->nsdname)); // Initiate Authoritative DNS servers for query $dnsservers = new Net_DNS_Resolver(array('nameservers' => $authns)); // Query Authoritative DNS servers one by one $responsedns = $dnsservers->rawQuery($domain); // Get an array of DNS Authoritative servers which responded OK $resns = array($responsedns->answerfrom); //if ($authns == $resns){ if($authns[0] == $resns[0]) { $results['success']++; } else { $results['failure'][] = $result->nsdname; } } // print the results print "<h1>Results</h1>"; print "OK Responses: ".$results['success']."<br />"; print "Failed Responses: ".count($results['failure'])."<br />".implode("<br />", $results['failure']); ?>
  21. The final post is the best. What a complete tard!
  22. Utter crap. Of course you are going to enter stuff into a text field, why wouldn't anyone unless its asking for credit card info. The sad part is that someone took the time to actually make that.
  23. LOL
  24. Where 'database' is the searchterm this is valid SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('database' IN NATURAL LANGUAGE MODE); Remember you must add fulltext indexes to all fields included in the search.
×
×
  • 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.