Jump to content

c_pattle

Members
  • Posts

    295
  • Joined

  • Last visited

Posts posted by c_pattle

  1. I was just wondering if anyone can point me in the direction or a good tutorial for creating an AJAX/Jquery loading bar.  The loading bar doesn't have to show any progress but just be on the screen for a few seconds file I'm getting data from a database etc. 

     

    Thanks for any help. 

  2. I have a php script that saves some data as a .xml document.  When I view this in my browser I can subscribe to the feed (I am using firefox).  However I asked someone else to see if they could subscribe (they were using IE) but the couldn't.  Therefore how can users subscribe to my feed?  Will only some be able to subscribe?

     

    Thanks for any help. 

  3. I am trying to save this an an xml document but am getting this error when I try to open the xml file "feed.xml" - "XML Parsing Error: no element found"

     

    $xml = '<rss version="2.0">
    
    <channel>
    
    <title> RSS Feed</title>
    
    <link></link>
    
    <description>the best industry-lead opinions</description>
    
    <language>en-us</language>
    </channel>
    
    </rss>";
    
    $xml2 = new DOMDocument('1.0'); 
    $xml2->Load($xml);
    $xml2->save("feed.xml");
    

  4. yes it's set to "ON" should I change it?

     

    Also this is my code.  Is this the right way to do it?

     

    
    if(isset($_POST['form_submit'])) {
    
    $_SESSION[website_name'] = mysql_real_escape_string($_POST['website_name'], $mysql_conn);
    $_SESSION['website_description'] = mysql_real_escape_string($_POST['website_description'], $mysql_conn);
    $_SESSION['website_url'] = mysql_real_escape_string($_POST['website_url'], $mysql_conn);
    
    $submit_sql = "insert into websites (website_name, website_description,website_url) values (\"" . $_SESSION['website_name'] . "\",\"" . $_SESSION['website_description'] . "\",\"" . $_SESSION['website_url'] . "\")";
    
    $submit_rs = mysql_query($submit_sql, $mysql_conn);
    }
    

  5. Thanks.  If I used the mysql_real_escape_string... it replaces any ' with \'

     

    However this is bad because if the user enters "it's" into the database it will then show up as "it\'s" or is it necessary to have this?

  6. I have a form that when submitted inserts the input values into a database.  I was wondering what measures I can take to make sure that it is as secure a possible.  Below I have added some basic code.  Any help on how to modify this code to protect against injection attacks etc would be great. 

     

    
    if(isset($_POST['form_submit'])) {
    
    	$submit_sql = "insert into websites (website_name, website_description,website_url) values (\"" . $_POST['website_name'] . "\",\"" . $_POST['website_description'] . "\",\"" . $_POST['website_url'] . "\")";
    
    	$submit_rs = mysql_query($submit_sql, $mysql_conn);
    }
    
    

  7. I have just installed cURL and am learn to use it but I'm not sure exactly what I am doing.  For example I have a page with this code on it. 

     

    if($_GET['number'] == "6") {
        echo("<p>the number is six</p>");
    }

     

    Then I am trying to use cURL to send the number 6 to this page so that it returns "the number is 6".  However I am just getting an output of "1".  Below is the code I am using to try to get the output of "the number is 6". 

     

    $ch2 = curl_init();
    
    curl_setopt($ch2,CURLOPT_URL,'http://localhost/crawler/crawlertest.php');
    curl_setopt($ch2, CURLOPT_POST, 1);
    curl_setopt($ch2,CURLOPT_POSTFIELDS,'number=6');
    $return = curl_exec($ch2); 
    
    echo ($return);
    
    curl_close($ch2);
    

     

    Thanks for any help

     

  8. I have a file called "inc_records.php" which outputs data from a mysql query.  It has the following code in it. 

     

    $content = "<p>" . $record_array['first_name'] . "</p>";
    $content .= "<p>" . $record_array['last_name . "</p>";
    

     

    I am going to use this code everytime I need to display that data.  I want to save the $content variable as another variable.  For example. 

     

    $_SESSION['content'] = include("includes/inc_records.php");

     

    However this isn't working so what is the best way to do it?  Thanks for any help. 

  9. I have just downloaded cakephp and tried their tutorial to create a basic application.  Although I have done this I am not sure how to edit the appearing of the main index page.  For example I know that the view is made up of add.ctp etc but how to a change the view on the index page.  Everytime you add a new article it displays the sql at the bottom.  How can I get rid of this and other page elements? 

     

    Thanks for any help. 

  10. I've been learning PHP and MySQL for the past 6 months and I'd say I'm pretty good now.  For example I can perform complex sql queries, handle data, upload files, read and write files, use AJAX etc.  However I want to learn more advanced stuff but am not sure what to learn.  I've heard about crawling scripts and other things but could anyone point me in the direction of some more advanced tutorials? 

     

    Thanks for any help. 

  11. I have just made a couple of forms that submit data to a mysql database.  I was wondering what measures I need to make to in order to keep the whole thing very secure.  At the moment I have stripped the inputs of tags and forward slashes.  Is there anything else I should do?

     

    Also some field in the form allow the user to enter a url.  With these fields I have not stripped them of forward slashes.  Is this a bad idea?  Should I do something like replace the forward slashes with something else and then reverse this process every time I extract that data from the database?

  12. I have the following mysql query

     

    "select * from articles where article_number=12;"

     

    The article number field auto_increments.  Is there an way to find out if the article number specified in the query is the most recent entry.  So for example if there were 12 entries in the database this would be the most recent one?  Thanks for any help. 

  13. I want to do this because I have some code at the top of my document that says (this is an example)

     

    if(isset($_GET['author'])) { echo ("hello") }
    

     

    This is fine but then if I submit a form on that page "$_GET['author']" will still be set and it will still say hello at the top of the screen.  It's hard to explain but I hope this makes sense. 

  14. Sorry.  For example say I click on a link such as this

     

    <a href="index.php?author=fred">Click</a>

     

    Then next time I reload the page how do I remove "author=fred" from the url so that the variable author isn't set?

  15. I have a link that sets a get variable that then performs a search based on that get variable.  How after I the page has reloaded with the new search results how can I removed the $GET from the end of the url?  Thanks for any help. 

  16. Thanks I have tried the following code but I always get this error message - "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/jon/index.php on line 115". 

     

    if (isset($_POST['for_submit'])) {
        $announcement_sql = "select * where annnouncement_for like \"%" . $_POST['for_search'] . "%\" and announcement_verification=\"1\" order by announcement_number desc limit 0, 15";
    $num_rows = mysql_num_rows(mysql_query($announcement_sql, $mysql_conn));
    if (!$num_rows) {
            $announcement_sql = "select * from announcements where announcement_verification=\"1\" order by announcement_number desc limit 0, 15";
    }

  17. I have this code which performs a mysql query.  However is there a way I can check to see if the set it returns is empty.  If it is empty I will then change the sql statement.  Thanks

     

    $announcement_sql = "select * where annnouncement_for like \"%" . $_POST['for_search'] . "%\" and announcement_verification=\"1\" order by announcement_number desc limit 0, 15";

  18. I was wondering if it is possible to check the content for a variable for a certain work.  For example say a variable called "$variable1" was equal to "one, two, three, four, five".  How can I check to see if the variable contain the word "four"?  Thanks for any help. 

  19. I have a form and on each input I set the value as the post variable of it's self.  I do this so that if the user submit the form and it has errors they haven't lost the data they have inputted.  For example

     

    <input name="input1" type="text" value="<?php echo($_POST['input1']); ?>" />

     

    This works fine for text field and textarea's but how do I retain the value of radio boxes and checkboxes?

×
×
  • 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.