1. fixed: function to remove first and last values from an array?

    Date: 01/23/06     Keywords: no keywords

    this is sorted, thanks for everyones help

    basically it's as the title says, is there a function to remove the first and last values from an array?

    Source: http://community.livejournal.com/php/400365.html

  2. Help!

    Date: 01/22/06     Keywords: database

    I'm having trouble with this script. It's supposed to insert data from
    a form into a database and upload a file. The file is uploading
    properly, but nothing is going into the database. Anyone ever have a
    similar problem? Any idea how I can fix it?








    ini_set ('display_errors', 1);
    error_reporting (E_ALL & ~E_NOTICE);
    if (isset ($_POST['submit'])) {

    if (move_uploaded_file ($_FILES ['photo']['tmp_name'], "portfolio/{$_FILES['photo']['name']}")) {

    print '

    Your file has been uploaded.

    ';
    }
    }

    $url = $_POST["url"];
    $title = $_POST["title"];
    $description = $_POST["description"];
    $category = $_POST["category"];
    $dt = date("Ymd");

    if ($submit) {

    $db = mysql_connect("10.0.11.66", "xxxxx", "xxxxx");
    mysql_select_db("dweia");

    $sql = "INSERT INTO 'photos'
    ('url','title','description','category','date') VALUES
    ('$url','$title','$description','$category','$dt',)";
    $result = mysql_query($sql);
    echo 'Go back';

    } else{
    ?>




    Enter photo name: (ie, filename.jpg)



    Title:


    Choose a category:


    Description:




    }
    ?>


    Source: http://community.livejournal.com/php/399935.html

  3. Parse error

    Date: 01/20/06     Keywords: php

    I'm having some trouble with a PHP script. I've done scripts like this before but I've been staring at this script so long and I can't figure out what's wrong. All I'm doing is adding text to an existing string but I'm getting the following error:

    Parse error: parse error in /var/www/htdocs/secure.datastore.com/McCarthysParty/cda_registration_confirm.php on line 250

    No other explanation. If I comment out the section of code behind the cut the form seems to work fine but I'm not seeing any obvious errors. I'm sure it's something small and obvious. Can anyone figure out what's wrong with this? The code starts at line 250.

    	msg += "General Sessions:\n";
    	msg += "Friday:\n";
    	msg += "The Interface of Dental Public Health & General Dentistry (DDS, DH, DA) - ".$F1." participants\n";
    	msg += "Oral Surgery - Practical Applications and Troubleshooting (DDS only) - ".$F2." participants\n";
    	msg += "Local Anesthesia and Analgesic Pharmacology (DDS only) - ".$F3." participants\n";
    	msg += "Interceptive Orthodontics for General Practitioners (DDS only) - ".$F4." participants\n";
    	msg += "Endodontic Diagnosis and Therapy Update (DDS only) - ".$F5." participants\n";
    	msg += "Canadian Academy of Cosmetic Dentistry (DDS only) – Full Day  - ".$F61." participants\n";	
    	msg += "Table Clinics – Students & Guests – Morning (DDS, DH, DA)  - ".$F7." participants\n";	
    	msg += "Dental Public Health Workshop and Panel Discussion (DDS, DH, DA) - ".$F8." participants\n";
    	msg += "Oral Pathology Interactive Seminar (DDS and DH only) - ".$F9." participants\n";
    	msg += "Saturday:\n";
    	msg += "Contemporary Dental Treatment for Children (DDS, DH, DA) - ".$S1." participants\n";
    	msg += "Team Treatment Planning – Dare to Care (DDS, DH, DA) - ".$S2." participants\n";
    	msg += "Medical Emergencies in the Dental Office (DDS, DH, DA) - ".$S3." participants\n";
    	msg += "The Great White Hype: Anterior and Posterior Composite Restorations (DDS only) - ".$S4." participants\n";
    	msg += "Making Removable Prostheses Work (DDS only) - ".$S5." participants\n";
    	msg += "Dental Practice Appraisal and Brokerage (DDS only) - ".$S6." participants\n";
    	msg += "Canadian Academy of Public Health Dentistry - Annual Meeting - ".$S7." participants\n";
    	msg += "Registration fees: $".$registrationfee."\n";
    	msg += "Course fees: $".$coursefees."\n";
    	msg += "Social fees: $".$socialfees."\n";
    	msg += "Total Payment: $".$totalpayment."\n";
    	msg += "Form of payment: ".$payment."\n";
    	msg += "Credit card number: ".$cc_number."\n";
    	msg += "Expiry date: ".$cc_month."/".$cc_expiry."\n";
    	msg += "Name on credit card: ".$cc_name;

    Source: http://community.livejournal.com/php/399562.html

  4. PHP + MySQL 4.1

    Date: 01/20/06     Keywords: php, mysql, database, sql, web, apache

    FIXED. Thanks to '[info]'afromann, '[info]'cowsandmilk, and '[info]'nentwined!

    I've been looking around since yesterday and just can't seem to find a definitive answer -- how exactly do you use MySQL 4.1.x with PHP 4.x?

    Needing some of the functionality available in MySQL 4.1 (and since our host has that as well), I installed it, updated my phpMyAdmin settings, and came across "Client does not support authentication protocol requested by server; consider upgrading MySQL client" message. So I went looking for a fix for that. It told me I had to use the mysqli extension for PHP, but since I installed PHP using the installer (I am on a Windows machine, with Apache), I uninstalled PHP, downloaded the binary zip... but can't find the mysqli extension in the extensions folder in the zip.

    So now I am in a quandary. The mysqli extension is not in the binary zip; is it only for PHP5? But the host we're on has MySQL 4.1.x AND PHP 4.x! The manual says something about compiling PHP with support for the mysqli extension -- do I have to recompile PHP4, is that it?

    Help, advice, suggestions, etc would be very much appreciated, thanks.


    Windows XP Pro
    Apache 1.3 (I'm using Apache 2.0 on ANOTHER machine)
    MySQL 4.1.16
    PHP... well, none as of the moment, but I was using PHP 4.3.x; I'm trying to install 4.4.2

    (Ask if there's anything else needed.)

    Update: I thought it would be good to post an update since the update might be significant and people don't always check other comments. :)

    Actually, I just got phpMyAdmin working -- not exactly sure what happened there, as the only thing I did was create another mysql user with access to all the databases and use that for phpMyAdmin. I thought my problem was fixed but now I'm trying to log into the webapp I'm working on, to no avail -- the script just plain dies (no warnings, errors, messages, nothing) when I call mysqli_connect( host, user, pw, database). Echoing before and after that line--

    echo 'before call';
    $link = mysqli_connect( host, user, pw, database ) or die( 'Error: ' . mysqli_connect_error() );
    echo 'after call';


    The ONLY output is "before call". NONE of the code after the connect gets run, and obviously the die() didn't work either (or didn't output anything within the parentheses, anyway). Hence I'm a little confused why phpMyAdmin is working (without recompiling php, and without the extension dll either since I can't find it) but my script can't. I'm assuming it's BECAUSE I haven't recompiled PHP, so... yeah.


    Fix: I'm not sure why phpMyAdmin can connect using php4 without having to use MySQL's old password hashing algorithm for its user, but it's probably just amazing that way. Used the OLD_PASSWORD() function to change the password for my script's user, and now it's working fine again with the ordinary mysql_* calls. :)

    Crossposted: '[info]'php, '[info]'webdev, '[info]'developers

    Source: http://community.livejournal.com/php/399323.html

  5. PHP shell access question

    Date: 01/19/06     Keywords: php, mysql, sql, security

    Hello all,

    I am working on a project to create highly customizable live cds mainly for my peronal use and for friends to try diffrent OSs. At the moment I have several shell scripts that I am looking at converting over to PHP if possiable. The bulk of it i know can be ported easily enough but I have never attempted to call other programs besides MySQL in PHP so I am not quite sure if it is feasable. The server will be located all inhouse with no outside access untill i can be sure of the security implcations involved in the procedure and lower the risks. Can I access other programs through php, spefically can I run "/usr/local/bin/mkisofs -b boot/cdboot -no-emul-boot -c boot/boot.catalog -r -l -L -V LiveCD -o $LIVEISODIR/LiveCD.iso ." and get the intended result? Any thoughts would be appreciated.

    Source: http://community.livejournal.com/php/398676.html

  6. CMS

    Date: 01/19/06     Keywords: cms, mysql, database, sql

    I am writing an open source cms called Rade (intended for release), and want to store images in the MySQL database; MediaWiki's upload system sounds suspiciously insecure, and makes storing metadata harder. However, I have read that blobs in SQL databases decrease their performance. Should I store the images in another table? Another database?

    Source: http://community.livejournal.com/php/398428.html

  7. A dynamic top ten downloads list?

    Date: 01/18/06     Keywords: php, web

    Hi everyone,

    I'm working on a project that is a video archive, and my comrades would like the main archive page to feature a "top ten viewed" list that is dynamically up-to-date at any point in time. What I can't figure out is how to obtain the statistics that would deem the top downloaded video as the top one, 2nd as 2nd, etc. Is there a way I can parse our web stats via php to figure out which ones belong in the top ten? I view my stats using WebTrends, and it doesn't seem like there's any interface for that kind of activity (which I can't say I would expect, either).

    People do this stuff all the time - how do they do it?

    Source: http://www.livejournal.com/community/php/398210.html

  8. A dynamic top ten downloads list?

    Date: 01/18/06     Keywords: php, web

    Hi everyone,

    I'm working on a project that is a video archive, and my comrades would like the main archive page to feature a "top ten viewed" list that is dynamically up-to-date at any point in time. What I can't figure out is how to obtain the statistics that would deem the top downloaded video as the top one, 2nd as 2nd, etc. Is there a way I can parse our web stats via php to figure out which ones belong in the top ten? I view my stats using WebTrends, and it doesn't seem like there's any interface for that kind of activity (which I can't say I would expect, either).

    People do this stuff all the time - how do they do it?

    Source: http://community.livejournal.com/php/398210.html

  9. Reinventing the wheel

    Date: 01/18/06     Keywords: no keywords

    At the risk of starting a debate, I'm going to wander slightly off the topic of actual code for a moment and pose a question for the community regarding a topic I see come up time and again (infact, in nearly every post);

    Why the aversion to reinventing the wheel?
    (That is, providing the reinventor is aware that alternatives already exist out there)

    Source: http://www.livejournal.com/community/php/397829.html

  10. Reinventing the wheel

    Date: 01/18/06     Keywords: no keywords

    At the risk of starting a debate, I'm going to wander slightly off the topic of actual code for a moment and pose a question for the community regarding a topic I see come up time and again (infact, in nearly every post);

    Why the aversion to reinventing the wheel?
    (That is, providing the reinventor is aware that alternatives already exist out there)

    Source: http://community.livejournal.com/php/397829.html

  11. Password hasing resources

    Date: 01/18/06     Keywords: php, web

    Hello all,

    Does anyone know of any definitive guides/tutorials on the Web about password hashing using PHP? I'd read one some months back, but it was incomplete.

    Thanks.

    Source: http://www.livejournal.com/community/php/397562.html

  12. Password hasing resources

    Date: 01/18/06     Keywords: php, web

    Hello all,

    Does anyone know of any definitive guides/tutorials on the Web about password hashing using PHP? I'd read one some months back, but it was incomplete.

    Thanks.

    Source: http://community.livejournal.com/php/397562.html

  13. Writing Text File To the User Desktop

    Date: 01/18/06     Keywords: web

    I've just begun researching how to write a text file to the user's desktop.

    For reason's I can't understand, I have to be able to take the info contained in a web form and save it as a text file to the users desk (create an array, write a tab delinated file).

    Later, I will have to allow the user to locate thsi file and re-populate the form with the data.

    I'd appreciate any help and tips you have.

    more: the user will click to save and select the location. And then find the file later. It's not automatic.

    Source: http://www.livejournal.com/community/php/396847.html

  14. Writing Text File To the User Desktop

    Date: 01/18/06     Keywords: web

    I've just begun researching how to write a text file to the user's desktop.

    For reason's I can't understand, I have to be able to take the info contained in a web form and save it as a text file to the users desk (create an array, write a tab delinated file).

    Later, I will have to allow the user to locate thsi file and re-populate the form with the data.

    I'd appreciate any help and tips you have.

    more: the user will click to save and select the location. And then find the file later. It's not automatic.

    Source: http://community.livejournal.com/php/396847.html

  15. $_REQUEST, $_POST, $_GET

    Date: 01/17/06     Keywords: security

    Greetings.

    I've been using $_REQUEST for a few years now instead of $_GET or $_POST. I have yet to find any sort of decent reasoning as to why we should be using one or the other.

    Are there any potential security benefits or risks with using $_REQUEST instead?

    Source: http://www.livejournal.com/community/php/396705.html

  16. $_REQUEST, $_POST, $_GET

    Date: 01/17/06     Keywords: security

    Greetings.

    I've been using $_REQUEST for a few years now instead of $_GET or $_POST. I have yet to find any sort of decent reasoning as to why we should be using one or the other.

    Are there any potential security benefits or risks with using $_REQUEST instead?

    Source: http://community.livejournal.com/php/396705.html

  17. Browser problem or code problem?

    Date: 01/17/06     Keywords: php, mysql, browser, database, sql

    Ok, so I have the following code, meant to delete a category in a script I'm working on. It takes the category ID from the $_GET array, checks the database to make sure such a category ID exists, then deletes it if true or shows an error if false.

    if ($_GET['categories'] == "deletecat") {
    if (isset($_GET['delid'])) {
    $idofd = cleaninput($_GET['delid'], 1);
    $idofd = (int)$idofd;
    $check_delete = mysql_fetch_assoc(mysql_query("SELECT * FROM table_cats WHERE cat_id = '" . $idofd . "' LIMIT 1", $connect));
    if (empty($check_delete)) {
    echo "

    Error: There is no category with the ID number " . $idofd . ".

    ";
    }
    else {
    $deletecateg = mysql_query("DELETE FROM table_cats WHERE cat_id = '" . $idofd . "' LIMIT 1", $connect);
    if ($deletecateg) {
    echo "

    The category was successfully deleted.


    Go back

    ";
    }
    else {
    echo "

    The category could not be deleted: " . mysql_error($connect) . "

    ";
    }
    }
    }
    else {
    echo "

    Error: No category selected for deletion.

    ";
    }
    }


    When I execute this code, Firefox will always tell me that there is no category with the ID number specified, even when it does exist - however it will delete the category anyway. Opera does things correctly - a category is selected for deletion and the success message is shown.

    Is this a browser problem or a code problem? I have tried all sorts of different solutions, originally the code was as such:

    if (!empty($check_delete)) {

    // delete the category

    }

    else {

    // display error

    }


    However I switched it around thinking that maybe Firefox was taking too long to check the category and then finding it deleted or something like that.

    I haven't been able to test this in IE yet, but I have a feeling it might work, like it did in Opera. So... any ideas as to why it's not working in Firefox?

    Specs: PHP 5.0.5/MySQL 5.0.15 running on Windows XP (local testing server); Firefox 1.5

    Thanks in advance.

    PS: First post to this community! *Bows low*

    Edit: Solved! Firefox didn't like having a button in the form field used to get the delete ID (it's a "get" method form). Changed it to a normal link and everything now seems to be working as it should. :)

    Source: http://www.livejournal.com/community/php/396330.html

  18. Browser problem or code problem?

    Date: 01/17/06     Keywords: php, mysql, browser, database, sql

    Ok, so I have the following code, meant to delete a category in a script I'm working on. It takes the category ID from the $_GET array, checks the database to make sure such a category ID exists, then deletes it if true or shows an error if false.

    if ($_GET['categories'] == "deletecat") {
    if (isset($_GET['delid'])) {
    $idofd = cleaninput($_GET['delid'], 1);
    $idofd = (int)$idofd;
    $check_delete = mysql_fetch_assoc(mysql_query("SELECT * FROM table_cats WHERE cat_id = '" . $idofd . "' LIMIT 1", $connect));
    if (empty($check_delete)) {
    echo "

    Error: There is no category with the ID number " . $idofd . ".

    ";
    }
    else {
    $deletecateg = mysql_query("DELETE FROM table_cats WHERE cat_id = '" . $idofd . "' LIMIT 1", $connect);
    if ($deletecateg) {
    echo "

    The category was successfully deleted.


    Go back

    ";
    }
    else {
    echo "

    The category could not be deleted: " . mysql_error($connect) . "

    ";
    }
    }
    }
    else {
    echo "

    Error: No category selected for deletion.

    ";
    }
    }


    When I execute this code, Firefox will always tell me that there is no category with the ID number specified, even when it does exist - however it will delete the category anyway. Opera does things correctly - a category is selected for deletion and the success message is shown.

    Is this a browser problem or a code problem? I have tried all sorts of different solutions, originally the code was as such:

    if (!empty($check_delete)) {

    // delete the category

    }

    else {

    // display error

    }


    However I switched it around thinking that maybe Firefox was taking too long to check the category and then finding it deleted or something like that.

    I haven't been able to test this in IE yet, but I have a feeling it might work, like it did in Opera. So... any ideas as to why it's not working in Firefox?

    Specs: PHP 5.0.5/MySQL 5.0.15 running on Windows XP (local testing server); Firefox 1.5

    Thanks in advance.

    PS: First post to this community! *Bows low*

    Edit: Solved! Firefox didn't like having a button in the form field used to get the delete ID (it's a "get" method form). Changed it to a normal link and everything now seems to be working as it should. :)

    Source: http://community.livejournal.com/php/396330.html

  19. PHP layout/database question

    Date: 01/17/06     Keywords: php, css, html, database, web

    I have a website, just a little personal project where I archive my writing. Over the years I have streamlined the code of this page as my knowledge of web design grows, so that it has gone from ugly frames to a smooth CSS-based design. However, this site has many identical pages (as far as layout is concerned, not content), and every time I significantly update the site layout, I always end up having to update each and every page manually. This is a pain.

    So here is what I would like to do about this:

    1) Create a database of some sort, or maybe just a collection of .txt files, and when a user clicks on a link (say, to one of my poems), have PHP generate the page based on information parsed in the link. I have no idea if this is even possible.

    or

    2) Create one file containing all of the layout's HTML information, and have each page access it instead of having to hardcode such into each file. This file could also contain the CSS information if possible.

    The trick to all this is that while I am a master of HTML/CSS design, I know next to nothing about PHP, beyond how to write the simplest of scripts and how to upload it to my domain. Is what I'm proposing even feasible, and if so, does anyone have any suggestions/advice/code/places to go for more information to help me make it work?

    Thanks so much if you can help me, and apologies for being such a newbie pain!

    Source: http://www.livejournal.com/community/php/395976.html

  20. PHP layout/database question

    Date: 01/17/06     Keywords: php, css, html, database, web

    I have a website, just a little personal project where I archive my writing. Over the years I have streamlined the code of this page as my knowledge of web design grows, so that it has gone from ugly frames to a smooth CSS-based design. However, this site has many identical pages (as far as layout is concerned, not content), and every time I significantly update the site layout, I always end up having to update each and every page manually. This is a pain.

    So here is what I would like to do about this:

    1) Create a database of some sort, or maybe just a collection of .txt files, and when a user clicks on a link (say, to one of my poems), have PHP generate the page based on information parsed in the link. I have no idea if this is even possible.

    or

    2) Create one file containing all of the layout's HTML information, and have each page access it instead of having to hardcode such into each file. This file could also contain the CSS information if possible.

    The trick to all this is that while I am a master of HTML/CSS design, I know next to nothing about PHP, beyond how to write the simplest of scripts and how to upload it to my domain. Is what I'm proposing even feasible, and if so, does anyone have any suggestions/advice/code/places to go for more information to help me make it work?

    Thanks so much if you can help me, and apologies for being such a newbie pain!

    Source: http://community.livejournal.com/php/395976.html

Previous page  ||  Next page


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home