Jump to content

mrdamien

Members
  • Posts

    186
  • Joined

  • Last visited

Posts posted by mrdamien

  1. mgallforever pointed out your putting the mail() paramaters in the wrong way:

     

    mail(to,subject,message[,headers]);

     

    try

    <?php
    $to = "bowlingklubkranj@gmail.com";
    $user = $_POST["user"];
    $email = $_POST["email"];
    $comments = $_POST["comments"];
    $subject= "From: $email";
    
    mail($to, $subject, $comments);
    echo "Hvala za sporocilo.";
    
    ?>

  2. In order to kill the session altogether' date=' like to log the user out, the session id must also be unset. If a cookie is used to propagate the session id (default behavior), then the session cookie must be deleted. setcookie() may be used for that.[/quote']

     

    <?php
    // Initialize the session.
    // If you are using session_name("something"), don't forget it now!
    session_start();
    
    // Unset all of the session variables.
    $_SESSION = array();
    
    // If it's desired to kill the session, also delete the session cookie.
    // Note: This will destroy the session, and not just the session data!
    if (isset($_COOKIE[session_name()])) {
        setcookie(session_name(), '', time()-42000, '/');
    }
    
    // Finally, destroy the session.
    session_destroy();
    ?>

     

  3. If I understand correctly, you'll want a query similar to something like this:

     

    SELECT users.user_id, COUNT(posts.post_id) AS u_postcount

    FROM users

    INNER JOIN posts ON users.user_id = posts.fk_users

    INNER JOIN threads ON posts.fk_threads = threads.threads_id

    WHERE threads.threads_id = ?

    GROUP BY users.user_id;

     

    meaning select the users and their postcount, but only the users that have posted on threads_id

  4. Well, since I don't know what this is for I'll just start by saying, encryption is not a reliable way to protect info.

     

    1) PHP offers some premade functions

    http://ca.php.net/base64%20encode

    http://ca.php.net/manual/en/function.base64-decode.php

     

    <?php

    echo base64_encode('This is an encoded string'); //VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==

    ?>

    <?php

    echo base64_decode('VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw=='); //This is an encoded string

    ?>

     

    2) Making your own encryption scheme (a good one) takes a lot of math skills (that I don't have).

  5. Though there is nothing wrong with that, an easyer method is to use

     

    mysql_insert_id()

    http://ca3.php.net/manual/en/function.mysql-insert-id.php

     

    # use this statement to enter the patient data

    $sql_1= INSERT INTO patients (f_name, l_name, phone_num) VALUES (‘$f_name’, ‘$l_name’, ‘$phone_num’);

     

    $res_1 = mysql_query($sql, $conn) or die(mysql_error());

     

    #get the patient id based on the last insert

    $id = mysql_insert_id($conn);

     

    #enter the data in the appointment table

    $sql_3 = INSERT INTO appointment (appt_date, appt_time, id) VALUES (‘$appt_date’, ‘$appt_time’, ‘$id’)

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