Jump to content

ignace

Moderators
  • Posts

    6,457
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by ignace

  1. hearing of it is not enough, its using it that defines you... look, i'm not trying to insult you or anything, but "where can you learn mysqli?" on php.net or read a book, want help with something involving mysqli (a function not working, strange error's, etc...), that's what we are here for, we're not gonna play your teacher.. @scheols if you know mysql, you will be easily picking up with mysqli, because the changes aren't that big... you still connect with your database through mysqli_connect(); the only difference is that mysql_select_db() is left out and an i has been added to the connect function! You also have the ability to directly put your database name in your connect function here a direct link to it: http://php.belnet.be/manual/nl/function.mysqli-connect.php i will post a tutorial/manual later on to explain its use
  2. we didn't get the name of best php forum, not for nothing... ofcourse i'm not the one getting any credit for this, this goes to the guys that started phpfreaks.com
  3. change [code]echo "<table width="180" border="1" cellspacing="2" cellpadding="0">";[/code] to [code]echo "<table width='180' border='1' cellspacing='2' cellpadding='0'>";[/code] when you open something with ", then make sure whenever you again need something between quotes, then use ' because when you use " again, it means your closing it.. so this [code]echo "<table width="180" border="1" cellspacing="2" cellpadding="0">";[/code] would only work if you would do this [code]echo "<table width=" . 180 . " border=" . 1 . " cellspacing=" . 2 . " cellpadding=" . 0 . ">";[/code] the . means your attaching it.
  4. yeah is some sort of an extension... mysqli (MySQL Improved) never used it though, maybe some day...
  5. One: how did you manage to fill in the register form of this website? Two: who allowed you? Three: ever heard of google? Four: manuals ever heard of? Five: here is your damn tutorial/manual http://devzone.zend.com/node/view/id/686 It is always nice to see, people doing some effort to get something...
  6. the ereg family can do this trick for you, but parsing html, into objects is quite hard, especially with all the attributes and everything, if you have php 5, xml should be supported try looking into that code, maybe copy, past some of it, to get the function you are planning to use
  7. yeah, the only problem is my native language is dutch, so i can not use the bitwise or, and it would look silly, when your suddenly start talking english ;D
  8. @Barand echo "7 &amp; 3 = $var1"; // Gives 3 right?
  9. what does your Path() function do? And what does it do with your $row['id']? P.S.: remove the $allpaths from you array_multisort();
  10. OR is the same as ||, AND is the same as &&, bitwise or (|) bitwise and (&) P.S.: can someone tell me what the & does when used in one of the following ways: $Var &= $Var2; // object or something? function myfunction(&$var); // Here, i believe you need to provide an already declared variable if you know also otherways the & can be used, please let me know..
  11. mail returns a boolean value, use if/else to check its status. Also set your error reporting to error_reporting(E_ALL); <-- this has saved me already a lot of time/problems [code] if (mail(..)) { // mail success } else { // mail problem... } [/code]
  12. ignace

    PHP Form

    may i ask what the following does? [code] <!--Work Order # <?php $_POST["Work"];?> was opened on <?php $_POST["Sched"];?> by <?php $_POST["Tech"];?>.<br><br> The Unit is located in<?php $_POST["Site"]?> with serial number <?php $_POST["Serial"]?> and this unit has <?php $_POST["Hours"]?> Hours on it. The Reported level of Severity is<?php $_POST["Severe"];?>and the Safety Level is<?php $_POST["Safe"];?>. <BR> Additional Details on this equipment failure are as follows:<BR><BR> <B>Description of Issue:</B><BR> <?php $_POST["Issue"]?><BR><BR> <B>Possible Resolution</B><BR> <?php $_POST["Resolve"]?><BR><BR> <B>Request for Assistance:</B><BR> <?php $_POST["Assist"]?><BR><BR> Parts Required: (that the technician is currently aware of) <?php $_POST["PartsA"]?><BR> <?php $_POST["PartsB"]?><BR> <?php $_POST["PartsC"]?><BR> <?php $_POST["PartsD"]?><BR> <?php $_POST["PartsE"]?><BR> <?php $_POST["PartsF"]?><BR> <?php $_POST["PartsG"]?><BR>  --> [/code] if it is your intention that it is being outputted, then i think your missing a few echo's/print's. also from $_POST['issue'] to $_POST['PartsG'] a few ; are also missing, set your error_reporting to error_reporting(E_ALL); also looking at the following, tells me you are someone that really likes typing... [code] $Work = $_POST["Work"]; $Sched = $_POST["Sched"]; $Name = $_POST["Tech"]; $Site = $_POST["Site"]; $Serial = $_POST["Serial"]; $Hours = $_POST["Hours"]; $Starts = $_POST["Starts"]; $Issue = $_POST["Issue"]; $Severity = $_POST["Severe"]; $Resolution = $_POST["Resolve"]; $Assistance = $_POST["Assist"]; $PartsA = $_POST["PartsA"]; $PartsB = $_POST["PartsB"]; $PartsC = $_POST["PartsC"]; $PartsD = $_POST["PartsD"]; $PartsE = $_POST["PartsE"]; $PartsF = $_POST["PartsF"]; $PartsG = $_POST["PartsG"]; $Safety = $_POST["Safe"]; [/code] to safe you some time, try the following next time: [code] while (false !== (list($k, $v) = each($_POST))) {    ${$k} = $v; } [/code]
  13. It won't harm i guess, however i won't go as deep as you do $_SESSION['user_information']['info']['email'].. rather i would stick to something like this $_SESSION['user_information']['user_email'] however i only use sessions to store information, but i never get the information directly from it, only when a parent file is being executed the complete session is being loaded into my session object, so whenever i need something from my session i get it from my object in the order of: $Context->Session->GetVariable('user_email'); and because of my context object also controls my database, can i even check if the retrieved data is correct, if required.
  14. [quote author=tomfmason link=topic=102837.msg409000#msg409000 date=1154623958] it was more then that. I have the script working now. From now on I am going to test everthing that I post(prior to posting) *EDIT by ignace on august 06 2006 11:58:15* [b]The join.php[/b] [code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Join Us</title> </head> <body> <?php if (($message == "info") || ($message == "email_check") || ($message == "username_check")) {     if ($message == "info") {         echo "You did not submit the following information.<br />";     if ($error == "username") {         echo "Username is a required field.<br />";     }     if ($error == "first_name") {         echo "First Name is a required field.<br />";     }     if ($error == "last_name") {         echo "Last name is a required field.<br />";     }     if ($error == "email_address") {         echo "Your email address is a required field.<br />";     }     }     if ($message == "email_match") {     echo "You are already a member.<br />"; } if ($message == "username_match") {     echo "Your username is already being used by another member. Please try again.<br />";     } } ?> <form method="post" action="register.php">   <table width="100%" border="0" cellpadding="4" cellspacing="0">     <tr>       <td width="24%" align="left" valign="top">Fornavn</td>       <td width="76%"><input name="first_name" type="text" id="first_name2"></td>     </tr>     <tr>       <td align="left" valign="top">Efternavne</td>       <td><input name="last_name" type="text" id="last_name"></td>     </tr>     <tr>       <td align="left" valign="top">Email</td>       <td><input name="email_address" type="text" id="email_address"></td>     </tr>     <tr>       <td align="left" valign="top">Brugernavn</td>       <td><input name="username" type="text" id="username"></td>     </tr>       <td align="left" valign="top"> </td>       <td><input type="submit" name="Submit" value="opret bruger!"></td>     </tr>   </table> </form>  </body> </html> [/code] [b] The register.php[/b] [code]<?php include_once("db.php");//your database connection file array_pop($_POST); if (get_magic_quotes_gpc()) {     $_POST= array_map('stripslashes', $_POST); } $username = mysql_real_escape_string(trim($_POST['username']));// In my experience mysql_real_escape_string always returned error's $first_name = mysql_real_escape_string(trim($_POST['first_name'])); $last_name = mysql_real_escape_string(trim($_POST['last_name'])); $email = mysql_real_escape_string(trim($_POST['email_address']));     if ((!$username) || (!$first_name) || (!$last_name) || (!$email_address)) {     $message = "info"; if (!$username) {     $error = "username"; } if (!$first_name) {     $error = "first_name"; } if (!$last_name) {     $error = "last_name"; } if (!$email_address) {     $error = "email_address"; } include("join.php"); exit(1);// Proper manor of exiting } $user_sql = "SELECT COUNT(*) AS `user_match` FROM `users` WHERE `username`='$username'"; $email_sql = "SELECT COUNT(*) AS `email_match` FROM `users` WHERE `email_address`='$email'"; $res= mysql_query($user_sql) or die(mysql_error()); $result= mysql_query($email_sql) or die(mysql_error()); $user_match= mysql_result($res, 0, 'user_match'); $email_match= mysql_result($result, 0, 'email_match'); if (($user_match > 0) || ($email_match > 0)) {     if ($username > 0 ) {     $message = "username_match"; unset($username); } if ($email_match > 0) {     $message = "email_match"; unset($email); } include("join.php"); exit(1); } function makepassword() {   $salt = "abchefghjkmnpqrstuvwxyz0123456789";   srand((double)microtime()*1000000);        $i = 0;       while ($i <= 7) {             $num = rand() % 33;             $tmp = substr($salt, $num, 1);             $pass = $pass . $tmp;             $i++;       }       return $pass; } $randompwd =  makepassword(); $mdpwd = md5($randompwd); $sql = mysql_query("INSERT INTO `users` (`first_name`, `last_name`, `email_address`, `username`, `password`, `signup_date`)         VALUES('$first_name', '$last_name', '$email_address', '$username', '$mdpwd', NOW())") or die (mysql_error()); if(!$sql){     echo 'Det er kommet en fejl. Kontakt webmasteren'; } else {     $userid = mysql_insert_id();     // Let's mail the user!     $subject = "Your Distributor Membership at www.my-project.dk";     $message = "Dear $first_name $last_name,     You are now registered at our website, http://www.my-project.dk!         To activate your membership, please login here: http://www.mywebsite.com/distributors_section/login_form.html         Once you activate your membership, you will be able to login with the following information:     Username: $username     Password: $random_password     Please keep this username and password in a location that is easily accessible by you.         Thanks!     #Fruddy my-project.dk         This is an automated response, please do not reply!";         if (mail($email_address, $subject, $message, "From: MyWebSite<email@mywebsite.com>\nX-Mailer: PHP/" . phpversion())) { //echo "$randompwd";         echo "You are now successfully registered at our website, an additional e-mail has been dispatched to your e-mail address, you should receive this e-mail within the next 24 hours. Thank you!";     } else {         // Mailing failed.     } } ?>[/code] [b]The Login.php[/b] [code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Login Form</title> </head> <body> <?php if (($message == "login_info") || ($message == "userinfo")) {     if ($message == "login_info") {     echo "You did not enter your username or password. Please try again.<br />"; } if ($message == "userinfo") {     echo "Your username and password do not match. Please try again.<br />"; } } ?> <form action="checkuser.php" method="post" name="form1">   <div align="justify">     <table width="50%" border="0" align="center" cellpadding="4" cellspacing="0">       <tr>         <td width="20%">Brugernavn</td>         <td width="80%"><input name="username" type="text" id="username"></td>       </tr>       <tr>         <td>Kodeord</td>         <td><input name="password" type="password" id="password"></td>       </tr>       <tr>         <td> </td>         <td><input type="submit" name="Submit" value="Submit"></td>       </td>     </table>   </div> </form>  </body> </html> [/code] [b]The checkuser.php[/b] [code]<?php session_start(); include ('db.php'); array_pop($_POST); if (get_magic_quotes_gpc()) {     $_POST= array_map('stripslashes', $_POST); } $username= mysql_real_escape_string(trim($_POST['username'])); $password= mysql_real_escape_string(trim($_POST['password'])); $mdpwd= md5($password); if ((!$username) || (!$password)) {     $message = "login_info";     include("login.php"); exit(1); } $sql= sprintf("SELECT COUNT(*) AS `login_match` FROM `users` WHERE `username`='%s' AND `password`='%s'", $username, $mdpwd); $res= mysql_query($sql) or die(mysql_error()); $login_match= mysql_result($res, 0, 'login_match'); if ( $login_match == 1 ) {     $_SESSION['username']= "$username";     include("somepage.php"); } else {     $message = "userinfo"; include("login.php"); exit(1); } ?>[/code] [/quote]
  15. tomfmason, why do you use array_pop? And actually if he copied what you last posted he will be gettin' a few error's, you forgot your a few dollar signs for your variables :p
  16. thank you, another great site, to put in my php website collection.. (in other words I'm putting it in my favorites)
  17. Meaning I should not use the above mentioned function? Now then on to the next question how do I add salt? (Just get it in the kitchen?, probably not..) or do you mean, something like md5($word) . md5(uniqid(rand(), true));
  18. Thank you everyone for listening to a word of our "proud" members, and now back to you dana, what do you have on-topic?
  19. Md5 is decryptable, sha-1 is decryptable, I am really worrying now about how safe my data is? And because I'm not an expert of any kind, am I asking you guys how safe the following function really is? I called it md6 because it is based upon the md5 encryption. [code] function md6($Input, $Extract) {    $sReturn = md5($Input);    return substr($sReturn, 0, strlen($sReturn) - $Extract); } [/code] Ofcourse $Extract will need to remain the same all the time, so whenever a user logs in or register's a certain number of characters is being extracted from the total length of the encrypted (pass)word. And md5 is now only used as an "commission agent". I think this make the encrypted data more secure because a number of characters is missing, making it somehow impossible to correctly decrypt it.. (I never say never ofcourse) P.S.: My native language is dutch, and when I translated the word is was looking for by altavista I got commision agent.. wrong choice of words, I know, but I found it quiet amusing and even funny..
  20. And to save you a lot of wasting time while typing I suggest you use: [code] // This comes on top of your script or wherever you want your $productid, and everything to start extract($_REQUEST); // Now will this still work echo '<b>Product ID: </b>' . $productid . '<br />'; echo '<b>AlphaName: </b>' . $alphaname. '<br />'; echo '<b>AlphaType: </b>' . $alphatype. '<br />'; echo '<b>Subcat: </b>' . $subcat. '<br />'; echo '<b>Manuf: </b>' . $manufacturer. '<br />'; echo '<b>Size: </b>' . $size. '<br />'; echo '<b>Colour: </b>' . $colour. '<br />'; echo '<b>Pattern: </b>' . $pattern. '<br />'; echo '<b>Fast: </b>' . $fastening. '<br />'; echo '<b>Desc: </b>' . $description1. '<br />'; echo '<b>Desc: </b>' . $description2. '<br />'; echo '<b>Desc: </b>' . $description3. '<br />'; echo '<b>Sml Image: </b>' . $smlimage. '<br />'; echo '<b>Lge Image: </b>' . $lgeimage. '<br />'; echo '<b>Add Basket Text: </b>' . $addbasket. '<br />'; echo '<b>Price: </b>' . $price. '<br />'; echo '<b>Display: </b>' . $display. '<br /><br /><br />'; // What others did not notice is that your query is also wrong. $insertdata = "`productid`, `alphatype`, etc..."; $query = "INSERT INTO stocks ( %s ) VALUES ( %s )"; // if you are inserting respectively with the columns, you can also use $query = "INSERT INTO stocks VALUES ( %s )"; // ofcourse this way you don't need $insertdata // Also this is alot of sql code to parse, so check first what is set and what is not! $value = ''; foreach ($_REQUEST as $k => $v) {   if ($v) {       $value .= "'" . $v . "',";   } } // Then to make sure that we don't have a , as last character in our values variable if (substr($value, -1) == ',') {   $value = substr($value, 0, strlen($value)-1); } $Sql = sprintf($query, $insertdata, $value); // For your DB and everything, you should use something lik if (!($Resource = mysql_connect($Host, $User, $Pass))) {    die('could not connecto to datbase'); } if (!mysql_select_db($Database)) {    die('selecting database failed.'); } // Then parsing your query if (!mysql_query($Sql, $Resource)) {    echo "query failed"; } else {    echo 'jipii'; } [/code]
  21. ignace

    *fixed*

    I am not using the GD library, so my help is limited, sorry, but I think the error code is quite clear, and that it ran before, sure, but that also had the @-sign in front of it, not? However "./worldmap.png" bothers me, try changing it to just "worldmap.png" and see what comes up! I had this problem once with defined(); however the problem lay in one of my classes, what the actual cause was of the problem I can't remember! I don't even remember if it now was the class that was the problem or the class that solved it...
  22. I wouldn't could have said it better myself...
  23. ignace

    *fixed*

    imagepng(); returns a boolean value, check what you get whenever you put it in an if/else statement [code=php:0] $mapid = "map".$numb.".png"; if (imagepng($im, $mapid)) {   // should have been written to file. } else {   // not working } [/code] if this is not working, then please post the full code, so we can have an in-depth view.
  24. I am a very poor programmer, that even $50 bucks is way beyond my salary, anything cheap like free?
  25. A few days ago, I was on this website that showed me my ISP, ofcourse as curious as I am, I went directly to php.net where I found gethostbyaddr(); providing me something but not what I wanted, so if someone knows how I can accomplish this, then please feel free to enlight me!
×
×
  • 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.