Jump to content

keldorn

Members
  • Posts

    340
  • Joined

  • Last visited

    Never

Posts posted by keldorn

  1. Yes the array_num was wrong. It returned (paraphrased): Error array_num expects Array

     

    The while() code Mikesta didn't work exactly. I put exit; inside the while()  and it did not it get caught by it.

    But I do already have a While() just above it for a another slighty unrelated msyql_query. Could that interfere with it?

     

    Other then that

     

    $count += $line['hits']; works in the other while() loop. It returns 35759 hits. (from all the rows.) But I just want only the ones from today's date. :)

  2. Hello, okay I have lets just say I have 3 tables in a database one called "id" (auto-incrementing, Key thing-a-jig) "date", and one called "hits". 

     

    Date is formatted as Year-month-day, hits is an integer.

     

    I want to grab only the Rows that are from "Today" and then cacluate the "hits" to a total numbers.

     

    So say you pull out of the database

     

    id:1  date:2009-09-09 hits:200

    id:2  date:2009-09-09 hits:100

    id:3  date:2009-09-09 hits:100

    = 400 hits.

     

     

    How I can calculate all those 3 to a total number?

     

    Here is my code thus far.

     

    if(!$smarty->is_cached('index.tpl')) {
             $results = array();
             $link = mysql_connect($CONFIG['mysql_host'],$CONFIG['mysql_user'], $CONFIG['mysql_pass']) or die('Could not connect: ' . mysql_error());
             $db_selected = mysql_select_db($CONFIG['mysql_db'],$link) or die('Could not contact the database');
    
            //Get Todays Date in year-month-day
           	$date =  date("Y-m-d");
                    // Only grab the rows where the date = today's $date.
    	$Hits = mysql_query('SELECT * FROM links WHERE date=' . $date . ' ORDER BY id DESC LIMIT 0,500') or die('Could not connect: ' . mysql_error());
    
    	while ($line = mysql_fetch_assoc($Hits)) {
    
    	     $tmp[] = $line;
        }
    
    
                    /// Begin Math problem to calculate the hits....?    
    
    
    }

     

  3. Cross site scripting is when they pass some crap in your url like

    search.php?var=<script type="text/javascript">alert("lol xss!");</script> 

     

    If you do not validate this input, then on the return page. Depending how your script works, say you might takes the input and place it in your html like

     

    Here is the results for your search of: <script type="text/javascript">alert("lol xss!");</script>

     

    Since that is real javascript, it will execute on the page. Now you have been haxored. :D

     

     

    Secondly if PHPFreaks forum did that validate that. Right now you see a alert box saying "lol XSS!".  ;)

     

    Another thing. If someone can get real HTML/javascript into your page. They could steal cookies and all kinds of nasties.

     

     

  4. I tried runnng your code on my server and it worked. Except for the $_POST['submit']. I removed that and used the form you provided. (after removing the spaces) and it worked. 

     

    Can I ask a question. Are you assigning  "Submit" to your submit button thinking that it sends a variable called Submit and trying to check for it? The submit button doesn't do that. Its not necessary.  :D

     

  5. Get rid of the isset($_POST['submit'])  I'm guessing you thought you neeeded that. But if you dont have actually have a post variable called "submit" set. Am I right?

     

    Also remove the spaces from the name="" attributes. Turn "Standard Roof" to "StandardRoof"

     

     

    Edit: I see you do have a post var being sent called Submit.. But regardless you need to get rid the space(s) in the Input name="" attribute as PFMaBiSmAd said.

  6. keldorn,

     

    unfortunately that is not working either :(

     

    Make sure you put the $_SESSION['leadid'] = $_GET['id'];  to set the sesssion cookie when they first hit the login page. So the cookie is available when the hit post. (the cookie should get sent with their post?). I think that it should work or it might be becuase of the header redirect. I've heard that header(); can mess with sessions.

     

    So maby try this.

    //[...]
             $_SESSION['s_logged_n'] = 'true';
             $_SESSION['s_username'] = $username;
             $_SESSION['s_name'] = $row['name']; 
             $leadid = $_SESSION['leadid'];
    session_write_close();
             header("Location: buy.php?leadid=" . $leadid);
             exit;
    }else{
    //[...]
    
    

  7. You go to your website and it logs you into youtube and redirects you to the youtube homepage.. Not very much point in that (In my opinion)

     

    Could somebody mention a use for it?

     

    Probably to comment spam. ::)

     

    Automated video posting?

     

    Well I have never heard of anyone needed to upload videos with cURL. But usually these things when there automated = spam. Like running a bot with cURL to mass spam hundreds of pages a second or automate the upload of tons of spam videos.  LOL :D

  8. When they reach the "login" page. Save  the Variable $leadid as a $_SESSION

     

    like

    $_SESSION['leadid'] = $_GET['id'];

    When they hit their POST and your script returns the new page, pass the $_SESSION['leadid']  as

     

     

    header("Location: buy.php?leadid=" . $_SESSION['leadid']);

     

     

    How about that? I think it would work if I'm understanding correctly.

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