AS3 / PHP / MySQL - login form

Hello

I am creating the simplest example I can an AS3/PHP/MySQL interaction.  I want a Flash animation to check login/pass a user against a database.  I tested the PHP code and know that it is correct.  The problem must lie in his.  I traced everything to make sure that it shuts down correctly, but it is up under the names of variable $user, $passer... and some of the other garbage... not the values of the variables I wait... see below.

The PHP code returns correctly what follows when tested in the browser: user = dan & pass = danpass & err = success!

The variable traces $user, $pass, $err return the following Flash:

undefined

$pass

$err ';


echo $returnString;


}


? >

The following ActionScript code:

import flash.events. *;

import flash.net.URLLoader;

import flash.net.URLRequest;

import flash.net.URLVariables;

import flash.net.URLRequestMethod;

logbtn.addEventListener (MouseEvent.CLICK, login)

function login ($e:MouseEvent) {}

var myVariables:URLVariables = new URLVariables();

var myRequest:URLRequest = new URLRequest ("login.php");

myRequest.method = URLRequestMethod.POST;

myRequest.data = myVariables;

var myLoader:URLLoader = new URLLoader;

myLoader.dataFormat = pouvez;

myLoader.addEventListener (Event.COMPLETE, completeHandler);

myVariables.user = loguser.text;

myVariables.pass = logpass.text;

myLoader.load (myRequest);

function completeHandler(event:Event):void {}

trace (Event.Target.Data.User);

trace (Event.Target.Data.Pass);

trace (Event.Target.Data.Err);

}

}

And here is the PHP:

<? PHP

include_once "dbconnect.php";

$user = $_POST ['user'];

$pass = $_POST ['pass'];

$sql = mysql_query ("SELECT * FROM users WHERE user = ' $user ' AND pass = '$pass'");

$check = mysql_num_rows ($sql);

If ($check > 0) {}

$row = mysql_fetch_array ($sql);

$user is $row ['user'];.

$pass is $row ['pass'];.

$err = ' Success! ';

$returnString = "user = $user & pass = $pass & err = $err;

echo $returnString;

}

? >

Nothing stands out as incorrect?  I went on that for probably 10 or 15 hours trying different variations, tweaks and reduce complexity.  Really, I'd appreciate any help you can offer!  Thank you.

-Eric

Hello

you load the php file in the same folder, or localhost (running the SWF in a browser)?

If being run from localhost, your system could deliver rather than run php scripts

Tags: Adobe Animate

