Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Posts posted by wildteen88

  1. mysqli support is for PHP5 and upwards. It is not available to PHP4.x versions.

    If you wish to use the mysqli functions see if your host will upgrade the current php version to php5 and see if they can compile php with mysqli support. Or just install a local server on your computer easy to do and allows you to learn php offline! saves you time but not uploading files to your host all the time instead you run them from the comfort of your own computer.

    Look into pakages like wamp5 or XAMPP, or install Apache, PHP5 and MySQL on your computer manually - your book may show you haw to install these on your computer. All the packages mentioned above are free download and use, not costs involved
  2. If you're using varibaled like $PHP_SELF then it looks like you other sever has the dreded register_globals turn On and your local server install on your pc has this directive turned Off!

    Having register globals off is recommend as when its on it can open up big securiity holes within your script. As you can set variables anywhere and php will use then, where as having it Off doesn't just create any old variables.

    So if you had a form on form.php and you where submitting the form to send.php then I can just go to send.php and enter what I liked after send.php such as send.php?var1=somethingnasty and if you used var1 in your code php will use what ever is set in the url! When register_globals is off you use special variables called superglobal arrays.
  3. You will have to load your pages through the browser with the httpd protocol like so:
    [a href=\"http://localhost/pagename.php\" target=\"_blank\"]http://localhost/pagename.php[/a]

    Or it may be like this:
    [a href=\"http://localhost/~username/pagename.php\" target=\"_blank\"]http://localhost/~username/pagename.php[/a]

    it depend on how your college server has been setup.
  4. Imap doesn't have any configuration settings in the php.ini but to send an email you first have to connect to an Imap mailbox using [a href=\"http://uk2.php.net/manual/en/function.imap-open.php\" target=\"_blank\"]imap_open[/a] once you have connected to the mailbox you should be able to use all the various imap_* functions found on the left hand side on the linked paged above.

  5. You may have editted your password aswel by mistake. just incase try this form [a href=\"http://www.phpfreaks.com/forums/index.php?act=Reg&CODE=10\" target=\"_blank\"]HERE[/a]. If your new email address is working you should get your account details sent to you.

     

    Also there was no need to change email addresses as you can unsubcribe from any forums and threads within your My Controls area.

     

    Unforunatly the admin (phpfreak) is rarely on as he is a busy guy and so he may not reply/help much. That is the only tip I can provide at the moment.

     

    Hoep may help.

  6. If you have an imap server installed and have the imap extensions enabled in php. Then you'll want to use the [a href=\"http://uk.php.net/manual/en/function.imap-mail.php\" target=\"_blank\"]imap_mail[/a] function rather the mail function. As the mail function is only limited to SMTP email servers only.
  7. If you just want the first ten rows ordered by date then append your query with LIMIT 1, 10 like so:
    [code]$sql = "SELECT name, email, date From users ORDER BY date LIMIT 1, 10 ";[/code]
    MySQL will query the database and order its results by the date and then it'll limit the already ordered rows by 10. So only 10 or less results (depending on how many rows there are in the database) should be returned.
  8. Just use $_SERVER['HTTP_REFERER'] this should hold the full url to the page the user used in in order to get to your logout page.
    So if you clicked a link in a page called page1.php in mydomain.com/folder1/page1.php then it should return mydomain.com/folder1/page1.php

    However this variable can be spoofed and some browsers may not send this type of information over.
  9. Just do your normall mysql query like so:
    [code]<?php

    //database connection code goes here

    $sql = "SELECT name, email, date From users ORDER BY date";
    $result = mysql_query($sql) or die("Error with query " . mysql_query());

    while($row = mysql_fetch_array($result))
    {
        echo $row['name'] . '<br>';
        echo $row['email'] . '<br>';
        echo $row['date'] . '<br>';
    }

    ?>[/code]Ands that is all there is to getting data out of mysql and displaying it.
  10. You might want to change any instances of [b]$pgnodes;[/b] to [b]$_GET['pgnodes'];[/b] as you're using pgnodes; to get the variable value form the url which is incorrect as you dont have register_globals turned on. Instead you have it turned off which it should!

    When you have register_globals turned off you have to use the superglobal arrays found [a href=\"http://uk.php.net/manual/en/language.variables.predefined.php\" target=\"_blank\"]here[/a].
  11. have your changed a setting in the php.ini callled [b]session.save_path[/b]? if you have what have you changed it to as php is trying to use the session file which it uses to keep track of being added in the session, but php cant access this file and so you're getting the error message(s) above.

    For now clear what ever you have set in the [b]session.save_path[/b] directive in the php.ini file.

    Save the php.ini and restart Apache or what ever webserver you're using. Try using sessions now.
  12. The error message is telling me that you have something being outputted to browser on line 1 in login.php

    Now do you have any spaces before the [b]<?php[/b] tag also are you using notepad? If you are using notepade make sure you save file encoding to [b]ANSI[/b] and not [i]UFT-8[/i] or anything else otherwise somehidden chars get added to your file and so your get the headers already sent error message.
  13. Just replace this code:
    [code]mail($to, $subject, $msg, "From: My web site\nReply-To: $email\n");[/code]
    with:
    [code]mail($to, $subject, $msg, "From: My web site\nReply-To: $email\n", "-f someuser@somedomain.com");
    [/code]
  14. How php treats sertain variables depends on one setting in the php.ini file which is the [b]regsiter_globals[/b] setting. Your shared hosting account has this set to [b]On[/b] (which isn't recommended any more as it can lead to security issues) and you local server has it turn [b]Off[/b] which is recommended.
  15. The message you are recieving isn't an error but a just a message PHP throughs out when something isn't set. No the message is refering to the following:
    [code]$id = $_GET['id'];

    if ($id == "") {[/code]Notice where it says [i]$id = $_GET['id'][/i] this is ok but when you run your script and the id variable isn't passed over the url (index.php?id=1) then PHP will through a Notice message as $_GET['id'] isn't set! To get arround this simply change the two lines of code I posted above to the following:
    [code]$id = (isset($_GET['id']) ? $_GET['id'] : "");
    if (empty($id)) {[/code]
    The new code first checks whether $_GET['id'] is actually set. If it is then it'll assign $id the value of $_GET['id'] otherwise it'll set $id to nothing! The next line of code just checks whether the value of $id is empty
  16. Shouldn't really matter where you put the HTML, But placing it after the block of php code should. Heres you code:
    [code]<?PHP
    if($_POST['submit']){
    $directory = "/home/username/public_html/files/";
    $max_file_size = "1000000";
    $allowedfile[] = "video/x-ms-wmv";  
    $allowedfile[] = "video/x-msvideo";  
    $allowedfile[] = "video/mpeg";  
    $allowedfile[] = "video/quicktime";  
    if (is_uploaded_file($_FILES["file"]["tmp_name"])) {    
        if($_FILES["file"]["size"]>$max_file_size) {        
            $is_uploaded = "failed";      
            echo 'Sorry, this file is too large. The maximum filesize is '.$max_file_size.' bytes, although your file is '.$_FILES["file"]["size"].'. ';        
            exit();    
            }    
            if(!in_array($_FILES["file"]["type"],$allowedfile)) {        
                $is_uploaded = "failed";        
                echo 'Sorry, wrong file type, "'.$_FILES["file"]["type"].'" is not allowed. ';      
                exit();  
            }    
            if(file_exists($directory.$_FILES["file"]["name"])) {        
                $is_uploaded = "failed";        
                echo 'Sorry, this file already exists. ';        
                exit();
            if($is_uploaded!="failed") {
                   $replace = array("$","%","#","@","!","&","^","*","(",")","-");
                $new = str_replace($replace,"",$_FILES["file"]["name"]);
                $fileName = str_replace(" " , "_" , $new);

            if(! is_dir($directory)){
                    mkdir($directory,0777);
                }
            if (move_uploaded_file($_FILES["file"]["tmp_name"], $directory.$fileName)) {
                    echo "Your file, ". $fileName ." has successfully been uploaded!  Click <a href=\"".$directory.$fileName."\">Here</a> to view your file.";
                }
        else {
            echo 'Sorry, your file has not uploaded.';
            exit();
            }
        }
    } else {
        echo 'There has been an unknown error while uploading';
        exit();
    }
    }
    ?>
    <form enctype="multipart/form-data" action="fileproc.php" method="POST">
      <p>
        <input name="file" type="file" />
        <br />
        By uploading you file you agree to the <a href="Terms Of Service.php" class="style1 style1">Terms Of Service</a>
        <input type="submit" value="Submit" />
    [/code]
    Note: I chnaged you action attribute value in your form tag. I changed it from:
    [i]file:///C|/Documents and Settings/Jordan/My Documents/Photoshop/gameingvideos/fileproc.php[/i] to just [i]fileproc.php[/i] as when you submit your form the php wont be processed!
  17. You might want to look at [a href=\"http://uk2.php.net/manual/en/function.strpos.php\" target=\"_blank\"]strpost[/a] or if you have PHP5 available use [a href=\"http://uk2.php.net/manual/en/function.stripos.php\" target=\"_blank\"]stripost[/a] for a case insensitive search.

    For a more accurate search you may want to use [a href=\"http://uk2.php.net/manual/en/function.preg-match.php\" target=\"_blank\"]preg_match[/a]
  18. IF your are planning on storing things such as usernames and passwords in a session or cookie. Then I'd choose sessions as . the client wont be able to get the session data as it is stored on the server rather than the clients computer
    2. its more secure than cookies

    As cookies are set on the users computer and so they can be easily accessed.

    I will only use cookies for things like, tracking how many times a user has visited a page, or where the user has last been for redirectional purposes etc. I will not store personal info in a cookie and opt for sessions.
  19. You can put tye HTML in the textarea but need to send the email with a HTML header so the email client will parse the HTML and create a link.

    The folloowing si what needs to be sent in the header fo the email:
    [code]Content-Type: text/html; charset=iso-8859-1[/code]

    As you are using phpMailer you need add this:
    [code]$mail->IsHTML(true);[/code] after [code]$mail->WordWrap = 50;[/code] i believe

    So now when you send your email. Your html should be parse by the email client and so a link should appear where the HTML is.

    Read [a href=\"http://phpmailer.sourceforge.net/tutorial.html#4\" target=\"_blank\"]here[/a] for sending HTML mail with phpMailer.
  20. Try changing:[code]if($action=="add")[/code]to[code]if($_GET['action']=="add")[/code]Only chnage it if you have register_globals set to Off.

    If you still dont get anything try going to this instead userride.php?add=1

    As in order for the add variable to be sent it needs to have a value assign to it, in this case 1
×
×
  • 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.