Jump to content

marcus

Members
  • Posts

    1,842
  • Joined

  • Last visited

Posts posted by marcus

  1. Basically making the items show, I'm stuck on how to do it. (I know I could do a while statement).

    Well more in less, actually get it to restock

    [code=php:0]if($time = $row[time]){
    //restock it
    }else {
    die();
    }
    [/code]
  2. I am making a game with some people and we are stuck on how we would do a restock system.

    Our only idea was to run a cron every 1 minute and if the set number in the database equaled the one in the cron then it would run.

    Also, with the items, I were thinking of an array rand.

    Have an array with like 1 = item number 1, 5 = item#5 etc...

    And have a random number between 10 and 20 and then have it insert into the database. If somebody bought the item then it would take it remove it from the database. Is this all anywheres possible?
  3. [code]
    if(isset($_POST['submit'])) {

    if(!isset($_POST['search'])) {
    header("Location: ?page=forum&sub=search");
    die();
    }else {
    $searchterm = $_POST['search'];
    $query = mysql_query("SELECT * FROM `forum_threads` WHERE `text` LIKE %$searchterm%");
    while($search = mysql_fetch_object($query)) {
    echo $search->id;
    }
    mysql_free_result($query)
    }

    } else {

    echo "<form method=\"POST\" action=\"?page=forum&sub=search\">";
    echo "<input type=\"text\" name=\"search\" id=\"search\">";
    echo "<input type=\"submit\" name=\"submit\" id=\"submit\">";
    echo "</form>";

    }
    [/code]
  4. They could be using a mySQL database or just files.

    Basically if they used a mysql database it would be something like:

    [code]
    $id = $_GET['id'];
    $cat = $_GET['cat'];

    if(!isset($id)){
    $id = 1;
    }
    if(!isset($cat)){
    $cat = 1;
    }

    $sql = "SELECT * FROM `pages` WHERE `pageid` =$id AND `cat` =$cat";
    $res = mysql_query($sql) or die(mysql_error());
    $row = mysql_fetch_assoc($res);

    echo "page title: $row[title]<br>author: $row[author]<br><br>\n";
    echo "contents: $row[pagecontents]";
    [/code]
  5. I am making a forum and I was wondering, the user selects say board ID #5 and want the post to go onto board #5, but he meant six, without changing the URL he could use a drop down to find the one he wants, but sort by id 1-12 but 5 being first.

    So the drop would be like:

    5- ONTOP
    1
    2
    3
    4
    6
    6
    7
    8
    9
    10
    11
    12
  6. I am making a user registration and it just checks to see if all the fields are filled in. But if they aren't then the file would echo off an error.

    [code]
    <?php include('header.php'); ?>
    <?php
    $act = $_POST[act];

    if(!isset($act)){
    echo "<table border=0 cellspacing=3 cellpadding=2>\n";
    echo "<form name=reg method=post action='".$_SERVER[PHP_SELF]."'>\n";
    echo "<tr><td class=gbr>Username:<td class=gbr><input type=text name=username>\n";
    echo "<tr><td class=gbr>Password:<td class=gbr><input type=password name=pass>\n";
    echo "<tr><td class=gbr>Confirm:<td class=gbr><input type=passowrd name=pass2>\n";
    echo "<tr><td class=gbr>Email:<td class=gbr><input type=text name=email>\n";
    echo "<tr><td class=gbr>Confirm:<td class=gbr><input type=text name=email2>\n";
    echo "<tr><td class=gbr>Birthday:<td class=gbr>
    <select name=month>
    <option value=January>January
    <option value=February>February
    <option value=March>March
    <option value=April>April
    <option value=May>May
    <option value=June>June
    <option value=July>July
    <option value=August>August
    <option value=September>September
    <option value=October>October
    <option value=November>November
    <option value=December>December
    </select>\n<select name=day>\n";
    for($i=1; $i<32; $i++){
    echo "<option value=$i>$i</option>\n";
    };
    echo "</select>\n";
    echo "<select name=year>\n";
    for($i=1900; $i<1994; $i++){
    echo "<option value=$i>$i</option>\n";
    };
    echo "</select>\n";
    echo "<tr><td colspan=2><input type=submit value='".Register."'>&nbsp;<input type=reset value='".Reset."'>\n";
    echo "<input type=hidden name=act value=register>\n";
    echo "</form></table>\n";
    }

    if($act == register){
    $username = $_POST[username];
    $pass = $_POST[pass];
    $pass2 = $_POST[pass2];
    $email = $_POST[email];
    $email2 = $_POST[email2];
    $month = $_POST[month];
    $day = $_POST[day];
    $year = $_POST[year];



    if(isset($username) && isset($pass) && isset($pass2) && isset($email) && isset($email2)){

    if($pass != $pass2){
    echo "<b>Your confirmation password is not the same as your password!</b><br>";
    }

    if($email != $email2){
    echo "<b>Your confirmation email is no the same as your email!</b><br>";
    }
    }else {
    echo "Please fill in all the fiedls!";
    }
    }
    ?>
    <?php include('footer.php'); ?>
    [/code]
  7. You can try:

    [code=php:0]
    $username = $_POST['username'];
    $password = $_POST['password']; //or md5($_POST['password']) whichever you're using
    if(isset($username) && isset($password)){

    $cookie1 = setcookie("name","value","time");
    $cookie2 = setcookie("name","value","time");
    //etc...

    if($cookie1 && $cookie2){
    //log in using cookies
    }else {
    $_SESSION['sess1'] = sess1;
    $_SESSION['sess2'] = sess2;
    }
    }
    [/code]
×
×
  • 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.