Jump to content

Alidad

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by Alidad

  1. Hi, I'm rookie guy and i'm continue learning php and mysql, i want to create something for myself to learn something for myself. Please check www.ask.com where you see image background with text field in forground, i'm trying to develop of how to change image of background from menu. let say that when load page is show background image of (currently.jpg) and i have four images names under menu for person to select, that list of menu are (first-image.jpg, second-image.jpg, 3rd-image.jpg and fourth-image.jpg). My question is how can i write code if person select second-image.jpg from the menu, and then automatic change image background just like ask.com! this part is i can't figuer out how to do that! please help thanks. AM
  2. Perhaps someone can help me with an example I've come up with to help me to better understand how to build a relationship in Mysql. I have database name “members” and two table name “registered” and “Screen” Registered table: First name Last name User name Password Screen table: Title Category Date Comments What they do is that when member log in from registered table, then input information then send data to the Screen table. Now I have two questions: 1) How would or SHOULD I go about creating the database relationship to show that the screen table is come from right user name! 2) How do I create insert statement into the Screen table that come from right user name! Please help thanks. AM
  3. thanks so much for your response but i'm not quit get it right, please see full code that i copied from my php page called config.php, what they do is that once person recieved email conformation and click the link it will transfer data from first database called "temp_members" to the second database called "registered_members". how can i write that code to getid new query if i want also to trasnfer copy of data from first databse to the 3rd and fourth called "member" and "member-2"! please help me thanks. AM <?php require_once('Connections/config.php'); ?> <?php $anEmail_rstExists = "0"; if (isset($_POST['email'])) { $anEmail_rstExists = (get_magic_quotes_gpc()) ? $_POST['email'] : addslashes($_POST['email']); } mysql_select_db($database_ourdeafworld, $ourdeafworld); $query_rstExists = sprintf("SELECT * FROM registered_members WHERE email = %s ", $anEmail_rstExists); $rstExists = mysql_query($query_rstExists, $ourdeafworld) or die(mysql_error()); $row_rstExists = mysql_fetch_assoc($rstExists); $totalRows_rstExists = mysql_num_rows($rstExists); if ($totalRows_rstExists > 0) { header("Location: exists.php") ; } ?> <? // // confirmation.php // // // Known Errors: // - This does not check to determine if the name has previously been placed in the permanent database. // // // Passkey that got from link $passkey=$_GET['passkey']; // Retrieve data from table where row that match this passkey mysql_select_db($database_ourdeafworld, $ourdeafworld); $sql1 = "SELECT * FROM temp_members_db WHERE confirm_code ='".$passkey."'" ; $results = mysql_query($sql1, $ourdeafworld) ; $rows = mysql_fetch_assoc($results); $count = mysql_num_rows($results) ; if($results === FALSE){ echo "That is an illegal Confirmation code. If you believe this is an error, please contact the <a href='".$WEBMASTER."'>Webmaster</a>"; } else { // if found a passkey in our database, // retrieve data from table "temp_members_db" if($count > 0){ $first_name = $rows['first_name'] ; $last_name = $rows['last_name'] ; $country = $rows['country'] ; $city = $rows['city'] ; $zip_code = $rows['zip_code'] ; $user_name = $rows['user_name'] ; $email = $rows['email'] ; $password = $rows['password'] ; $b_month = $rows['b_month'] ; $b_day = $rows['b_day'] ; $b_year = $rows['b_year'] ; $gender = $rows['gender'] ; $areyou = $rows['areyou'] ; // Insert data that retrieves from "temp_members_db" // into table "registered_members" $sql2 = "INSERT INTO registered_members (first_name, last_name, country, city, zip_code, user_name, email, password, b_month, b_day, b_year, gender, areyou) VALUES('".$first_name."', '".$last_name."', '".$country."', '".$city."', '".$zip_code."', '".$user_name."','".$email."', '".$password."', '".$b_month."','".$b_day."', '".$b_year."','".$gender."', '".$areyou."')"; $result2 = mysql_query($sql2, $thegame); // if successfully moved data from table"temp_members_db" to table "registered_members" //displays message "Your account has been activated" and don't forget to delete confirmation code // from table "temp_members_db" if($result2 === FALSE ){ echo "Internal error; Failed to activate. Please re-select your activation link." ; } else { echo "Your account has been activated"; // Delete information of this user from table "temp_members_db" // that has this passkey $sql3 = "DELETE FROM temp_members_db WHERE confirm_code = '".$passkey."'" ; $result3 = mysql_query($sql3); header("Location: login.php") ; } } else { echo "That is an illegal Confirmation code. If you believe this is an error, please contact the <a href='".$WEBMASTER."'>Webmaster</a>"; } } mysql_free_result($results); mysql_free_result($rstExists); ?>
  4. hi, does any one can me how i can write that code. Let say that person signed up and send data to the first database called "holding" database. When person recieved email conformation to verfiy to activity account, then it will transfer member information from first databse "holding" to the second database called activated. This part of code showing is transfering data from first called "holding" database to second database called "activated". $sql2 = "INSERT INTO activated (first_name, last_name, country, city, zip_code, user_name, email, password, b_month, b_day, b_year, gender, areyou) VALUES('".$first_name."', '".$last_name."', '".$country."', '".$city."', '".$zip_code."', '".$user_name."','".$email."', '".$password."', '".$b_month."','".$b_day."', '".$b_year."','".$gender."', '".$areyou."')"; $result2 = mysql_query($sql2, $ourdeafworld); My question is that how can i write code to transfer same data from first database to the "member" or fourth database called "member-2" at the same time when they transfer data to second database! please help thanks... AM
  5. hi, does anyone know how I can chaange title background color in php! currently in IE they set default to blue, is there is way that i can change title background color to other color! AM
  6. I tried everything i could and i still could not be able to solve it, i just don't see what did i missed after I tried everything with "$to" does anyone can test see what did i missed please. AM
  7. Hi, i really need help to solve this problme becuase i have spend one whole day to figure out how to solve that. please check Verifying email address sample tutorial from http://www.phpeasystep.com/phptu/24.html and i have tested from my server, the first step works great by send data to mysql along with conformation code number. After that is suppose to send email conforamtion from mysql, but it could not be abel to send email for some reason. I thought maybe i go head to change some code to see if that works, instead of put mail($to,$subject,$message,$header); i put mail('name@name.com',$subject,$message,$header); is works great when they get email conformation, but then, is not working when use "$to" which is mean email address of who to send to. Dose any idea hwo can i solve thsi problme! I really need help please thanks. AM
  8. I'm not sure if i undersand, can you please clearfiy for me please. AM
  9. hi, I'm trying to to solve problme with email conformation, they are two php files. The first file 'first.php' it come with registration forms and send data to mysql with conformatin number. after that it will send email conformation to the person who sign up for activation that file is "process.php" The first file to send data to mysql is works great. I use this code from dreamweaver, as you can see it sending data to mysql First.php <?php require_once('../Connections/emailtest.php'); ?> <?php $confirm_code=md5(uniqid(rand())); // values sent from form $name=$_POST['name']; $email=$_POST['email']; $password=$_POST['password']; $country=$_POST['country']; function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO temp_members_db (confirm_code, name, email, password, country) VALUES (%s, %s, %s, %s, %s)", GetSQLValueString("$confirm_code", "text"), GetSQLValueString("$name", "text"), GetSQLValueString("$email", "text"), GetSQLValueString("$password", "text"), GetSQLValueString("$country", "text")); mysql_select_db($database_emailtest, $emailtest); $Result1 = mysql_query($insertSQL, $emailtest) or die(mysql_error()); $insertGoTo = "process.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } ?> and then in process.php showing .... please see part where it said "$mail->AddAddress($_POST['email']; <?php require("PHPMailer/class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->Host = "smtp.comcast.net"; // SMTP server $mail->From = "root@root.com"; $mail->AddAddress($_POST['email']; $mail->Subject = "your conformation"; $mail->Body="Your Comfirmation link \r\n"; $mail->Body="Click on this link to activate your account \r\n"; $mail->Body="http://localhost/ourdeafworld/EmailTest/confirmation.php?passkey=$confirm_code"; $mail->WordWrap = 50; if(!$mail->Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent.'; } ?> but is not sending email to the person who sign up for conformation. what did i missed in part of "$_POST['email'];" please help me thanks. AM
  10. yes i have solved this probme thanks guys. AM
  11. thank you for your help i have fixed that by puting GetSQLValueString('$confirm_code', "text"), instead of GetSQLValueString($_POST['confirm_code'], "text"), but when i tested that and i checked in mysql database is showing word "$confirm_code" instead of confirm code number. What did i missed! AM
  12. yes i can wait to read your article that would help me to understand. at the mean time maybe you can help me with one line code that got into error. please code <?php require_once('../Connections/emailtest.php'); ?> <?php $confirm_code=md5(uniqid(rand())); function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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 "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO temp_members_db (confirm_code, name, email, password, country) VALUES (%s, %s, %s, %s, %s)", GetSQLValueString($_POST['confirm_code'], "text"), GetSQLValueString($_POST['name'], "text"), GetSQLValueString($_POST['email'], "text"), GetSQLValueString($_POST['password'], "text"), GetSQLValueString($_POST['country'], "text")); mysql_select_db($database_emailtest, $emailtest); $Result1 = mysql_query($insertSQL, $emailtest) or die(mysql_error()); $insertGoTo = "../IsNotWorking.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } ?> I'm having trouble to insert confirm_code into the databse, as you can see on the top of code where it said $confirm_code=md5(uniqid(rand())) that suppose to be insert the code number but i could not figure out why is not working! Any idea that you can help me! AM
  13. Hi, does anyone know where i can learn how to write code in php for someone registration and send confirmation by email to activity member by click link! i would appreication if you have sample code where i can learn how to write that code in php and mysql please or if there is tutorial link for that... AM
  14. hi, i like to develop social network in php, does anyone know where do i can learn of how to develop social network in php and mysql database! is tehre is sample code where i can learn read about the social network! AM
  15. I have project relate to directory, let say that i have few catagories, and sub-catagories. let say that in database have seven catagoreis relate to California in database, my question is that how do i can write query in mysql to show total count of California! for sample "California(7)", (7) mean total sum count in database for california, how do i can write that query in mysql! please help thanks. Alidad Modjtabai Alidad@comcast.net
  16. sorry for not clear, let say that if you have html editor for php, and you want to have lay out features, but the way to have that is to click button then it will automatic create lay out <div></div> before continue to work on lay out after created layout by click button. how to write that code to allow person click button to create layout! i hope is clear what I'm trying to say! AM
  17. Hi, I need help with button, when person click button, is automatic create lay out <div></div> in php, how do i write that in php code to create layout button like that<div></did>! please help me thanks. AM
  18. hi, this one of my problme that i can't figure out, I need help please. I finished with online php editor, and i'm almost finish with drag drop too. my question is that if i have <div> </div> inside of layer of <div> has picture, and want to drag to the somewhere on the online editor, how can i click button to automatic save that the way they look and save into php or html from online editor! what code to use to automatic save as .html or php from inside of online editor! AM
  19. I almost done with online html editor, how is possible for me to write code to allow person insert <div> tag into the html editor by click one button! I know this should be easy to write but i just can't come up with my own. please help. thanks. AM
  20. Thank you reply but what I'm looking for add html editor on my own website. is there is way wher i can find it or provide code!
  21. Hi, while I'm working on my own php online html editor (not from window desktop) I was wondering if there is way that allow us to create frame inside of editor! So our customer be able to move around with frame in editor! If you know anything about it or if there is other website where I can learn more about the html editor using php with frame! please help me thanks. AM
  22. Hi, i'm trying to solve problme with check user name sign up to make sure that user name is not taken. what i want is to have popup message in javascripts to say "the user name is taken, please use other user name". What I wrote is wrote a function for popup message in javascript which please see code: <SCRIPT LANGUAGE="JavaScript"> function UserNameCheck() window.alret ('user name is taken, please selet other user name'); </script> And then I wrote php script to check database to see if that user name are avaliable or not. please see that script <?php mysql_connect("localhost", "username", "password"); mysql_select_db("DatabaseName"); function check_user_exist($username) { $username = mysql_real_escape_string($username); $query = mysql_query("SELECT * FROM member WHERE username = '{$username}'") or die(mysql_error()); $rows = mysql_num_rows($query); if($rows > 0) { return true; } else { return false; } } if(check_user_exist($_POST["userName"])) { UserNameCheck(); } } ?> <head> <title>check user name</title> </head> <body> <form id="form1" name="form1" method="post" action=""> User Name: <label> <input type="text" name="userName" id="userName" /> </label> <label> <input type="submit" name="button" id="button" value="Submit" /> </label> </form> </body> </html> but i'm getting error message said that i'm missing one "}" in (RED) Area. i'm not sure what it is, I really need your help please how can i solve this. AM
  23. To chigley; hi again , I'm sorry i'm lost again, i made some change by put some text see the code: } if(check_user_exist($_POST["userName"])) { die("A user already exists with that username"); } else { echo ("<h1> <bold> Thank you </bold></hl>"); } ?> But I'm getting same error message in browser said "A user already exists with that username".... I would appreication your help can you explain what did i missed, i'm still rookie guy and learning php on my own but this part is confusing me. AM
  24. thank you for your help these mysql database site helped me lots, but I apologize this time, this must be confusing me, I have tried everything I could to solve problme but I couldn't find to solve problme. what happend is that I recently add form with text field called usernamebut then I'm getting error message said A user already exists with that username with out any input in text filed. what went wrong! <?php mysql_connect("localhost", "username", "password"); mysql_select_db("MemberDatabase"); function check_user_exist($username) { $username = mysql_real_escape_string($username); $query = mysql_query("SELECT * FROM member WHERE username = '{$username}'") or die(mysql_error()); $rows = mysql_num_rows($query); if($rows > 0) { return false; } else { return true; } } if(check_user_exist($_POST["username"])) { die("A user already exists with that username"); } else { echo "thank you " } ?> <head> <title>check user name</title> </head> <body> <form id="form1" name="form1" method="post" action=""> User Name: <label> <input type="text" name="userName" id="userName" /> </label> <label> <input type="submit" name="button" id="button" value="Submit" /> </label> </form> </body> </html>
  25. Thank you for your advaice to remove that user name and password, gees how stupid I am. And also thank you for your sample code, but I'm getting error message in browser said "no database select" please correct if this is right statment in (RED) text. <?php mysql_connect("localhost", "username", "password" "DatabaseName"); mysql_select_db("member"); function check_user_exist($username) { $username = mysql_real_escape_string($username); $query = mysql_query("SELECT * FROM userstable WHERE username = '{$username}'") or die(mysql_error()); $rows = mysql_num_rows($query); if($rows > 0) { return false; } else { return true; } } if(check_user_exist($_POST["username"])) { die("A user already exists with that username"); } else { // Go ahead with the form processing } ?>
×
×
  • 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.