Jump to content

ldb358

Members
  • Posts

    199
  • Joined

  • Last visited

    Never

Posts posted by ldb358

  1. change the name of them to:

    <input name="tag[]" type="checkbox" value="accident" />
    <input name="tag[]" type="checkbox" value="airport"/>
    <input name="tag[]" type="checkbox" value="airtoair"/>
    

    then you can loop through it like so:

     

    $tags = new Array();
    foreach($_POST['tag'] as $tag){
       if($tag){
           tags[] = $tag;
       } 
    }
    $tag = implode(',',$tags);
    

     

    then inset the $tag variable in your database as text

  2. you could do something like this:

     

    <?php
    $string = "The quick brown fox jumps over the moon to discover that it really wasn't the moon at all but a big rock in the ground";
    $delimiter = "discover";
    $maxlenth = 15;
    $new = substr($string,strpos($string,$delimiter)-$maxlenth,$maxlenth*2+strlen($delimiter));
    ?>
    

  3. okay thanks i am reading up on openVZ, it seems to be exactly what i was looking for.

     

    the issue however comes once traffic starts to hit & without specs, we couldn't say.

     

    What exactly do you mean by this? I am assuming you mean site traffic, which should be pretty low as i will only be running a portfolio and blog on it

  4. I currently have a desktop that was great but after i got my laptop has gotten little use, so i am thinking about making it into a vps web server where i will provide the server and my friends will pay for the internet connection the specs are:

     

    750gb hard drive (would like to partion it in to 3 separate vps')

    8gb ram

    2.2 amd quadcore

     

    my questions are:

    a)Are these specs good enough? (i would assume so but you never know)

    b)what software would i need to do this?(i want to run a ubuntu server)

    c)Any other advise?

  5. you have a typo:

     

    $q2 = mysql_query("INSRET INTO `players` (id, timestamp, gameid, players) VALUES ('NULL', 'NULL', '$gameid', '$players')") or die(mysql_error());
    
    //should be
    $q2 = mysql_query("INSERT INTO `players` (id, timestamp, gameid, players) VALUES ('NULL', 'NULL', '$gameid', '$players')") or die(mysql_error());
    

  6. okay your setting it in the wrong place, what you need to do is replace:

     

    session_register($myusername);
    session_register($mypassword);
    //with
    $_SESSION['username'] = $myusername;
    $_SESSION['password'] = $mypassword;
    

    so your final script would look like:

     

    <?php
    ob_start();
    $host="localhost"; // Host name
    $username="xx"; // Mysql username
    $password="xx"; // Mysql password
    $db_name="xx"; // Database name
    $tbl_name="members"; // Table name
    
    // Connect to server and select databse.
    mysql_connect("$host", "$username", "$password")or die("cannot connect");
    mysql_select_db("$db_name")or die("cannot select DB");
    
    // Define $myusername and $mypassword
    
    // To protect MySQL injection
    $myusername = stripslashes($myusername);
    $mypassword = stripslashes($mypassword);
    $myusername = mysql_real_escape_string($myusername);
    $mypassword = mysql_real_escape_string($mypassword);
    
    $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
    $result=mysql_query($sql);
    
    // Mysql_num_row is counting table row
    $count=mysql_num_rows($result);
    // If result matched $myusername and $mypassword, table row must be 1 row
    
    
    if($count==1){
    // Register $myusername, $mypassword and redirect to file "login_success.php"
    $_SESSION['username'] = $myusername;
    $_SESSION['password'] = $mypassword;
    header("Location: /clients/".$myusername."/");
    }
    else {
    echo "Wrong Username or Password";
    
    ob_end_flush();
    ?>
    

     

    and your other script should look like:

     

    session_start();
    if(isset($_SESSION['username']){
    header("location:../../index.php");
    }
    

     

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