Similar Questions

  • Flash / php / mysql login

    Hello! I'm just a flash noobie and I just saw a connection php flash tutorial that works but I need to change a few outings on the flash.

    The connection works very well except that in only views that you are now logged, what I wanted to do are logged in successfully... the film should play the rest of the frames or I want the action to order the flash animation to achieve a specific image after successful login.


    I know that my question is too easy, but I really need help using flash, thanks.

    remove the onEnterFrame when your goto runs otherwise it will run several times and stay on chassis 300 instead of play over 300 managers.

  • I get this error with my login form, I did, but I'm not sure if this is a problem with my php code or

    I get this error with my login form when I try to log in, but I'm not sure if this is a problem with my php code or my flex code!

    ReferenceError: Error #1069: loginsuccess property not found on string and there is no default value.
    CBC::main/checkLogin()
    CBC::main/__login_user_result()
    to flash. events::EventDispatcher / dispatchEv...
    to flash. events::EventDispatcher / dispatchEv...
    to HTTPOperation / http://www.Adobe.com/2006/Flex/MX/internal:dispatchRpcEvent ()
    to mx.rpc::AbstractInvoker / http://www.Adobe.com/2006/Flex/MX/internal:resultHandler ()
    at mx.rpc::Responder/result()
    at mx.rpc::AsyncRequest/acknowledge()
    to the DirectHTTPMessageResponder/completeHandl...
    to flash. events::EventDispatcher / dispatchEv...
    to flash. events::EventDispatcher / dispatchEv...
    at flash.net::URLLoader/onComplete()


    my php code is:


    [php] <? PHP

    define ("DATABASE_SERVER", "localhost");

    define ('DATABASE_USERNAME","f4r");

    define ('DATABASE_PASSWORD', 'cool23');

    define ('database_name', 'bignixs1');

    connect to the database

    $mysql = mysql_connect (DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD) or die (mysql_error ());

    Select the database

    @mysql_select_db (DATABASE_NAME);

    re-branded the data passed from Flex to variables

    $username = mysql_real_escape_string ($_POST ["usernam...)

    $password = mysql_real_escape_string ($_POST ["passwor...)

    Ask the database to see if the combination of username/password given name is valid.

    $query = "SELECT * from users WHERE username = 'username' AND password = 'password" ";

    $result = mysql_fetch_array (mysql_query ($query));

    start generating XML

    $output = "< loginsuccess > ';

    If the query returned true, exit < loginsuccess > Yes < / loginsuccess > other output < loginsuccess > not < / loginsuccess >

    if(!$result)

    {

    $output. = « no » ;

    } else {}

    $output. = "yes";

    }

    $output. = "< / loginsuccess > ';

    all the XML for output

    print ($output);

    ? > [/php]

    $query = "SELECT * from users WHERE username = 'username' AND password = 'password" ";

    should be

    $query = "SELECT * FROM users WHERE username = '$username' AND password =  '$password'";
    

    example of a system of working with the correct connection code flex & php to ensure:

    http://www.mattlefevre.com/viewExample.php?tut=flexPHP&proj=simple%20Login%20Application

  • OT: Login Form tips

    I found a plugin to form really cool registration @ http://jqueryvalidation.org/files/demo/milk/ and figured out how to connect to a database. Then I started looking for a tutorial of login form. It was tricky because most of the tutorials are pre - AOP; in other words, they only work with queries that have been upgraded to PDO MySQL.

    But I finally found a good example to the authentication of the connection base with PHP and MySQL

    I got it running, but there is a snag - it won't work with my registration form. If I type in my_username, my_password in my registration form, these two values are published in the database. But the login form apparently only works with the values that were added via an attached add_user page. If you type in these values, my_username is published to the database table, but my_password is replaced by an incredibly long code, like this: 5c4ed510fef54a63a2211ca47d5c82736de69418

    You can then connect by typing my_username and base, although my_password is not stored in the database table. I think this code at the head of one of my files explains everything:

    session_start();

    / * define a form token * /.

    $form_token = md5 (uniqid ('auth', true));

    / * set the session form token * /.

    $_SESSION ["form_token"] = $form_token;

    So here's my question: should I try to figure out how to erase all $form_token/md5 of things so it does not work with my jQuery registration form, or should I try to change my cool registration form so that it replaces passwords with the form_token? Put an another passerby, is a standard security feature, I should spend time on?

    A problem is that, if a user loses their username, I will not be able to send a reminder if no user name is stored in the database table. Everything I do is send them an incredibly long code and tell them to figure it out.

    Thank you.

    I didn't spend the whole article, but enough to know that a human readable password Gets encoded with md5 encoding as in

    $form_token = md5 (uniqid ('auth', true));

    This provides additional security in case someone manages to get into the database to retrieve usernames and passwords associated.

    The idea is that the user enters his credentials and the encoded version of the password is compared to the database entry. If they match, then bingo! There is no way to crack the code to extract the human version; If the encoded version is entered, it will not match the database entry.

    It's you if you want to delete the md5 encoding.

  • Unable to connect error 404 PHP/MySQL

    Wow, the learning curve is killing me. Yet another challenge. I use Dreamweaver CC and this tutorial http://www.adobe.com/devnet/dreamweaver/articles/setup_php.html

    I'm at this stage:

    1. Open comments.php . You must have a PHP page open in the Document window to create a MySQL connection.
    2. In the databases Panel (choose window > databases), click on the sign located on the Panel and select MySQL Connection.The MySQL connection dialog box appears.
    3. Type connTest as login name.
    4. For the MySQL server, type localhost. If you use MAMP ports by default on a Mac, use localhost:8889.
    5. For the user name, type phptestuser.
    6. Type the password that you chose for the phptestuser account in the password field.
    7. To the database, type php_test. Note: You need not precede the underscore with a backslash character here. It was inserted by phpMyAdmin in the previous section (see Figure 20) only because phpMyAdmin uses a query which allows wildcards.
    8. Click on Test.Dreamweaver tries to connect to the database. If the connection fails, follow these steps:
      • Check the server name, user name, and password.
      • Check the settings in the file that Dreamweaver uses to process dynamic pages (see specification of a Dreamweaver testing server).
      • Ensure that the web and MySQL server are both running.
      • Temporarily disable any firewall or security program. If the connection works, you must configure the security program to allow communication between Dreamweaver and MySQL.
    9. Click OK. The new connection appears in the data Panel.
    10. Expand connTest connection, and then expand the Tables branch. You will see the comments table in the database, you can expand to reveal the details of the columns in the table (see Figure 23).

    I can say that I followed this tutorial to the letter.

    As far as I know, XAMPP/php mySQL all running very well, the files are in the right place and everything should work. However when I type test, I get a 404 error. (Same error when I hit the select button).

    The problems on the 404 message are:

    1. There is no server running on the server test.

    Sure the testing server is running. Is there a way to test this, another that note that xampp is certainly running right now and I can connect to phpMYadmin without problem?

    2 test specified for this site server is not mapped with the http://localhost/php_test/_MMServerScripts/MMHTTPDB.php URL check that the URL prefix maps to the root of the site.

    UH... I'm sure that I put things where I was told to put them in the tutorial, but I'm lost right now where I should check that. A clue here? The files are where they are supposed to be, but maybe I entered something wrong? Except... I don't know what it might be or where to find it. Whatever IT is.

    Everything in the local files is fine.

    Thanks for your help!

    PS: Extra points to anyone who figures how to make copy/pasteable error messages! These guys are the bane of my life!

    Stop and restart the services he. Stop Xampp if still the same behavior. It should look like as below

  • Switch login form of disconnect form once connected...

    Hi, I work with dreamweaver cs5.5 and I make php pages so users can connect. I don't know how to replace the login form with a form of disconnect recorded once. Can someone help please, I will be very greatfull.

    lol all I need is to ensure that I had the php in ""

  • Code PHP/mySQL help please

    Hi all

    Thanks to David Powers fab tutorial I am now well on my way to my first dynamic website with PHP/mySQL competeing, (thanks to David ), but I'm stuck on one particular area... can someone please help?

    I know that the mySQL database using the YYYY/MM/DD format for dates, and that's fine. I set how to display in a format more regular (for example, September 1, 2011) for my application, but I'm stuck on how to convert a more regular formatting date is entered by the user of the site to mySQL format.

    Ideally I would like to enter users or tell the 09/01/11 or 09/01/11 (or something in that sense, to be recognized and displayed on the registration form, but to have a back-end service that converts the data to the format mySQL. I think I'm reading a lot of posts forum who say that this is possible, but unfortunately I can't quite understand how or where the code should sit. Someone would have is not afraid to take a look at my page of codes to identify actually what I need to insert and also as important... where!

    Is it possible to have a miniature calendar date picker that can be built next to the entry field in the right format and date to make sure that a valid date is entered along these lines? Where this could be extracted?

    Thanks for help if necessary

    Mark

    GetSQLValueString (date('Y-m-d'), strtotime($_POST['date']), 'day'),

    Make this line looks like this-

    GetSQLValueString (date ('Y-m-in, strtotime($_POST['date'])), 'day'),

    This was my mistake - sorry.  The MySQL data type DATE should be in YYYY-MM-DD format.  If this is the data type of this field "date", and then copy the following code should work.

  • Insert a special character such as apostrophes with PHP/Mysql

    Hi friends,

    I have a problem with php/mysql. I created a form vach'inton a page php with dreamweaver and when I try to fill in the form with a string that contains an apostrophe ('), I got an error. It seems that integration is not possible. Would you have any idea for that. I give you the code of dreamweaver php and thank you for your help.

    <? php require_once('Connections/Mainconnect.php');? >

    <? php require_once('Zend/Date.php');? >

    <? PHP

    If (! function_exists ("GetSQLValueString")) {}

    function GetSQLValueString ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

    {

    If (via PHP_VERSION < 6) {}

    $theValue = get_magic_quotes_gpc()? stripslashes ($TheValue): $theValue;

    }

    $theValue = function_exists ("mysql_real_escape_string")? mysql_real_escape_string ($TheValue): mysql_escape_string ($theValue);

    Switch ($theType) {}

    case 'text ':

    $theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";

    break;

    case "long":

    case "int":

    $theValue = ($theValue! = "")? intval ($TheValue): 'NULL ';

    break;

    case "double":

    $theValue = ($theValue! = "")? doubleVal ($TheValue): 'NULL ';

    break;

    case "date":

    If ($theValue =="")

    {

    $theValue = "NULL";

    }

    on the other

    {

    $zendDate = new Zend_Date($theValue,"dd/MM/yyyy");

    $theValue = "" "." $zendDate-> toString("yyyy-MM-dd"). »" « ;"

    }

    break;

    case "set":

    $theValue = ($theValue! = "")? $theDefinedValue: $theNotDefinedValue;

    break;

    }

    Return $theValue;

    }

    }

    $editFormAction = $_SERVER ['PHP_SELF'];

    If (isset {}

    $editFormAction. = « ? ». htmlentities($_SERVER['QUERY_STRING']);

    }

    If ((isset($_POST["MM_update"])) & & ($_POST ["MM_update"] == "form1")) {}

    $updateSQL = sprintf ("UPDATE pers_soc_reg SET Field1 = %s, Field2 = %s,

    GetSQLValueString ($_POST ["field1"], "text").

    GetSQLValueString ($_POST ["Field2"], "double"));

    Hello friends,

    I solved the problem.

    The problem is a free extension for dreamweaver called 'check new items' of Felixone. After his retirement, all forms of work without problem.

    Thanks to you all.

  • Unknown column in the PHP/MySQL field list

    I created a feedback form for our airshow site and it works great. I now create some pages of the review, which are also working well, then

    ... I decided to improve one of the review pages and now it does not work... sigh.

    We ask stakeholders to provide their zip code and I have a vision showing the number of responses by postcode, this works very well and can be seen here http://www.hollisterairshow.com/feedback-results.php , so I decided to improve it by adding the City / State based on zip code. I created a new table called 'postcodes' and imported a list of zip codes and city / state info - all the 42,000 + of them.

    The PHP/MySQL, who works is illustrated below

    <? PHP
    Connect MySQL

    $query = "SELECT zip, COUNT (zip) ZIP GROUP BY feedback";

    $result = mysql_query ($query) or die (mysql_error ());

    Print results
    While ($row = {mysql_fetch_array ($result))}
    echo $row ["zip"]. " ". $row ['COUNT (zip)'];
    echo "< br / > ';
    }
    ? >

    As I am now faced with two tables, I thought that I had to add the name of the table in any field, so I added the names of tables and fields to the new table so

    I changed the PHP / MySQL as follows

    <? PHP
    Connect MySQL

    $query = 'SELECT feedback.zip, COUNT (feedback.zip), zipcodes.citystate OF feedback codes postal WHERE feedback.zip = zipcodes.zipcode GROUP BY feedback.zip';

    $result = mysql_query ($query) or die (mysql_error ());

    Print results
    While ($row = {mysql_fetch_array ($result))}
    echo $row ['feedback.zip']. " ". $row ['COUNT (feedback.zip)']. " ". $row ['zipcodes.citystate'];
    echo "< br / > ';
    }
    ? >

    and it fails when I run it says ' Unknown column 'feedback.zip' in "field list '"

    I would be grateful any suggestion on this, I am new on this PHP/MySQL stuff.

    Thank you

    Tony

    Tables listed in the From clause must be separated by commas. As it is, it is evaluated as an alias.

  • PHP/MySql error message

    I posted this before and didn't get the answer I need, probably because I didn't post all my codes. I use PHP/MySql.  I created a Web site that has several forms.  When I conducted three of the forms, I get the below error messages:

    You have an error in your SQL syntax; consult the manual for your version of the MySQL server for the right syntax to use near ' condition, length, color, city, 'State', Email, Photo) VALUES ('29 ', ' 4',' used "in line 1.)

    I write the codes below.  I hope this time that I posted everything I should have so that I can get help.

    FORM

    < form action = "<?" PHP echo $editFormAction;? ">" method = "POST" enctype = "multipart/form-data" name = "individual" class = 'individual' id 'individual' = >
    < table width = "594" border = "0" class = "test" >
    < tr > < /tr >
    < b >
    < td width = "166" class = 'td' > view < table > title
    < td colspan = "3" > < span id = "sprytextfield1" >
    < label >
    < input name = "Display title" type = "text" class = "test" id = "Display title" size = "35" / >
    < / label >
    < span class = "textfieldRequiredMsg" > required </span > < / span > < table >
    < /tr >
    < b >
    < td = 'td' class > price < table >
    < td colspan = "3" > < span id = "sprytextfield2" >
    < label >
    < input name = "price" type = "text" class = 'test' id = 'price' size = '35' / >
    < / label >
    < span class = "textfieldInvalidFormatMsg" > Invalid format. </span > < / span > < table >
    < /tr >
    < b >
    < class td = 'td' > < table > format
    < td colspan = "3" > < label >
    < select name = "size" = "1" multiple = "multiple" class = 'test' id = 'size' >
    < option > 0 < / option >
    < option > 2 < / option >
    < option > 4 < / option >
    < option > 6 < / option >
    < option > 8 < / option >
    < option > 10 < / option >
    < option > 12 < / option >
    < option > 14 < / option >
    < option > 16 < / option >
    < option > 18 < / option >
    < option > 20 < / option >
    < option > 22 < / option >
    < option > 24 < / option >
    < option > 26 < / option >
    < / select >
    < / label > < table >
    < /tr >
    < b >
    < class td 'td' = > status < table >
    < td colspan = "3" > < label >
    < select name = "Condition" class = 'test' id = 'State' >
    < option > new < / option >
    < option > used < / option >
    < / select >
    < / label > < table >
    < /tr >
    < b >
    < class td 'td' = > length < table >
    < td colspan = "3" > < label >
    < select name = "Length" class = 'test' id = 'Length' >
    Long < option > < / option >
    Short < option > < / option >
    < option > mid-length < / option >
    < / select >
    < / label > < table >
    < /tr >
    < b >
    < class td 'td' = > color < table >
    < td colspan = "3" class = 'td' > < span id = "sprytextfield5" >
    < label >
    < input name = "Color" type = "text" class = "test" id = "Color" size = "35" / >
    < / label >
    < span class = "textfieldRequiredMsg" > required </span > < / span > < table >
    < /tr >
    < b >
    < class td 'td' = > city < table >
    < class td = 'td' > < span id = "sprytextfield4" >
    < label >
    < input name = "City" type = "text" class = 'test' id = 'City' size = "35" / >
    < / label >
    < span class = "textfieldRequiredMsg" > required </span > < / span > < table >
    < class td = 'td' > < table >
    < class td = 'td' > < table >
    < /tr >
    < b >
    < class td 'td' = > status < table >
    < td colspan = "3" > < label >
    < select name = "State" class = 'test' id = 'State' >
    < option > AL < / option >
    < option > AK < / option >
    < option > AZ < / option >
    < option > AR < / option >
    < option > CA < / option >
    < option > CO < / option >
    < option > CT < / option >
    < option > OF < / option >
    < option > DC < / option >
    < option > FL < / option >
    < option > GA < / option >
    < option > HI < / option >
    ID < option > < / option >
    < option > HE < / option >
    IN < option > < / option >
    < option > HERE < / option >
    < option > KS < / option >
    < option > KY < / option >
    < option > THE < / option >
    < option > ME < / option >
    < option > MD < / option >
    < option > MY < / option >
    < option > e < / option >
    < option > MN < / option >
    < option > MS < / option >
    < option > MO < / option >
    < option > MT < / option >
    < option > NOT < / option >
    < option > NV < / option >
    < option > NH < / option >
    < option > NJ < / option >
    < option > NM < / option >
    < option > NY < / option >
    < option > NC < / option >
    < option > ND < / option >
    < option > OH < / option >
    < option > OK < / option >
    < option > OR < / option >
    < option > PA < / option >
    < option > LAUGHED < / option >
    < option > SC < / option >
    < option > SD < / option >
    < option > TN < / option >
    < option > TX < / option >
    < option > c < / option >
    < option > VT < / option >
    < OPTION > < / option >
    < option > WA < / option >
    < option > WV < / option >
    < option > WI < / option >
    < option > WY < / option >
    < / select >
    < / label > < table >
    < /tr >
    < b >
    < class td 'td' = > Email < table >
    < td colspan = "3" > < span id = "sprytextfield3" >
    < label >
    < input name = "Email" type = "text" class = "test" id = "Email" size = "35" / >
    < / label >
    < span class = "textfieldRequiredMsg" > required </span > < span class = "textfieldInvalidFormatMsg" > Invalid format. </span > < / span > < table >
    < /tr >
    < b >
    < height = "26" td class = 'td' > confirm Email < table >
    < td colspan = "3" > < span id = "spryconfirm1" >
    < label >
    < input name = "Confirm Email2" type = "text" class = 'test' id = 'confirm Email2"size ="35"/ >
    < / label >
    < span class = "confirmRequiredMsg" > required </span > < span class = "confirmInvalidMsg" > the values don't match. </span > < / span > < table >
    < /tr >
    < b >
    < height td = '26' class = 'td' > photo (s) < table >
    < td colspan = "3" > < label >
    < input name = "Photo" type = 'file' class = 'test' id = 'Photo' size = "35" / >
    < / label > < table >
    < /tr >
    < b >
    < height = '131' td class = 'td' > < table > Details
    < td colspan = "3" > < label >
    < textarea = cols "Additional Details" name = "40" lines "6" = class = 'test' id = "Détails" > < / textarea >
    < / label > < table >
    < /tr >
    < /table >
    < p >
    < label >
    < input name = "Submit" type = 'submit' class = 'test' id = "Submit" value = "Post" / >
    < / label >
    < /p >
    < input type = "hidden" name = "MM_insert" value = "individual" / >
    < / make >

    SERVER BEHAVIOR


    If (! function_exists ("GetSQLValueString")) {}
    function GetSQLValueString ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    If (via PHP_VERSION < 6) {}
    $theValue = get_magic_quotes_gpc()? stripslashes ($TheValue): $theValue;
    }

    $theValue = function_exists ("mysql_real_escape_string")? mysql_real_escape_string ($TheValue): mysql_escape_string ($theValue);

    Switch ($theType) {}
    case 'text ':
    $theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue! = "")? intval ($TheValue): 'NULL ';
    break;
    case "double":
    $theValue = ($theValue! = "")? doubleVal ($TheValue): 'NULL ';
    break;
    case "date":
    $theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";
    break;
    case "set":
    $theValue = ($theValue! = "")? $theDefinedValue: $theNotDefinedValue;
    break;
    }
    Return $theValue;
    }
    }

    $editFormAction = $_SERVER ['PHP_SELF'];
    If (isset {}
    $editFormAction. = « ? ». htmlentities($_SERVER['QUERY_STRING']);
    }

    If ((isset($_POST["MM_insert"])) & & ($_POST ["MM_insert"] == "individual")) {}
    $insertSQL = sprintf ("INSERT INTO donations (postingTitle, 'size', condition, length, color, city, 'State', email, photo) VALUES (%s, %s %s, %s, %s, %s, %s, %s, %s)", ")
    GetSQLValueString ($_POST ["'validation title"], "text").
    GetSQLValueString ($_POST ['size'], "text").
    GetSQLValueString ($_POST ["State"], "text").
    GetSQLValueString ($_POST ['Length'], "text").
    GetSQLValueString ($_POST ['Color'], "text").
    GetSQLValueString ($_POST ['city'], "text").
    GetSQLValueString ($_POST ["State"], "text").
    GetSQLValueString ($_POST ['Email'], "text").
    GetSQLValueString ($_POST ['Photo'], "text"));

    @mysql_select_db ($database_bridesmaidsrack_db, $bridesmaidsrack_db);
    $Result1 = mysql_query ($insertSQL, $bridesmaidsrack_db) or die (mysql_error ());

    $insertGoTo = "donations.php";
    If (isset {}
    $insertGoTo. = (strpos ($insertGoTo, '?'))? « & » : « ? » ;
    $insertGoTo. = $_SERVER ['QUERY_STRING'];
    }
    header (sprintf ("location: %s", $insertGoTo));
    }

    CONNECTION TO THE BASE


    # FileName = "Connection_php_mysql.htm"
    # Type = 'MYSQL '.
    # HTTP = 'true '.
    $hostname_bridesmaidsrack_db = "localhost";
    $database_bridesmaidsrack_db = "bridesmaidsrack";
    $username_bridesmaidsrack_db = "";
    $password_bridesmaidsrack_db = "";
    $bridesmaidsrack_db = mysql_pconnect ($hostname_bridesmaidsrack_db, $username_bridesmaidsrack_db, $password_bridesmaidsrack_db) or trigger_error (mysql_error (), E_USER_ERROR);

    OK, so your initial problem was the condition of the word, because it is a reserved word for MySQL.

    Here is a list of the reserved words.

    http://dev.MySQL.com/doc/refman/5.1/en/reserved-words.html

    If you use a reserved word, you must place the accents around it like this...

    "condition."

    then MySQL knows you use it as a standard Word and he interprets not as command.

    OK now on the following problem.

    'Photo' column cannot be null

    When you have created your table in MySQL tells you that the photo field can not be empty. If you are forcing people to add a photo, then you need to do the checked field before the script runs / inserts. If you're ok with them NOT to add a photo, then you have to allow NULL values for this field in your table. This is a function that you would normally control via PHP MyAdmin or other MySQL database management software.

    Now, the last question:

    The Dynamic (form.action...) attribute is just how the FIELD itself will appear in SB (Server Behaivors) who is not the insertion of a plug.

    Record insertion as I said probably disappeared because some how you two when you shouldn't have one. So when we removed a DW (Dreamweaver) now think his party but is not. This can sometimes be corrected by opening the page again and closing or manually set or remove all SB side code, and then add the insertion of a plug anywhere. But at least you know what was the original problem so you can fix it after add it again.

  • Want to write the results to submit the login form to log on the server

    I cooked up a little family site to share memories and old photos. This is a members only site and I use a PHP login script that compares the user name and password to a list.

    I would like to know
    (a) if someone tries to guess their way in.
    (b) If a member is having connection problems... We have a few not so computer savvy family members which eventually get frustrated and give up.
    (c) whose members are logging... It is a new effort, to run one year on a trial basis... and it is worth.

    To do this, I add code to take the results of any shipment (on my login form) and to add the results of this to some sort of log file that I can periodically review. Because the foundations are in place this (I think) not an otherwise difficult task. But I have no idea on how to do this and hope someone can show me.

    Thank you for your time and help

    Ralph

    If it helps, it's the PHP code that I guess deals with the connection.

    / Repairable none by the user under this item. */

    $php_self = $_SERVER ['PHP_SELF'];

    / * Clean up variables: we only do $user and $password of the form. */
    $submit = $_POST ['submit'];
    $user = ";
    $password = ";
    If ($_GET ['user']) {}
    $user = $_GET ['user'];
    $password = $_GET ["password"];
    }
    If ($_POST ['user']) {}
    $user = $_POST ['user'];
    $password = $_POST ["password"];
    }

    session_start();

    / * Check the couple login/password until you find the one that is correct, or re-display the login form. */
    $loginsuccessful = FALSE;

    {foreach ($authorization as $loginpair)}
    {If (($user == $loginpair[0]) & & ($password == {$loginpair [1]}))}
    $_SESSION ['user'] = $user;
    $_SESSION ["password"] = $password;
    $loginsuccessful = TRUE;
    }
    {If (($_SESSION ['user'] == $loginpair[0]) & & ($_SESSION ['password'] == {$loginpair [1]}))}
    $loginsuccessful = TRUE;
    }
    }

    If ($loginsuccessful = TRUE) {}
    / * The user is connected, go on our merry way. */
    echo $loginmsg;
    } else {}
    / * User does not match our valid connection, their decline to the form. */
    $loginmsg = "invalid username or password";
    require ($indexphp);
    "exit";
    }

    No, it's not particularly difficult. Of course, you use a login script you obtained, because the code is very different from the one generated by Dreamweaver. Judging from the code, you do not use a database to store the usernames and passwords. Thus, you probably want to save the details of an external text file.

    Add the following code where indicated:

    if ($_POST['user']) {
        $user = $_POST['user'];
        $password = $_POST['password'];
    }
    
    // New code goes here
    
    $logfile = 'log.txt';
    $date = date('j M Y H:i:s');
    $address = 'Unknown';
    if (isset($_SERVER['REMOTE_ADDR'])) {
         $address = $_SERVER['REMOTE_ADDR'];
    }
    if ($file = fopen($logfile, 'a')) {
      fwrite($file, "\r\n$date $address $user $password");
      fclose($file);
    }
    
    // end of new code
    
    session_start();
    

    This will create a text file named log.txt in the same folder as the logon script. Since it is a text file, it should ideally be outside the root of the web server, then you must change the value of $logfile to point to a file outside of the root of the server, but in a folder where the script is allowed to write.

    Whenever someone tries to connect, it will record the date and time, IP address, if known, and the user name and password submitted.

    Once you got this job, I suggest you change the following line:

    if ($file = fopen($logfile, 'a')) {
    

    Change to this:

    if ($file = @fopen($logfile, 'a')) {
    

    This will remove any error message if the script is unable to open the log file. However, you should not do that change until you have things market, because deleting an error will prevent you to discover what the problem is if this does not work.

  • Recommend utility PHP/MySQL

    To save time, I am looking to buy application development software / tool box compatible with php / mysql.  One of the features I'm looking for is a upload of php via form upload script file. I know that the DMX box has separate program they sell.  Ideally I'd like a tool that does more than simply a function and not with a price high.

    If you could recommend some products, it would be appreciated.

    George

    When it comes to using a reasonable price "required no additional coding" software code generation PHP/MySQL, I ve always been very happy with PHPMAKER - but it is worth mentioning that there are many other tools out there as well who may meet your needs better than this so just one, google for "php code generator" to get a general idea about available today.

    See you soon,.

    Günter

  • How can I get the data in the foreign key?  PHP/mysql

    I managed to create registration, log-in and results pages appear for accounts of client with PHP/Mysql/Dreamweaver 8. I have another page for more information to be contained in a child table, I used the Insert Wizard to create. I can't make it work. I get either a foreign key cannot be null error or a foreign key constraint.

    If I include the foreign key in the form on the page, I can manually enter the appropriate identification number, and it works. How to automatically enter the id into the foreign key column?

    I got the authentication of users using e-mail, password and user type.

    Thanks for your help

    When someone connects, Dreamweaver creates a session variable called $_SESSION ['MM_Username"]. Use this session variable to create a recordset object to get the ID of the user, who can then be entered in the child table's foreign key field.

    Dreamweaver automatically updates the code for recordsets immediately above the DOCTYPE declaration, then you will need to move above the code for the server behavior insert record. So it must be in the following order:

    1. Recordset to get the user ID
    2. Insert the record to the child table
  • How can I activate the values hidden Login form in session variables?

    QUESTION: How can I get form elements hidden for primelang, studylang, country and nationality of the Login form Post table to become the session variables?

    Adobe page at http://kb2.adobe.com/cps/165/tn_16563.html gave me the info that didn't work because the code is old. The first question I asked was answered in useful, but partial and no values are appearing. All this is set out below, and I don't know if I can shorten and still make sense.

    Page 1 has a form of connection with six fields.

    The textfields in form are the user name and password.

    The hidden form fields are: nationality, country, studylang, primelang and their values will be set by incoming was a previous page URL or hard-coded in.

    I am trying to create four hidden fields session variables to avoid having to deploy recordsets on each subsequent page.

    After the "connect" button is pushed, I want that these four form fields hidden, nationality, country, studylang, and primelang and their values, proceed to the next page, as of Session Variables and then be available to all pages so I can use them in the links to other pages and in < img src="folderX/SessionVariableValue/book1.php. > Make sense?

    Each page of support seems to work:
    On the login page, the $MM_redirectLoginSuccess = "yadayada.php"; works very well.

    I used <? PHP if ($_POST) {print_r($_POST) ;}? > to check the post table and it works properly for all areas.

    I created links to the four Session Variables with the same words: primelang, studylang, country, nationality, and them deployed on the recipient page:

    <? PHP echo $_SESSION ['primelang'];? >

    <? PHP echo $_SESSION ['country'];? >

    <? PHP echo $_SESSION ['nationality'];? >

    <? PHP echo $_SESSION ['studylang'];? >

    QUESTION: How can I get the form to primelang items, studylang, country and nationality of the table to enter the head Post code on the recipient page? I have deployed it in the code of the head, but the gentleman who offered assistance previously not a not inform me how to get the hidden field values in the "what".

    <? PHP session_start();
    $_SESSION ['nationality'] = 'whatever ';
    $_SESSION ['studylang'] = 'whatever ';
    $_SESSION ['primelang'] = 'whatever ';
    $_SESSION ['country'] = 'whatever ';

    $nationality = $HTTP_POST_VARS ['nationality'];
    $studylang = $HTTP_POST_VARS ["studylang"];
    $primelang = $HTTP_POST_VARS ["primelang"];
    $country = $HTTP_POST_VARS ['country'];
    ? >

    What is the magic, missing link?

    I tried to use form Variables to pick up the values, but PHP doesn't, or I messed up.  I can't find a FULL explanation of how to create, move, retrieve and deploy the Session Variables anywhere on the web. Thank you for your help.

    What is the magic, missing link?

    You're going to start, but the magic missing link is the realization that "it doesn't matter" is a fictitious string that represents everything you want to assign to the session variable.

    
    

    $HTTP_POST_VARS and $HTTP_GET_VARS are obsolete. You must replace them by $_POST and $_GET respectively.

  • help with php mysql connect script

    OK guys im new to php mysql and I try inserting form information in my database. IM using a sitepoint script in which I went through the tutorial made some experiences of myself and it worked...

    but now I get this error that I can't understand...

    Command error: you have an error in your syntax SQL; consult the manual corresponding to your version of the server MySQL for the right syntax to use near 'order product SET = ' 1', 'average' = size, color is ", amount = '1' at line 1

    Here is the page
    http://vaughntucker.com/imagecon/hats.php

    and this is the script
    <? PHP
    default page view
    connect to the database
    $dbcnx = @mysql_connect ('p3nl41mysql7.secureserver .net', 'imagecon', ' Dub * boss_1');
    If (! $dbcnx) {}
    echo "< p > unable to connect to the '. 'database server at this time." < /p > ";
    Exit();

    }

    Select database
    If (! @mysql_select_db ('imagecon')) {}
    exit (' < p > cannot locate the ".")
    "database at this time. < /p >");
    }

    MySQL Query add joke
    If (isset($_POST['submit'])) {}
    $product = 1;
    $size = $_POST ["size"];
    $color = $_POST ['color'];
    $quan = $_POST ['quantity'];
    $sql = "INSERT INTO command TOGETHER
    product = "$product."
    size = "$size."
    Color = "$color"
    quantity = "$quan"
    Date = CURDATE () ';
    } else {}
    ECHO 'no data sent ";

    }
    If (@mysql_query ($sql)) {}
    echo "< p > your order has been sent. < /p > ";
    } else {}
    echo ' error < p > order process: '.
    mysql_error(). / '< p > ';
    }



    ? >

    Thanks in advance

    Murray * ACE * has written:
    > $sql = "INSERT INTO command TOGETHER."
    "> product ='". $product. "',
    "> size ='". $size. "',
    "> color ='". $color. "',
    ' > quantity = ' ". $quan. "',

    No, this is not what is causing the problem. It is the use of 'order' as
    the name of the table. The order is an SQL reserved word. Either the name of the table
    should be changed, or the query INSERT rewritten as follows:

    $size = mysql_real_escape_string($_POST['size']);
    $color = mysql_real_escape_string($_POST['color']);
    $quan = mysql_real_escape_string($_POST['quantity']);
    $sql = 'INSERT INTO 'order' SET
    product = 1,.
    size = "$size."
    Color = "$color"
    quantity = $quan,
    'date' = CURDATE () ';

    Note that I surrounded order and date with backticks. I also have
    $product, was deleted because it has a fixed value. I removed the quotes from
    around $quan, because the numbers should not be quoted in SQL queries.

    The changes I did assume that magic quotes are disabled the
    Server. If they are on, you must also pass the variables $_POST
    stripslashes() like this:

    $size = mysql_real_escape_string (stripslashes($_POST['size']));
    $color = mysql_real_escape_string (stripslashes($_POST['color']));
    $quan = mysql_real_escape_string (stripslashes($_POST['quantity']);

    --
    Adobe Community Expert David Powers
    Author, "The Essential Guide to Dreamweaver CS4",
    "PHP Solutions" & "PHP Object-Oriented Solutions.
    http://foundationphp.com/

Maybe you are looking for

  • I constantly get this pop-up, ' Exc in ev handl: TypeError: oSAPlg.oRoot.log is not a function. " What is the problem and how can I solve this problem?

    I received a lot of emails from trash and other deleted all my cookies and history. Now, I'm getting this pop-up and it is interfering with my use of the internet, ' Exc in ev handl: TypeError: oSAPlg.oRoot.log is not a function. " What is it and how

  • License key on bottom of laptop unreadable

    Hi, I wanted to reinstall my windows system, but I have the problem that I can not read the license key on the bottom of my laptop more. It dissipated by moving the laptop. Now is +/-1 year, and I did not notice it's going off that fast, otherwise I

  • Svchost.exe - application error... help

    I receive the following error message at startup, when I connect.  If I complete the program my computer going to be inadmissible. Svchost.exe - application error.  The exception of integer division by zero. (0 x 0000094) occurred in the application

  • get the URL of the browser

    Is it possible to get the URL of the browser? I have seen an application that gets it and check. I searched all the related browser api but unsuccessful.

  • CSM 4.2

    Hi Netpros, I am to evaluate the software eval of CSM 4.2 90 days. I installed and deployed on a VM environment and turns on a regular basis. I am facing a small question by discovering a few firewalls. Cisco ASA firewall are discovered and receive e