Jump to content

Bman900

Members
  • Posts

    184
  • Joined

  • Last visited

    Never

Posts posted by Bman900

  1. Which is a better language? I just got a book on Java and it seems cool but then I discovered that there was JavaScript. I work with PHP a lot and want to embed some java (as I thought of course) but realized I might need javascript instead. Is it worth learning java or should I just go to javascript?

  2. here is my code:

     

    <?php $target_path = "videos/";
    $imgtarget_path = "image/";
    /* Add the original filename to our target path.  
    Result is "uploads/filename.extension" */
    $movielink = basename( $_FILES['uploadedfile']['name']);
    $imagelink = basename( $_FILES['imagefile']['name']);
    $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
    $imgtarget_path = $imgtarget_path . basename( $_FILES['imagefile']['name']); 
    
    if((move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) || (move_uploaded_file($_FILES['imagefile']['tmp_name'], $imgtarget_path))) {
        echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
        " has been uploaded";
        echo "The file ".  basename( $_FILES['imagefile']['name']). 
        " has been uploaded";
    mysql_query("INSERT INTO video 
    (title, descript, link, image) VALUES('$formtitle', '$descrip', '$movielink', '$imagelink') ") 
    or die(mysql_error());  
    
    } else{
        echo "There was an error uploading the file, please try again!";
    }
    ?> 

     

    The video file gets uploaded correctly but the image file doesn't go any where. It gives me the messages that they both have been uploaded fine which obviously is wrong. Any help is appreciated.

  3. You don't need to drop any values, if the paid for a subscription to until 06/24/2010 then you just need to compare to the current date

    ie

    SELECT * FROM payements WHERE paidto >= CURDATE();

     

     

    Correct me if am wrong. I will put that in an query and run it. Then it should return a value if there is something in there. If not that obviously they don't have a subscription or it was expired. So after the query I  can run an if (something got returend) { do thid} else { you don't have a subscription}

  4. Alright, so I store the date till they paid for in a column but how would I do a check if they still have access to their subscription and than drop the value after the time is up so they can order again?

  5. So lets say I want to make a site where people can buy memberships for 30 days or for a whole year. I have a user system but I have no clue on how to do this. I was thinking after the payment is made I can enter a code in the database that get checked when the user is logged in. The problem that I am running into is how to I change that code in the database after 30 days or 12 months after they signed up so they wont have a subscription any more?

  6. Alright I fixed most of my code but I am running into one hell of a mountain. Something get royaly messed up as soon as I enter into a folder that links back to my include file like. (../include.php) Am thinking it is a connection issue because my code and database is fine in the include file. I do connect to a databse in the include file by getting variables out of config.php in my include.php file. Should I be making a connection before I include a file from outside of a folder. The weird thing is that it works perfectly in my root directory. Anything will help me.

     

    Alright I found out that if I make the connection inside my include file and not use variables stored in config.php it works but that still doesn't make sense. include.php include config.php from the same directory. Than admin.php includes include.php from ../  WHat am I missing?

  7. Ok here is the error I get:

     

    Warning: mysql_result() [function.mysql-result]: Unable to jump to row 19 on MySQL result index 62 in /homepages/44/d272374679/htdocs/draft/includepages.php on line 80

     

    This doesn't make sense since it worked with Php 4.4

     

    Here is the exact code I have on that line:

     

    <?php $content20 = mysql_result($content1Res, 19, 0) or die (mysql_error()); ?>

  8. Here is part of my code.

     

    <?php
    include("config.php");
    
    mysql_connect("$dbhost", "$dbusername", "$dbpassword") or die(mysql_error());
    mysql_select_db("$databasename") or die(mysql_error());
    
    $surveyRes = mysql_query("SELECT surveyinput FROM surveylink");
    $surveylink = mysql_result($surveyRes, 0, 0);
    
    $emailRes = mysql_query("SELECT emailinput FROM email");
    $email = mysql_result($emailRes, 0, 0);
    
    $descRes = mysql_query("SELECT mdescription FROM meta_desc");
    $description = mysql_result($descRes, 0, 0);
    
    $mkeyRes = mysql_query("SELECT mkeywords FROM meta_keys");
    $metakeywords = mysql_result($mkeyRes, 0, 0);
    
    $acheckRes = mysql_query("SELECT acheck FROM awebercheck");
    $webcheck = mysql_result($acheckRes, 0, 0); ?>

  9. I was working on a script that need PHP 5 so I did the upgrade but a major script I was working on before displays more errors than there are codes of lines!

     

    Here is a little taste:

     

    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /homepages/44/d272374679/htdocs/demo/include.php on line 8
    
    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /homepages/44/d272374679/htdocs/demo/include.php on line 11
    
    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /homepages/44/d272374679/htdocs/demo/include.php on line 14
    
    Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /homepages/44/d272374679/htdocs/demo/include.php on line 17

     

    I noticed if I use msqli it works to a point but it doesn't pick up mysqli_result plus I don't want mysqli. Any one?

  10. Ok, so I followed a tutorial on creating a subscribe list without using a databse. I got everything to work but I can not send out HTML correctly. Here is the code:

     

    <?
    error_reporting(0);
    //#############################################################
    //#################   CONFIGURATION  ##########################
    
    // choose a password
    $my_password="testing";
    // the email from which emails are send
    //  mydomain.com must be your real domain, otherways,
    //  the server will not send any emails
    $from_email="Balint <balint2005@yahoo.com>";
    // Your replay to email (whatever you want).
    $replayto="balint2005@yahoo.com";
    // A message to be attached to the bottom of the message
    //   We recommend to add a link to subscription page
    $message_at_bottom="
    ------------------------------------------------------------
    P.D.: To remove from this list go to...
    http://www.mydomain.com/emaillist/
    ";
    // The file where emails are stored
    $emails_file="emaillist-9A67o95B1O.txt";
    
    //###############   END CONFIGURATION  ########################
    //#############################################################
    
    // IF INFO IS NOT POSTED, PRINT THE FORM AND DIE
    if (!$_POST["mensaje"]){
            print_form();
            die();
    }
    
    // IF INFO IS POSTED YOU WILL BE HERE
    // Check whether the password is correct
    //  (only webmaster is supposed to know the password, which has been specified above)
    if ($_POST["p"]!=$my_password){die("Incorrect password");}
    
    // Get the subject of message
    $subject =$_POST["subject"];
    // Get the body of message
    $message=$_POST["mensaje"];
    // Add to body of message the bottom
    $message.=$message_at_bottom;
    // Read the file with emails to variable $emails_file
    $emails_file=file_get_contents($emails_file);
    // Extract list of emails to array $emails_array
    preg_match_all("/<.{0,100}?>/",$emails_file,$emails_array);
    
    // Start output
    print "<b>Sending messages...</b>";
    
    // Send email to each email
    foreach ($emails_array[0] as $email){
            // remove "<" and ">" from each email
            $email=substr($email,1,strlen($email)-2);
            // Next line is the one sending the email: the key command of this script
            mail($email, $subject, $message,"From: $from_email\n" . "MIME-Version: 1.0\n" . "Content-type: text/html; charset=iso-8859-1"); 
    
            // Each time an email is send, output it
            print "<br>$email\n";
            // After sending each email, send previous line (the email) to the browser
            flush();
    }
    
    ?>
    
    
    
    
    
    <?php
    // THIS FUNCTION WILL SHOW THE FORM
    // MODIFY IT AS REQUIRED
    function print_form(){
    ?>
    
    <center>
    <h2>Form to send email to the mailing list</h2>
    <table>
    <tr><td>
                    <form method=POST action="<? $PHP_SELF; ?>".php>
                    Subject
                    <br><input type=text name=subject size=40>
                    <br>Message
                    <br><textarea name=mensaje cols=50 rows=8></textarea>
                    <br>Password <input type=password name=p size=10>
                    <br><input type=submit value=Send>
                    </form>
          </td>
        </tr>
    </table>
    </center>
    
    
    <? } ?>

     

    As you can see I have the correct protocols for HTML but it is still not working. I have done this in a different script before so I know it is not my email provider. Can any one spot anything that would cause HTML not to send properly?

     

  11. Is there a way to basically get the location of a file minus the file name?

     

    Basically I want a code that will spit back the root of my files. For example if my files would be in

     

    root the code above: $_SERVER['SERVER_NAME']; would work just fine for a link, but what if some one puts those files in a folder like root>backup the link would not work.

  12. no...i told you, that was pseudo code.  You need to assign the mysql_query to a variable and use that variable as argument in mysql_num_rows.

     

     

    mysql_query

    mysql_num_rows

     

    You mean like this:

    <?php

     

    $ipchecker = $_SERVER['REMOTE_ADDR'];
    $ipsql = mysql_query("select iptable from ipcheck where iptable = '$ipchecker'");
    $row_number = mysql_num_rows($ipsql);
    
    if ($row_number > 0) {
    ?>
    
    <form id="form1" method="post" action="redirect.php">
    <textarea name="question" cols="52" rows="8"></textarea><br />
    <input name="firstname" type="text" /><br />
    <input name="email" type="text" /><br />
    <input name="submit" type="submit" />
    </form>
    <?php  
    }
    else {
    ?>
           <script type="text/javascript" src="http://forms.aweber.com/form/40/1675361340.js"></script>
           
           <?php } ?>

     

    That doesn't work either...

  13. Would this be correct?

     

    <?php
    $ipchecker = $_SERVER['REMOTE_ADDR'];
    mysql_query("select iptable from ipcheck where iptable = '$ipchecker'");
    if (mysql_num_rows > 0) {
    ?>
    
    <form id="form1" method="post" action="redirect.php">
    <textarea name="question" cols="52" rows="8"></textarea><br />
    <input name="firstname" type="text" /><br />
    <input name="email" type="text" /><br />
    <input name="submit" type="submit" />
    </form>
    <?php  
    }
    else {
    ?>
           <script type="text/javascript" src="http://forms.aweber.com/form/40/1675361340.js"></script>
           
           <?php } ?>

     

    I added my IP manualy to test it out and it goes to the else statement no matter what.

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