PHP - Epic Math Fail?
I can not seem to figure out how to do this..
I just need to add 100+99+98+97+96...+1 no you can not do 100! because that multiples them =] Similar TutorialsRules: 1) It has to be legit and actually work and have a useful function in society/web world. 2) The code cannot be minimized into one line. It has to have line breaks. (Not necessarily for each new function or short hand property, but so it's partly readable) 3) It has to be written in PHP or Javascript. For example, (Not my original code) but I'll start: A time_ago function: function timeago($tm,$rcs = 0) { $cur_tm = time(); $dif = $cur_tm-$tm; $pds = array('second','minute','hour','day','week','month','year','decade'); $lngh = array(1,60,3600,86400,604800,2630880,31570560,315705600); for($v = sizeof($lngh)-1; ($v >= 0)&&(($no = $dif/$lngh[$v])<=1); $v--); if($v < 0) $v = 0; $_tm = $cur_tm-($dif%$lngh[$v]); $no = floor($no); if($no <> 1) $pds[$v] .='s'; $x = sprintf("%d %s ",$no,$pds[$v]); if(($rcs == 1)&&($v >= 1)&&(($cur_tm-$_tm) > 0)) $x .= time_ago($_tm); return $x; }Your turn! Edited by Monkuar, 24 January 2015 - 05:06 PM. Hello Php Freaks I am following this tutorial how to make a login for my website, the only trouble is that... It dosen't seem to work, so i wanna know if its only me who cant make it work... and if it is why XD... Tutorial can be found he http://www.knowledgesutra.com/forums/topic/7887-php-simple-login-tutorial/ Now when i get started it starts saying error at line 6: if ($_GET["op"] == "login") It says that when im about to login right above the login. Now when i put in data i get error on line 19: $r = mysql_query($q); That one, and i have no idea how to fix it. Anyone please ? Had a crack at making my own generator which makes some jumble 32 characters long with letters and numbers. In logic it seemed fine to me. It practice it just does nothing. function generate(){ $abc = array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"); $num = array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9"); $result = ""; for ($i = 0; $i < 32; $i++){ $bool = rand(0,1); if ($bool = 1) { $result . $abc[rand(0,25)]; } else { $result . $num[rand(0,9)]; } } echo $result; } hello agen i got problem using login php in database i have stored passwords as *4D5FC004C2D5AE0B5513693AD1B271F8A2A92CEC (i think its hash inserted as password) case is that it dont read password :/ kinda strange, any help will be welcome Code: [Select] <? session_start(); if(isset($_GET['reg'])){ $reg=$_GET['reg']; }else{ $reg=""; } if($reg==1){ $msg1="<font color=\"#FF0000\"><b>Your details have been added, please login</b></font>"; }elseif($reg==2){ $msg1="<font color=\"#FF0000\"><b>You have been successfully logged out.</b></font>"; } if(isset($_POST['submit'])){ if( empty($_POST['uname']) && (empty($_POST['upass']))){ header( "Location:Messages.php?msg=1" ); exit(); } //transfer to shorter var $n=$_POST['uname']; $p=$_POST['upass']; //connect to db include('config.php'); $query="select * from user where uname='$n' and pw='$p' "; $result=mysql_query($query); $num=mysql_num_rows($result); if($num>0 ){ //put in session vars $mytime=time(); $mytime=date("H:i:s A",$mytime); $_SESSION['time'] = $mytime; $_SESSION['status'] = 'logged'; $_SESSION['username'] = $n; //goto next page header("location:welcome.php"); exit; }else{ $_SESSION['status'] = 'not logged'; header( "Location:Messages.php?msg=2" ); exit(); } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><!-- InstanceBegin template="/Templates/Auth.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <!-- InstanceBeginEditable name="doctitle" --> <title>Login</title> <!-- InstanceEndEditable --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> <link href="styleLog.css" rel="stylesheet" type="text/css"> </head> <body> <table width="100%" border="0" cellspacing="7" cellpadding="0"> <tr class="temptitle"> <td><!-- InstanceBeginEditable name="EditRegion4" -->Login<!-- InstanceEndEditable --></td> </tr> <tr> <td><!-- InstanceBeginEditable name="EditRegion3" --> <form name="form1" method="post" action="login.php"> <table width="81%" border="0" align="center" cellpadding="0" cellspacing="3"> <tr class="listtop"> <td colspan="3">Login Status:<? if(isset($msg1)){ echo "$msg1"; }?></td> </tr> <tr> <td width="9%">Username</td> <td width="41%"><input name="uname" type="text" id="uname" size="50"></td> </tr> <tr> <td>Password</td> <td><input name="upass" type="password" id="upass" size="50"></td> </tr> <tr> <td colspan="2"><div align="center"><a href="password.php">Forgotten your password?</a>|<a href="register.php">Register</a> </div></td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" value="Login"></td> </tr> </table> </form> <!-- InstanceEndEditable --></td> </tr> <tr> <td><div align="center">Copyright 2005 </div></td> </tr> </table> </body> <!-- InstanceEnd --></html> Hi community. The radio buttons on my form suddenly stopped working. For the life of me I can’t figure out why. Everything seems to look fine. I did some moving around on servers so I wonder if something got messed up during the transfer. I’m wondering if a new version of PHP was installed and made something obsolete. I was wondering if someone could take a look. Thank you in advance for your advise.
<form action="brian_1.php" method="post" name="form1" id="form1"> <input name="name" type="text" id="name" size="30" tabindex="1"/> Company if Applicable: <input name="company" type="text" id="company" size="30" tabindex="2"/> Phone: <input name="phone" type="text" id="phone" tabindex="3" onkeypress="return formatPhone(event,this)" onkeydown="return getKey(event,this)" size="13" maxlength="12"/> Example: XXXXXXXXXX Alternate Phone: <input name="altphone" type="text" id="altphone" tabindex="4" onkeypress="return formatPhone(event,this)" onkeydown="return getKey(event,this)" size="13" maxlength="13"/> Example: XXXXXXXXXX Street Address:<input name="mail" type="text" id="mail" size="60" tabindex="5"/> City, State, Zip Code: <input name="city" type="text" id="city" size="60" tabindex="5"/> E-mail: <input name="emai" type="text" id="emai" size="60" tabindex="6"/> Would you like to be part of our mailing list? <label><input type="radio" name="list" value="Yes" id="RadioGroup1_0" tabindex="7"/>Yes</label><label><input type="radio" name="list" value="No" id="RadioGroup1_1" tabindex="8"/>No</label> Are you interested in volunteering for upcoming events? <label><input type="radio" name="volunteer" value="Yes" id="RadioGroup2_0" tabindex="9"/>Yes</label><label><input type="radio" name="volunteer" value="No" id="RadioGroup2_1" tabindex="10"/>No</label> Are you interested in becoming a sponsor by receiving opportunities to advertise through us? <label><input type="radio" name="opportunities" value="Yes" id="RadioGroup3_0" tabindex="11"/>Yes</label><label><input type="radio" name="opportunities" value="No" id="RadioGroup3_1" tabindex="12"/>No</label> Would you like to join our efforts by offering your services or products to further our cause? <label><input type="radio" name="cause" value="Yes" id="RadioGroup4_0" tabindex="15"/>Yes</label><label><input type="radio" name="cause" value="No" id="RadioGroup4_1" tabindex="16"/>No</label> If so, in what ways would you like to contribute? <textarea name="contribute" cols="60" rows="4"></textarea> <input type="submit" name="Submit" value="Sumbit" /><input type="reset" name="reset" id="reset" value="Clear" /> </form> <?php /* Email Variables */ $emailSubject = 'Contact Form'; $webMaster = 'brianewagnerfund@gmail.com'; $webMaster = 'matt@webskillsplus.com'; //$webMaster = 'murrterr@rcn.com'; /* Data Variables */ $name = $_POST['name']; $company = $_POST['company']; $phone = $_POST['phone']; $altphone = $_POST['altphone']; $mail = $_POST['mail']; $city = $_POST['city']; $emai = $_POST['emai']; if (isset($_POST["submit"])) { echo $_POST["list"]; } if (isset($_POST["submit"])) { echo $_POST["volunteer"]; } if (isset($_POST["submit"])) { echo $_POST["opportunities"]; } if (isset($_POST["submit"])) { echo $_POST["cause"]; } $contribute = $_POST['contribute']; $body = <<<EOD \r\n \r\n <br> Name(s): $name \r\n <br> Company if Applicable: $company \r\n <br> Phone: $phone \r\n <br> Alternate Phone: $altphone \r\n <br> Street Address: $mail \r\n <br> City, State, Zip Code: $city \r\n <br> Email: $emai \r\n <br> Would you like to be part of our mailing list? $list \r\n <br> Are you interested in volunteering for upcoming events? $volunteer \r\n <br> Are you interested in becoming a sponsor by receiving opportunities to advertise through us? $opportunities \r\n <br> Would you like to join our efforts by offering your services or products to further our cause? $cause \r\n <br> If so, in what ways would you like to contribute? $contribute \r\n <br> EOD; $from = "From: BrianEWagnerFund@gmail.com\r\n"; $from .= "Reply-To: ".$emai."\r\n"; $from .= "Content-type: text/html\r\n"; mail($webMaster, $emailSubject, $body, $from); /* Results rendered as HTML */ echo "<meta http-equiv=\"refresh\" content=\"0;URL=http://www.brianewagnerfund.org/thankyou.html\">"; ?> Hello, I am trying to send a query and receive data from it, the query is sent successfully and gets the neccessary data, the problem is that store_result returns false if($result=$db->query("SELECT `times_failed` FROM `".$table_prefix."_failed_login` WHERE `ip`='$current_ip' AND `ip2`='$current_ip2'")) { $result->num_rows returns 1 row I outputted the query using echo SELECT `times_failed` FROM `am_failed_login` WHERE `ip`='127.0.0.1' AND `ip2`='' and tried to send a query using phpMyAdmin and it returned the result as I wanted. The "safe_store" (don't mind the name, I just named it like it) function safe_store($error) { I tried to use just $db->store_result(); but it returned Fatal error: Call to undefined method mysqli::free() in C:\xamp\htdocs\projects\lib\functions\user.php on line 310 And fact, that the query returned a result and the num_rows found 1 line in the result. Kaperstone. Edited by KubeR, 22 October 2014 - 01:39 PM. I am using this code to evaluate whether checkboxes within a group have been selected: function IsChecked($chkname,$value) { if(!empty($_POST[$chkname])) { foreach($_POST[$chkname] as $chkval) { if($chkval == $value) { return true; } } } return false; } Now, I've decided that I want to add a message upon finding NO SELECTED checkbox items, but it is not functioning as desired. if(empty($_POST[$chkname])) { echo("You didn't select any checkboxes."); } How can I get this or something similar to trigger? I'm adding html tags with an "if" statement. $fw = "word" if ($fw == "a"){ echo "something"; }elseif ($fw == "b"){ echo "something else"; }else{ echo "this"; } So why would everything skip right to the "else" and echo that, even if $fw equals "a" or "b".... What I am trying to achieve here is a simple URL to server file download script. It works fantastically, however, I am trying to achieve an error message when the script fails to get a file. Right now, when the file is downloaded, it provides the echo 'Successfully downloaded (FILENAME) !'. But when it fails I would like for it to say something like, file could not be downloaded. As of right now it gives me a warning that it could not open stream and it still echos file successfully downloaded. Any advice? Full code: Code: [Select] <?php include '../dbc.php'; page_protect(); if (isset($_POST['submit'])) { $file = $_POST['filename']; $target= $_POST['hosttarget']; file_put_contents("$file", file_get_contents("$target")); echo "Successfully uploaded ".$file."!"; } else{ echo "Unable to retrieve file!"; } ?> <div class="wrap"> <FORM ENCTYPE="multipart/form-data" ACTION="" METHOD=POST> <div class="download"> <div class="left">Target:<br>Filename:</div> <div class="right"><INPUT TYPE="text" NAME="hosttarget" ID="text" VALUE=""><br> <INPUT TYPE="text" NAME="filename" ID="text" VALUE=""><br></div> <INPUT TYPE="submit" NAME="submit" ID="submit " CLASS='submit_btn' VALUE="Get File"> <div class="clear"></div> </div> </FORM> </div> I've tried various sort methods on this array. And seem to be failing. Code: [Select] Array ( [monkey quest] => 8 [monkey] => 2 [monkey sports] => 0 [monkey go happy] => 0 [monkey go happy 3] => 1 [monkey joes] => 0 [monkey games] => 2 [monkey bread recipe] => 1 [monkey go happy 2] => 3 [monkey quest trailer] => 4 [monkey quest guide] => 5 [monkey quest nick] => 6 ) What I want to do or attempt to do rather is sort the array by the => value from highest to lowest (or maybe in reverse as well, but one thing at a time) My last failed attempt I was trying out usort() as my concept.. Code: [Select] function cmp($a, $b) { if ($a == $b) { return 0; } return ($a < $b) ? -1 : 1; } echo "<pre>"; print_r(usort($kw, "cmp")); echo "</pre>"; But the only thing I am left with on the page is just 1 everything else seems to be getting lost, or I dunno whats going on. So I think I've done stumped my self. Now I'm looking for idea's assuming I am tackling this all wrong. Here's my code: I'm trying to make a function that returns true if the supplied string contains illegal characters, or false otherwise. I can't get it to work. Could someone please comment? Code: [Select] <?php function contains_illegal_chars($value) { if ( preg_match("['=]", $value) > 0 ) { return true; } return false; } $value = "this contain both illegal characters: ' and =" . "<BR>"; echo "Value is: $value"; if( contains_illegal_chars($value) ) echo "yes"; else echo "no"; // This is always being returned! Even though the string clearly contains both the quote and the equals sign! ?> Thanks for reading this. I have just begun using php, and I cannot, for my life, figure out what I am doing wrong here. I want to submit a form for a person to register with my site. It's simple, just name, email and password. I keep getting an error that the connection failed, so I will just show you what I have up until that point. My form is Post method, and it looks like: Code: [Select] <form method="post" action="signup.php" enctype="multipart/form-data"> <input name="name" type="text" id="name"> <input name="email" type="text" id="email"> <input name="pass" type="password"> <input type="submit" name="Submit" value="Submit"> </form> And the connection script is like so: Code: [Select] <?php $username="db_username"; $password="db_password"; $database="db_name"; $dbc=mysql_connect ("localhost", "$username", "$password") or die ('I cannot connect to the database.'); mysql_select_db ("$database", "$dbc"); It's the 'I cannot connect to the database.' error that I keep getting. In case it helps, the rest of the thing looks like this: Code: [Select] <?php $name= $_POST['name']; $email= $_POST['email']; $pass= $_POST['pass']; $query = "INSERT INTO table (name, email, password) VALUES ('$name', '$email', '$pass')"; mysql_query($query); mysql_close(); I have deliberately left out the php opening and closing tags (<?php...?>). Thanks so much for any help. Adam MOD EDIT: [code] . . . [/code] BBCode tags added. Please are going to start hating me about this haha. Hey guys i have been trying to do this for a few hours and my brain is hurting haha hope someone can help. Ok here is what i am trying to do. I have been making a website that allows users to make friends below is my friends table:: NAME: member_friends id friend_id << Person who has been sent the friend request my_id << Person who sent the friend request friend_since << when did they become friends is_friend << is set to 0 then friend request pending and this is the member_topics message_id member_id << this stores the id of the member from the members table message_contents << stores their message message_date message_reported << if set to 1 the message has been reported Ok basically i want the messages to be displayed on the members home page if they are friends, so if my name is JamesDean and i befriended a person called Harry if i post a message i want harry to see this and any other friends i may have. Same goes for their messages. Sorry if im confusing you stay with me. Ok here is what i am trying to do (did i mention im fairly new to php so please if im doing something wrong dont hurt me (: ) $query = mysql_query("SELECT * FROM member_friends"); while($row = mysql_fetch_array($query)){ $friend_id = $row['friend_id']; // Ok this is where i want the while loop to loop through all of my friends // Ok set up the new filter im gunna get lost here now $sql = mysql_query("SELECT a.*,b.* FROM member_topics as a, member_friends as b WHERE (a.member_id = b.my_id OR a.member_id = b.my_id) AND ((b.friend_id = '$friend_id') AND b.my_id = '$my_id') ORDER BY a.message_id DESC"); // $my_id is a variable created from session so thats ok and the $friend_id i want that to change fromt he first loop so the statement changes for all of my friends. // Sorry for the query above i have tried that many i dont even know my gender anymore // So while loop in a while loop i think while($row = mysql_fetch_array($sql)){ $message_id = $row['message_id']; $member_id = $row['member_id']; $message_contents = $row['message_contents']; $message_date = $row['message_date']; $message_type = $row['message_type']; $message_reported = $row['message_reported]; } } something like this hope someone can point me in the right direction before my brain fails thanks in advanced!!!!!!! Hi - I have spent 2 days trying to figure this out. I must be doing something stupid ... I am trying to update the DB with a collection of variables off of a various POST array's. I have indexed the variables so that I can loop through them with a FOR. However I am having all kinds of trouble: 1 - WEIGHT is giving 5 values even though the counter should only go 4 times. 2 - The WEIGHT variable is going into the wrong field in the DB even though I specify in my Query a specific place. 3 - I get undefined offset errors even though I have initialised the variables with their respective offsets. 4 - Adding the conditional statement adds even more offset errors even though they are initialised I am starting to wonder if my entire approach to updating my DB is flawed. As a student of PHP I think I need someone with more experience to look at what I am doing and tell me if something jumps out at them. There is a lot of statements echoing out values - and they all seem to check out. Man Many thanks for your advice Code: [Select] function finishedorder(){ $prodname = $_POST['prodname']; $prodid =$_POST['prodid']; $quantity = $_POST['quantity']; $pricelb = $_POST['pricelb']; $customerid = $_POST['customerid']; $price = $_POST['price']; $orderid = $_POST['orderid']; $weight = $_POST['weight']; echo "Varuable WEight"; print_r($weight); echo"<br/>"; echo "line 196 Weight"; print_r ($_POST['weight']); echo"<br/>"; echo "line 192 PriceLB"; print_r ($_POST['pricelb']); echo "<br/>"; echo "line 193 Price"; print_r ($_POST['price']); echo "<br/>"; echo "line 194 ProdID"; print_r ($_POST['prodid']); echo "<br/>"; echo "line 195 OrderID"; print_r ($_POST['orderid']); echo "<br/><br/>"; $numloops = count($_POST['prodid']); for ($i = 0; $i < $numloops ; $i++) { // !!! Start of the for loop !!! if (!isset($orderid[$i])) $orderid[$i] =''; if (!isset($prodid[$i])) $prodid[$i] =''; if (!isset($weight[$i])) $weight[$i] =''; if (!isset($pricelb[$i])) $pricelb[$i] =''; // This only initialises the Price & Weight variable to avoid an offset error message. if (!isset($weight[$i])) $weight[$i] =''; $ordervalue = $pricelb[$i] * $weight[$i]; echo " L. 216 The number is " . $i . "<br />"; echo "line 221 ProdID".$prodid[$i];echo "<br/>"; echo "line 217 Pricelb".$pricelb[$i];echo "<br/>"; echo 'Weight L. 219 weight[i]'. $weight[$i];echo "<br/>"; echo "line 220 weight".$weight; echo "<br/>"; echo "line 221 Numloops".$numloops; echo "<br/><br/>"; echo ' L. 225 $ordervalue ' .$ordervalue;echo "<br/>"; } //if ($pricelb[$i] == 0 ){ // conditonal statement // $ordervalue = $price[$i]; // } $sql =" UPDATE confirmedorder SET weight='$weight[$i]', ordervalue='$ordervalue', confirmedorder.picking = 'finished', confirmedorder.sale = 'open' WHERE prodID = '$prodid[$i]' AND OrderID = '$orderid[$i]' ; "; $this->db->query($sql); } // !! End For Loop. !! Hello everyone. I'm posting because I'm having difficulty using a file upload script I wrote in PHP. (Based on a tutorial naturally.) May someone more skilled than I could take a look at it? Form: (simple, no ajax or jquery involved. I'll add that later.) Code: [Select] <form enctype="multipart/form-data" action="upload.php" method="POST"> <table><tr><td>File</td><td><input name="uploaded" type="file" /></td></tr> <tr><td colspan="2"><input type="submit" value="Upload" style="float:right;" /></td></tr></table> </form> Upload Script: Code: [Select] <? session_start(); include('include/session.php'); /*IMAGE*/ $target = "upload/"; $target = $target . basename($_FILES['uploaded']['name']); $name = basename( $_FILES['uploaded']['name']); $ok=1; global $database; //This is our size condition if ($uploaded_size > 350000000) { echo "Your file is too large.<br>"; $ok=0; } //This is our limit file type condition if ($uploaded_type =="text/php") { echo "No PHP files<br>"; $ok=0; } //Here we check that $ok was not set to 0 by an error if ($ok==0) { Echo "Sorry your file was not uploaded"; } //If everything is ok we try to upload it else { if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { $channel_number = $_SESSION['channel_number']; $n = "INSERT INTO `documents` (`name`,`channel_number`) VALUES ('$name','$channel_number')"; mysql_query($n); header("Location:index.php"); } else { echo "Sorry, there was a problem uploading your file."; } } ?> The mysql query works fine, and it's just so that I can keep track of the uploads. I'm well aware this is not a secure script, btw. I'm just doing it to learn. okay so i have a slight problem. i have been testing my form with fake emails if i put something like CXZC@ff.ff in my email field i get an email with From : CXZC@ff.ff.cheatordie.com i do have a function called clean_string() that weeds out the following href|bcc|cc|to:|content-type can i add to this to weed something like this out? i already am using filter_vars validate_email filter and regex ontop of this and it is still happening. Warning: mysql_fetch_array() expects parameter 1 to be resource, string given... im tryin to put class inside code if $dayNumber and $dan are equal i tried few ways but all are complicated since i have to call some functions this end up as "simple" solution but i dont know where did i get wrong PS that should be possible? Code: [Select] else { echo "<td width='40'"; $moj_id = $_SESSION['id']; $query_event = mysql_query("SELECT * FROM events WHERE id_user='$moj_id' GROUP BY 'event_date'") ; $test = mysql_fetch_array('$query_event'); $date_event = $test['event_date']; sscanf($date_event, "%d-%d-%d", $godina, $mjesec, $dan); if ($dan==$dayNumber && $mjesec==$month && godina==$year) { echo " class='radni'"; } echo"><a href='day_info.php?dan=",$dayNumber,"&mj=",$month,"&gd=",$year,"'>" . $dayNumber . " </a></td>\n"; $dayNumber++; } Php Folks, Below is a membership php script I am building. config.php functions_list.php eror_reporting.php site_details.php conn.php login_check.php account_header.php login_v1.php sessions.php home_v1.php
Now, when you login, you are taken to home_v1.php that displays your details from tbls: users, personal_details, home_contact_details, business_contact_details. Problem is last 2 tables' data do not show-up on the homepage. Get no mysql error either! What a nuisancical mystery! Been going round in circles for nearly a wk now! I give-up! Only bothering you guys as a last resort! What do you reckon the problem is ? Maybe a bug perhaps with php ? The concerned tables do have data! See for yourselves. The 2 tbls data is below as attachment is failing to upload. Do not want to be burdening you guys with all files and so only provided relevant ones for you to easily check in your wamp/xamp.
test.sql -- phpMyAdmin SQL Dump -- version 4.8.3 -- https://www.phpmyadmin.net/ -- -- Host: 127.0.0.1 -- Generation Time: Nov 20, 2018 at 08:38 PM -- Server version: 10.1.36-MariaDB -- PHP Version: 7.2.11 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET AUTOCOMMIT = 0; START TRANSACTION; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- -- Database: `test` -- -- -------------------------------------------------------- -- -- Table structure for table `business_contact_details` -- CREATE TABLE `business_contact_details` ( `id` int(11) NOT NULL, `username` varchar(255) NOT NULL, `date_&_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `business_blog` varchar(255) NOT NULL, `business_name` varchar(50) NOT NULL, `business_email` varchar(50) NOT NULL, `business_mobile` int(50) DEFAULT NULL, `business_land_line_phone` int(50) DEFAULT NULL, `business_fax` int(50) DEFAULT NULL, `business_zip` varchar(50) NOT NULL, `business_town` varchar(50) DEFAULT NULL, `business_neighbourhood` varchar(50) DEFAULT NULL, `business_borough` varchar(50) DEFAULT NULL, `business_city` varchar(50) DEFAULT NULL, `business_county` varchar(50) DEFAULT NULL, `business_district` varchar(50) DEFAULT NULL, `business_region` varchar(50) DEFAULT NULL, `business_state` varchar(50) DEFAULT NULL, `business_country` varchar(50) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `business_contact_details` -- INSERT INTO `business_contact_details` (`id`, `username`, `date_&_time`, `business_blog`, `business_name`, `business_email`, `business_mobile`, `business_land_line_phone`, `business_fax`, `business_zip`, `business_town`, `business_neighbourhood`, `business_borough`, `business_city`, `business_county`, `business_district`, `business_region`, `business_state`, `business_country`) VALUES (1, 'admin123', '2018-11-20 19:16:40', 'blogs.yahoo.com', 'loudwoman', 'loudwoman@gmail.com', 1789504580, 286980665, 286980665, 'nq1', 'Surrey', 'Surrey', 'Surrey', 'Surrey', 'Surrey', 'Surrey', 'Surrey', 'England', 'UK'), (3, 'spaceman', '2018-11-20 19:16:40', 'spaceman.gmail.com', 'spacey', 'spaceman@gmail.com', 234567, 12345667, 4353555, 'fv5', 'redmond', 'redmond', 'redmond', 'newland', 'newland', 'newland', 'newland', 'Uttah', 'USA'); -- -------------------------------------------------------- -- -- Table structure for table `home_contact_details` -- CREATE TABLE `home_contact_details` ( `id` int(11) NOT NULL, `username` varchar(255) NOT NULL, `date_&_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `personal_blog` varchar(255) DEFAULT NULL, `personal_email` varchar(50) NOT NULL, `personal_mobile` int(50) DEFAULT NULL, `home_land_line_phone` int(50) DEFAULT NULL, `home_fax` int(11) DEFAULT NULL, `home_zip` varchar(50) DEFAULT NULL, `home_town` varchar(50) DEFAULT NULL, `home_neighbourhood` varchar(50) DEFAULT NULL, `home_borough` varchar(50) DEFAULT NULL, `home_city` varchar(50) DEFAULT NULL, `home_county` varchar(50) DEFAULT NULL, `home_district` varchar(50) DEFAULT NULL, `home_region` varchar(50) DEFAULT NULL, `home_state` varchar(50) DEFAULT NULL, `home_country` varchar(50) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `home_contact_details` -- INSERT INTO `home_contact_details` (`id`, `username`, `date_&_time`, `personal_blog`, `personal_email`, `personal_mobile`, `home_land_line_phone`, `home_fax`, `home_zip`, `home_town`, `home_neighbourhood`, `home_borough`, `home_city`, `home_county`, `home_district`, `home_region`, `home_state`, `home_country`) VALUES (1, 'admin123', '2018-11-20 19:13:23', 'blogs.yahoo.com', 'santa_clause@gmail.com', 123456, 123456, 123456, 'Wc1', 'Birmingham', NULL, 'Birmingham', 'Birmingham', 'Birmingham', NULL, 'Birmingham', 'Carolina', 'United States'), (3, 'wonderwoman', '2018-11-20 19:13:23', 'blogs.gmail.com', 'wonderwoman@gmail.com', 0, NULL, 0, NULL, 'California', NULL, 'California', 'California', 'California', NULL, 'California', 'N/A', 'USA'); -- -------------------------------------------------------- -- -- Table structure for table `users` -- CREATE TABLE `users` ( `id` int(11) NOT NULL, `date_&_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `account_activation_code` varchar(255) NOT NULL, `account_activation_status` int(2) NOT NULL, `id_video_verification_status` int(2) NOT NULL, `id_verification_video_file_url` varchar(255) DEFAULT NULL, `username` varchar(255) NOT NULL, `password` varchar(255) NOT NULL, `primary_domain` varchar(255) NOT NULL, `primary_website_email` varchar(255) NOT NULL, `sponsor_username` varchar(255) NOT NULL, `recruits_number` int(10) NOT NULL, `registering_country` varchar(255) NOT NULL, `registering_ip` varchar(255) DEFAULT NULL, `registering_browser` varchar(255) DEFAULT NULL, `registering_os` varchar(255) DEFAULT NULL, `registering_isp` varchar(255) DEFAULT NULL, `age_range` varchar(5) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `users` -- INSERT INTO `users` (`id`, `date_&_time`, `account_activation_code`, `account_activation_status`, `id_video_verification_status`, `id_verification_video_file_url`, `username`, `password`, `primary_domain`, `primary_website_email`, `sponsor_username`, `recruits_number`, `registering_country`, `registering_ip`, `registering_browser`, `registering_os`, `registering_isp`, `age_range`) VALUES (0, '2018-11-20 19:22:36', '0300bf1542f6e6261f606542c2320bbb9efaf359', 1, 1, NULL, 'admin123', '$2y$10$tM9gMGQ6Z6wNxJ/t8neIKOtQcRk1WwQIEBqxo55SgUwv710nfj0m2', 'gmail.com', 'admin@gmail.com', 'admin123', 1, '', NULL, NULL, '', '', ''), (1, '2018-11-20 19:21:34', '1300bf1542f6e6261f606542c2320bbb9efaf360', 1, 1, NULL, 'admin1234', '$2y$10$tM9gMGQ6Z6wNxJ/t8neIKOtQcRk1WwQIEBqxo55SgUwv710nfj0m2', 'yahooinvader.co.uk', 'gobot@yahoo.co.uk', 'wonderman', 0, 'USA', NULL, NULL, '', '', '41-50'), (7, '2018-11-20 19:21:35', 'b06d8f2dbdc9c99e032fdffb44a3e7e49766c267', 0, 0, NULL, 'loudmouth', '$2y$10$MIcXW3Vx6HHSEzr.bsNN.eL336VT32un6RhiIFfVhDB8BfGJrT2vu', 'fnulll.com', 'admin1234@fnulll.com', 'admin123', 1, 'Germany', NULL, NULL, '', '', '71-75'); -- -- Indexes for dumped tables -- -- -- Indexes for table `business_contact_details` -- ALTER TABLE `business_contact_details` ADD PRIMARY KEY (`id`); -- -- Indexes for table `home_contact_details` -- ALTER TABLE `home_contact_details` ADD PRIMARY KEY (`id`); -- -- Indexes for table `users` -- ALTER TABLE `users` ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `usernames` (`username`), ADD UNIQUE KEY `emails` (`primary_website_email`), ADD UNIQUE KEY `primary_website_domain` (`primary_domain`); -- -- AUTO_INCREMENT for dumped tables -- -- -- AUTO_INCREMENT for table `business_contact_details` -- ALTER TABLE `business_contact_details` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `home_contact_details` -- ALTER TABLE `home_contact_details` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; -- -- AUTO_INCREMENT for table `users` -- ALTER TABLE `users` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8; COMMIT; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 1. config.php <?php //Include both FUNCTIONS and PHP Files. //Required PHP Files. include 'error_reporting.php'; include 'site_details.php'; include 'conn.php'; //Required FUNCTIONS Files. include 'functions_list.php'; ?>
2. functions_list.php <?php //All FUNCTIONS List File. include 'login_check.php'; ?>
3. error_reporting.php <?php //ERROR REPORTING CODES. declare(strict_types=1); ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); error_reporting(E_ALL); mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); ?>
4. site_details.php <?php $site_name = "Idea Experimenter"; $social_network_name = "Idea Experimenter"; $site_domain = "test.com"; $social_network_domain = "test.com"; $site_admin_username = "admin123"; $site_admin_email = "admin@test.com"; $social_network_admin_username = "admin123"; $social_network_admin_email = "admin@test.com"; $server_time = "California,USA"; ?>
5. conn.php <?php //Connect to Mysql Database in this input format: "Server", "MySql User", "Mysql User Password", "MySql Database Name". $conn = mysqli_connect("localhost","root","","test"); if (!$conn) { //Error Message to show user in technical/development mode to see errors. die("Database Error : " . mysqli_error($conn)); //Error Message to show User in Layman's mode to see errors. die("Database error."); exit(); } ?>
6. login_check.php <?php //login_check() FUNCTION File. /* Check if User is logged-in or not by checking if the session names "user" is set (isset) or not. Return "TRUE" if it is; Else "FALSE". */ //Have to initiate the "session_start" global variable, regardless of whether User is logged-in or not, in order to deal with session stuffs in php. /* Replacing following chunk: if(!session_start()) { session_start(); } */ //Replacing to this instead: if( session_status() != PHP_SESSION_ACTIVE ) session_start(); //Function for checking if User is logged-in or not. function login_check() { if(isset($_SESSION["user"]) && !empty($_SESSION["user"])) { //If Session "user" is set and not empty then return TRUE. return TRUE; } else { //If Session "User" is NOT set or if session is empty then return FALSE. return FALSE; } } ?>
7. account_header.php <?php //Check if User is already logged-in or not. Get the login_check() FUNCTION to check. if (login_check() === FALSE) { //Redirect User to Log-in Page immediately. //header("refresh:0 url=login.php"); header("location:login_v1.php"); exit(); } else { include 'account_header_ad.php'; //Will display on all webpages inside the account. } ?>
8. login_v1.php <?php //Required PHP Files. include 'config.php'; //Do not include 'account_header.php' here or login.php would go in a redirection loop. /* //Check if User is already logged-in or not. Get the login_check() FUNCTION to check. if (login_check() === TRUE) { //Redirect User to Log-in Page immediately. //header("refresh:0; url=home.php"); header("location:home_v1.php?user=$user"); exit(); } */ if (isset($_POST["login_username_or_email_or_domain"]) && isset($_POST["login_password"])) { $login_username_or_email_or_domain = trim($_POST["login_username_or_email_or_domain"]); $login_password = $_POST["login_password"]; //Check if User inputted Username/Email exist in db. Registered or not. //Select Username or Email to check against Mysql DB if they are already registered or not. if(strpos("login_username_or_email_or_domain","@")) { $querying_column = "website_email"; } elseif(strpos("login_username_or_email_or_domain",".")) { $querying_column = "domain"; } else { $querying_column = "username"; } //Make sure the users table has atleast these 3 columns: username,primary_domain and website_email due to the $querying_column variable which could hold any of these 3 values. $query_1 = "SELECT id,recruits_number,sponsor_username,account_activation_status,id_video_verification_status,id_verification_video_file_url,username,password,primary_domain,primary_website_email,registering_country,registering_ip,registering_browser,registering_os,registering_isp,age_range FROM users WHERE $querying_column = ?"; $stmt_1 = mysqli_prepare($conn,$query_1); mysqli_stmt_bind_param($stmt_1,'s',$login_username_or_email_or_domain); mysqli_stmt_execute($stmt_1); $result_1 = mysqli_stmt_bind_result($stmt_1,$db_id,$db_recruits_number,$db_sponsor_username,$db_account_activation_status,$db_id_video_verification_status,$db_id_verification_video_file_url,$db_username,$db_password,$db_primary_domain,$db_website_email,$db_registering_country,$registering_ip,$registering_browser,$registering_os,$registering_isp,$db_age_range); mysqli_stmt_fetch($stmt_1); mysqli_stmt_close($stmt_1); //Free Result_1 Set mysqli_stmt_free_result($stmt_1); $query_2 = "SELECT title,first_name,middle_name,surname,gender,date_of_birth,skin_complexion,height,weight,sexual_orientation,religion,education,profession,marital_status,working_status,country_of_birth,bio FROM personal_details WHERE id = ?"; $stmt_2 = mysqli_prepare($conn,$query_2); mysqli_stmt_bind_param($stmt_2,'s',$db_id); mysqli_stmt_execute($stmt_2); $result_1 = mysqli_stmt_bind_result($stmt_2,$db_title,$db_first_name,$db_middle_name,$db_surname,$db_gender,$db_date_of_birth,$db_skin_complexion,$db_height,$db_weight,$db_sexual_orientation,$db_religion,$db_education,$db_profession,$db_marital_status,$db_working_status,$db_country_of_birth,$db_bio); mysqli_stmt_fetch($stmt_2); mysqli_stmt_close($stmt_2); //Free Result_2 Set mysqli_stmt_free_result($stmt_2); $query_3 = "SELECT personal_blog,personal_email,personal_mobile,home_land_line_phone,home_fax,home_zip,home_town,home_neighbourhood,home_borough,home_city,home_district,home_county,home_region,home_state,home_country FROM home_contact_details WHERE id = ?"; $stmt_3 = mysqli_prepare($conn,$query_3); mysqli_stmt_bind_param($stmt_3,'s',$db_id); mysqli_stmt_execute($stmt_3); $result_3 = mysqli_stmt_bind_result($stmt_3,$db_persona_blog,$db_personal_email,$db_personal_mobile,$db_home_land_line_phone,$db_home_fax,$db_home_zip,$db_home_town,$db_home_neighbourhood,$db_home_borough,$db_home_city,$db_home_district,$db_home_county,$db_home_region,$db_home_state,$db_home_country); mysqli_stmt_fetch($stmt_3); mysqli_stmt_close($stmt_3); //Free Result_3 Set //mysqli_stmt_free_result($stmt_3); $query_4 = "SELECT business_blog,business_name,business_email,business_mobile,business_land_line_phone,business_fax,business_zip,business_town,business_neighbourhood,business_borough,business_city,business_district,business_county,business_region,business_state,business_country FROM business_contact_details WHERE id = ?"; $stmt_4 = mysqli_prepare($conn,$query_4); mysqli_stmt_bind_param($stmt_4,'s',$db_id); mysqli_stmt_execute($stmt_4); $result_3 = mysqli_stmt_bind_result($stmt_3,$db_business_blog,$db_business_name,$db_business_email,$db_business_mobile,$db_business_land_line_phone,$db_business_fax,$db_business_zip,$db_business_town,$db_business_neighbourhood,$db_business_borough,$db_business_city,$db_business_district,$db_business_county,$db_business_region,$db_business_state,$db_business_country); mysqli_stmt_fetch($stmt_4); mysqli_stmt_close($stmt_4); //Free Result_4 Set //mysqli_stmt_free_result($stmt_4); if (!password_verify($login_password,$db_password)) { echo "Incorrect log-in details3<br>"; exit(); } else { $user = $db_username; //Session Variables associated with 'users' tbl. $_SESSION["user"] = $user; $_SESSION['id'] = $db_id; $_SESSION["recruits_number"] = $db_recruits_number; $_SESSION["sponsor_username"] = $db_sponsor_username; $_SESSION["account_activation_status"] = $db_account_activation_status; $_SESSION["id_video_verification_status"] = $db_id_video_verification_status; $_SESSION["id_verification_video_file_url"] = $db_id_verification_video_file_url; $_SESSION["username"] = $db_username; $_SESSION["primary_domain"] = $db_primary_domain; $_SESSION["primary_website_email"] = $db_primary_website_email; $_SESSION["registering_country"] = $db_registering_country; $_SESSION["registering_ip"] = $db_registering_ip; $_SESSION["registering_browser"] = $db_registering_browser; $_SESSION["registering_os"] = $db_registering_os; $_SESSION["registering_isp"] = $db_registering_isp; $_SESSION["age_range"] = $db_age_range; //Session Variables associated with 'personal_details' tbl. $_SESSION["personal_details_verified_by_recruiter"] = $db_personal_details_verified_by_recruiter; $_SESSION["passport_size_photoh_image"] = $db_passport_size_photoh_image; $_SESSION["title"] = $db_title; $_SESSION["first_name"] = $db_first_name; $_SESSION["middle_name"] = $db_middle_name; $_SESSION["surname"] = $db_surname; $_SESSION["gender"] = $db_gender; $_SESSION["age_range"] = $db_age_range; $_SESSION["date_of_birth"] = $db_date_of_birth; $_SESSION["skin_complexion"] = $db_skin_complexion; $_SESSION["height"] = $db_height; $_SESSION["weight"] = $db_weight; $_SESSION["sexual_orientation"] = $db_sexual_orientation; $_SESSION["religion"] = $db_religion; $_SESSION["education"] = $db_education; $_SESSION["profession"] = $db_profession; $_SESSION["marital_status"] = $db_marital_status; $_SESSION["working_status"] = $db_working_status; $_SESSION["country_of_birth"] = $db_country_of_birth; $_SESSION["bio"] = $db_bio; //Session Variables associated with 'home_contact_details' tbl. $_SESSION["personal_blog"] = $db_personal_blog; $_SESSION["personal_email"] = $db_personal_email; $_SESSION["personal_mobile"] = $db_personal_mobile; $_SESSION["home_land_line_phone"] = $db_home_land_line_phone; $_SESSION["home_fax"] = $db_home_fax; $_SESSION["home_zip"] = $db_home_zip; $_SESSION["home_town"] = $db_home_town; $_SESSION["home_neighbourhood"] = $db_home_neighbourhood; $_SESSION["home_borough"] = $db_home_borough; $_SESSION["home_city"] = $db_home_city; $_SESSION["home_county"] = $db_home_county; $_SESSION["home_district"] = $db_home_district; $_SESSION["home_region"] = $db_home_region; $_SESSION["home_state"] = $db_home_state; $_SESSION["home_country"] = $db_home_country; //Session Variables associated with 'business_contact_details' tbl. $_SESSION["business_blog"] = $db_business_blog; $_SESSION["business_name"] = $db_business_name; $_SESSION["business_email"] = $db_business_email; $_SESSION["business_mobile"] = $db_business_mobile; $_SESSION["business_land_line_phone"] = $db_business_land_line_phone; $_SESSION["business_fax"] = $db_business_fax; $_SESSION["business_zip"] = $db_business_zip; $_SESSION["business_town"] = $db_business_town; $_SESSION["business_neighbourhood"] = $db_business_neighbourhood; $_SESSION["business_borough"] = $db_business_borough; $_SESSION["business_city"] = $db_business_city; $_SESSION["business_county"] = $db_business_county; $_SESSION["business_district"] = $db_business_district; $_SESSION["business_region"] = $db_business_region; $_SESSION["business_state"] = $db_business_state; $_SESSION["business_country"] = $db_business_country; header("location:home_v1.php?user=$user"); } } ?> <!DOCTYPE html> <html> <head> <title><?php $site_name ?> Member Login Page</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <?php /* $_GET and $_POST have two different enctype settings in the form. If we do not specify which one to use, the default is "plain/text". With $_GET you use "application/x-www-form-urlencode" and with $_POST you use "multipart/form-data". */ ?> <form name = "login_form" method = "post" action="" enctype = "multipart/form-data"> <h3><?php echo "$site_name";?> Member Login Form</h3> <fieldset> <label for="login_name">Username/Email:</label> <input type="text" name="login_username_or_email_or_domain" id="login_name" required [A-Za-z0-9] autocorrect=off value=""><br> <label for="login_pass">Password:</label> <input type="password" name="login_password" id="login_pass" required [A-Za-z0-9] autocorrect=off value=""> </fieldset> <div class="SubmitsAndHiddens"> <label for="login_remember">Remember Log-in Details:</label> <input type="checkbox" name="login_remember" id="login_remember" /> <br> <p align="left"><input type="submit" class="btn btn-default" name="submit" value="Log-in!"></p> <br> <a href="login_password_reset.php">Forgot your password ? Reset it here!</a> <br> <a href="register.php">Don't yet have an account ? Register here!</a> </div> </form> </body> </html>
9. sessions.php <?php //$_SESSION Variables associated with 'users' tbl. $user = $_SESSION["user"]; $id = $_SESSION['id']; $sponsor_username = $_SESSION["sponsor_username"]; $recruits_number = $_SESSION["recruits_number"]; $account_activation_status = $_SESSION["account_activation_status"]; $id_video_verification_status = $_SESSION["id_video_verification_status"]; $id_verification_video_file_url = $_SESSION["id_verification_video_file_url"]; $username = $_SESSION["username"]; $primary_domain = $_SESSION["primary_domain"]; $primary_website_email = $_SESSION["primary_website_email"]; $registering_country = $_SESSION["registering_country"]; $registering_ip = $_SESSION["registering_ip"]; $registering_browser = $_SESSION["registering_browser"]; $registering_os = $_SESSION["registering_os"]; $registering_isp = $_SESSION["registering_isp"]; $age_range = $_SESSION["age_range"]; //$_SESSION Variables associated with 'personal_details' tbl. $personal_details_verified_by_recruiter = $_SESSION["personal_details_verified_by_recruiter"]; $passport_size_photoh_image = $_SESSION["passport_size_photoh_image"]; $title = $_SESSION["title"]; $first_name = $_SESSION["first_name"]; $middle_name = $_SESSION["middle_name"]; $surname = $_SESSION["surname"]; $gender = $_SESSION["gender"]; $date_of_birth = $_SESSION["date_of_birth"]; $skin_complexion = $_SESSION["skin_complexion"]; $height = $_SESSION["height"]; $weight = $_SESSION["weight"]; $sexual_orientation = $_SESSION["sexual_orientation"]; $religion = $_SESSION["religion"]; $education = $_SESSION["education"]; $profession = $_SESSION["profession"]; $marital_status = $_SESSION["marital_status"]; $working_status = $_SESSION["working_status"]; $country_of_birth = $_SESSION["country_of_birth"]; $bio = $_SESSION["bio"]; //$_SESSION Variables associated with 'home_contact_details' tbl. $personal_blog = $_SESSION["personal_blog"]; $personal_email = $_SESSION["personal_email"]; $personal_mobile = $_SESSION["personal_mobile"]; $home_land_line_phone = $_SESSION["home_land_line_phone"]; $home_fax = $_SESSION["home_fax"]; $home_zip = $_SESSION["home_zip"]; $home_town = $_SESSION["home_town"]; $home_neighbourhood = $_SESSION["home_neighbourhood"]; $home_borough = $_SESSION["home_borough"]; $home_city = $_SESSION["home_city"]; $home_county = $_SESSION["home_county"]; $home_district = $_SESSION["home_district"]; $home_region = $_SESSION["home_region"]; $home_state = $_SESSION["home_state"]; $home_country = $_SESSION["home_country"]; //$_SESSION Variables associated with 'business_contact_details' tbl. $business_blog = $_SESSION["business_blog"]; $business_name = $_SESSION["business_name"]; $business_email = $_SESSION["business_email"]; $business_mobile = $_SESSION["business_mobile"]; $business_land_line_phone = $_SESSION["business_land_line_phone"]; $business_fax = $_SESSION["business_fax"]; $business_zip = $_SESSION["business_zip"]; $business_town = $_SESSION["business_town"]; $business_neighbourhood = $_SESSION["business_neighbourhood"]; $business_borough = $_SESSION["business_borough"]; $business_city = $_SESSION["business_city"]; $business_county = $_SESSION["business_county"]; $business_district = $_SESSION["business_district"]; $business_region = $_SESSION["business_region"]; $business_state = $_SESSION["business_state"]; $business_country = $_SESSION["business_country"]; ?>
10 home_v1.php <?php //Required PHP Files. include 'config.php'; //Required on all webpages of the site. include 'account_header.php'; //Required on all webpages of the account. include 'sessions.php'; ?> <!DOCTYPE html> <html> <head> <title><?php echo "$user ";?>Home Page</title> <meta charset="utf-8"> </head> <body> <body background="background.png"> <p align="right"><a href="settings.php?user=<?php echo "$user";?>">Settings</a>|<a href='logout_v1.php'>Log Out</a>|</p> <h2><p align="center"><?php echo "$user Home Page";?></p></h2> <?php //Welcome User by name. echo "Welcome $first_name $middle_name $surname";?> <br> <br> <p align = "center"><font color = "red"><b>Latest Follower</b></font><br> <iframe src="https://www.yahoo.com" width="100%" height="500px"> <p>Your browser does not support iframes.</p> </iframe> </p> <br> <br> <p align = "center"><font color = "red"><b>Latest Followee</b></font><br> <iframe src="http://google.com"> <p>Your browser does not support iframes.</p> </iframe> </p> <br> <br> <p align = "center"><font color = "red"><b>Latest Recruit</b></font><br> <iframe src="http://google.com"> <p>Your browser does not support iframes.</p> </iframe> </p> <br> <br> <p align = "center"><font color = "red"><b>Upline 1 Latest Visit</b></font><br> <iframe src="http://google.com"> <p>Your browser does not support iframes.</p> </iframe> </p> <br> <p align = "center"><font color = "red"><b>Upline 2 Latest Visit</b></font><br> <iframe src="http://google.com"> <p>Your browser does not support iframes.</p> </iframe> </p> <br> <p align = "center"><font color = "red"><b>Upline 3 Latest Visit</b></font><br> <iframe src="http://google.com"> <p>Your browser does not support iframes.</p> </iframe> </p> <br> <p align = "center"><font color = "red"><b>Upline 4 Latest Visit</b></font><br> <iframe src="http://google.com"> <p>Your browser does not support iframes.</p> </iframe> </p> <br> <p align = "center"><font color = "red"><b>Upline 5 Latest Visit</b></font><br> <iframe src="http://google.com"> <p>Your browser does not support iframes.</p> </iframe> </p> <br> <p align = "center"><font color = "red"><b>Upline 6 Latest Visit</b></font><br> <iframe src="http://google.com"> <p>Your browser does not support iframes.</p> </iframe> </p> <br> <?php //Display User Account Details echo "<h3>User: <a href=\"user.php?user=$user\">$user</a> Details</h3>";?><br> <?php //CHANGELINK $user_account_details = array("id_video_verification_status","id_verification_video_file_url","recruits_number","sponsor_username","username","primary_domain","primary_website_email","sponsor_username","recruits_number","registering_country","registering_ip","registering_browser","registering_os","registering_isp","age_range"); foreach ($user_account_details as $value) { $value_0 = str_replace("_"," ","$value"); $value_0 = ucwords("$value_0"); echo "<b>$value_0</b>: "; echo "${$value}";?><br><?php } //Display User Personal Details echo "<h3>Personal: <a href=\"user.php?user=$user\">$user</a> Details</h3>";?><br> <?php //CHANGELINK $user_personal_details = array("personal_details_verified_by_recruiter","passport_size_photoh_image","title","first_name","middle_name","surname","gender","date_of_birth","skin_complexion","height","weight","sexual_orientation","marital_status","working_status","country_of_birth","bio"); foreach ($user_personal_details as $value) { $value_0 = str_replace("_"," ","$value"); $value_0 = ucwords("$value_0"); echo "<b>$value_0</b>: "; echo "${$value}";?><br><?php } //Display User Home Contact Details from home_contact_details tbl. echo "<h3>Home <a href=\"user.php?user=$user\">$user</a> Details</h3>";?><br> <?php //CHANGELINK $user_home_contact_details = array("personal_blog","personal_email","personal_mobile","home_land_line_phone","home_fax","home_zip","home_town","home_neighbourhood","home_borough","home_city","home_county","home_district","home_region","home_state","home_country"); foreach ($user_home_contact_details as $value) { $value_0 = str_replace("_"," ","$value"); $value_0 = ucwords("$value_0"); echo "<b>$value_0</b>: "; echo "${$value}";?><br><?php //NOTWORKING } //Display User Business Contact Details from business_contact_details tbl. echo "<h3>Business: <a href=\"user.php?user=$user\">$user</a> Details</h3>";?><br><?php //CHANGELINK $user_business_contact_details = array("business_blog","business_name","business_email","business_mobile","business_land_line_phone","business_fax","business_zip","business_town","business_neighbourhood","business_borough","business_city","business_county","business_district","business_region","business_state","business_country"); foreach ($user_business_contact_details as $value) { $value_0 = str_replace("_"," ","$value"); $value_0 = ucwords("$value_0"); echo "<b>$value_0</b>: "; echo "${$value}";?><br><?php //NOTWORKING } ?> <br> <?php //Link Submitter FRame //Link Submitter iFrame Goes here ?> <br> <br> <?php include 'account_footer.php'; ?>
11. log_out_v1.php <?php session_start(); session_destroy(); echo "You have successfully logged-out of your account!"; ?> <br> <p align="left"><font color="red" size="3"><b>Want to Log-in again ? </b><a href="login_v1.php">Login here!</a></font></p> On the home_v1.php, I should be echoing the row data through htmlentities. Right ? On the comments on home_v1.php, note the "//NOT WORKING". This is where I am having trouble as data from the 2 tbls (home_contact_details, business_contact_details) are not getting grabbed and displayed. Edited November 20, 2018 by phpsane
<?php
$id = $_GET['id']; $pdf = new FPDF('P','mm', array(80,200)); $pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Line(10,18,72,18);
$pdf->SetFont('Arial','',8);
$pdf->SetFont('Arial','',8);
$pdf->SetFont('Arial','',8);
$pdf->Line(10,30,72,30);
$pdf->SetY(31);
$pdf->SetFont('Courier','B',8);
$pdf->SetFont('Courier','BI',8);
$pdf->SetFont('Courier','B',8);
$pdf->SetFont('Courier','BI',8);
$pdf->SetFont('Courier','B',8);
$pdf->SetFont('Courier','BI',8);
$pdf->SetFont('Courier','BI',8);
$pdf->SetX(6);
$select = $pdo->prepare("SELECT * FROM tbl_invoice_detail WHERE invoice_id=$id");
//////////////////////////////////////////////
$pdf->SetFont('Arial','BI',7);
$pdf->SetX(43);
$pdf->SetFont('Arial','BI',7);
$pdf->SetX(43);
$pdf->SetFont('Arial','BI',7);
//////////////////////////////////////////////
$pdf->SetFont('Arial','BU',5); $pdf->Output(); HTML code: Code: [Select] <form method="post" action="viewpage.php?page_id=5"> Email: <input name="email" type="text"><br> Full Name: <input name="name" type="text"><br> Age: <input name="age" type="text"><br> Summoner Name: <input name="summon" type="text"><br> Do you have vent? <input name="vent" type="text"><br> Do you have a mic? <input name="mic" type="text"><br> How often can you be on? <input name="online" type="text"><br> What level are you? <input name="level" type="text"><br> Who do you like to play as? <input name="champs" type="text"> </form><br> Can you help donate to the clan for vent and the site?<br> <textarea name="name" rows="7" cols="25"></textarea><br> Before you say anything about the PHP not scripted to do all fields, I already know this I'm trying to figure out how to send multiple ones in one message: PHP Code: Code: [Select] <?php if (isset($_POST['submit'])) { $to = "hidden for privacy"; $subject = "LoL Recruitment"; $email = $_REQUEST['email'] ; $message = ($_REQUEST['name'], $_REQUEST['age']) ; $headers = "From: $email"; $sent = mail($to, $subject, $message, $headers) ; if($sent) { print "Your mail was sent successfully"; } else { print "We encountered an error sending your mail"; } } ?> I'm willing to bet my Code: [Select] $message = ($_REQUEST['name'], $_REQUEST['age']) ;if FAR wrong |