PHP - Moved: New Xampp Security Concept?
This topic has been moved to Other Web Server Software.
http://www.phpfreaks.com/forums/index.php?topic=355702.0 Similar TutorialsThis topic has been moved to PHP Installation & Configuration. http://www.phpfreaks.com/forums/index.php?topic=334216.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=348673.0 This topic has been moved to Installation in Windows. http://www.phpfreaks.com/forums/index.php?topic=332859.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=345826.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=312186.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=314459.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=353714.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=354650.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=351660.0 can someone please help me understand the concept how to implement the "Domand Driven Design" strategy in PHP ? ok let's say for example I have a user and a user got multiple addresses. so the user got e.g
class User { public $userId; public $name; public $age; public function setUserId($userId) { $this->userId = $userId; } public function getUserId() { return $this->userId; } public function setName($name) { $this->name = $name; } public function getName() { return $this->name; } public function setAge($age) { $this->age = $age; } public function getAge() { return $this->age; } }
Then Address got e.g class Address { public $addressId; public $country; public $city; public $zip; public function setAddressId($addressId) { $this->addressId = $addressId; } public function getAddressId() { return $this->addressId; } public function setCountry($country) { $this->country = $country; } public function getCountry() { return $this->country; } public function setCity($city) { $this->city = $city; } public function getCity() { return $this->city; } public function setZip($zip) { $this->zip = $zip; } public function getZip() { return $this->zip; } }
So how to apply the concept of the Domain Driven Design here ? I have the concept I want... and I know how to do some of these things by themselves... but not in combination, and I really need to do this in combination for the concept to work. I'm totally new to PHP/mySQL... Background information: I'm using ExpressionEngine (incase anyone is familiar)...and I'm using that for a membership system as well as a means to restrict certain content to certain member/account types. The website is membership ONLY... (using cookies to remain logged in). The part I want to make happen with PHP/mySQL is to restrict some content even further. I want this content to be accessible through sequence only. The sequence of what is presented is important... so imagine it is something like this: Section 1 : About the world. Section 2: About something else. (((For example--- the user clicks Section 1... and now (invisible to the user) the DATE/TIME is taken into the database as the moment they BEGAN that part of the section.))) ((( Now the user is presented with the information they requested))) "Here is the content--- information on some countries in the world. INFoRMATION IS HERE... BLA BLA BLA BLA BLA BLABLA BLA BLA BAL BLA BLA BLA BLA BLABLA..." Now user has available choices: "------------------------ 1. Tell me about Japan. 2. Tell me about Hawaii. 3. Tell me about Mexico. 4. Tell me about U.S.A." Clicking a link will either take the user to a new PAGE (file) with the information in it... or it will somehow channel the next information from somewhere (text file or something) into the same page, changing the content that way. However it happens, I want it to be so when a choice is made--- you can not press the back button and choose something else. I want the user to really 'think' about the choices they are making before they make them... they are free to take their time as long as they wish while they're IN sequence... but if they interrupt the sequence by pressing back or just closing the browser window *** I WANT TO MAKE THAT SPECIFIC SECTION (1) INACCESSIBLE FOR A DURATION OF TIME (few days) ***. (((hence the grabbing of the date/time when the user began that section)))... When the time limit is lifted--- then they can access that content again. If this requires multiple pages--- then each page will require the previous as a referrer, so that way nothing can be accessed out of the intended sequence. The idea is that, if the user begins a section--- they MUST go through step 1--- to reach step 9... and they need to do each one in order. The user will have a wide variety of choices though... which means there will be ONE starting point (the beginning of the section), and potentially hundreds of 'ending' points to that section. For now, I'll just says 'dozens' of ending points... but eventually it will be many more. Each part of the section requiring the previous page to access it (maintaining sequence). If this effect can be done without the need for multiple pages, that might be good... as there will likely be hundreds/thousands of them when I'm done. That seems like a bit much... but sometimes one page will only have a small bit of information in it, and nothing else before the next choices are presented. But then again, I'm not sure which would be worse/take longer, having thousands of pages or thousands of database entries I need to figure out how to link up with and where. Does this make sense? I'm trying to figure out a good place to START making this happen... have any of you done anything like this before? Thanks for any help you can be... Hi I have been getting to know PHP OOP concepts, and I started trying by writing a class and handful of functions to connect to the database and retrieve the information from the tables. I went through previous posts having similar titles, but most of them have written using mysql functions and I am using mysqli functions. I want somebody to through this simple script and let me know where the mistake is. This is my class.connect.php: Code: [Select] <?php class mySQL{ var $host; var $username; var $password; var $database; public $dbc; public function connect($set_host, $set_username, $set_password, $set_database) { $this->host = $set_host; $this->username = $set_username; $this->password = $set_password; $this->database = $set_database; $this->dbc = mysqli_connect($this->host, $this->username, $this->password, $this->database) or die('Error connecting to DB'); } public function query($sql) { return mysqli_query($this->dbc, $sql) or or die('Error:'.mysqli_error($this->dbc).', query: '.$sql); } public function fetch($sql) { $array = mysqli_fetch_array($this->query($sql)); return $array; } public function close() { return mysqli_close($this->dbc); } } ?> This is my index.php: Code: [Select] <?php require_once ("class.connect.php"); $connection = new mySQL(); $connection->connect('localhost', 'myDB', 'joker', 'names_list'); $myquery = "SELECT * FROM list"; $query = $connection->query($myquery); while($array = $connection->fetch($query)) { echo $array['first_name'] . '<br />'; echo $array['last_name'] . '<br />'; } $connection->close(); ?> I am getting a error message "Error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1, query: 1" Any idea why this is happening? Thanks Dear Friends. Just now I tried to create PHP to make Rest API for my mobile application and I would like to know that it's good coding and need any improve? it is my first time for Rest API. normally I just connect to PHP file directly on .htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([0-9A-Za-z_]+)$ function.php?func=$1 [L,QSA] RewriteRule ^([0-9A-Za-z_]+)/$ function.php?func=$1 [L,QSA] on function.php $func = $_GET['func']; switch( $func) { case 'lab_info': //ໜ້າຫຼັກ define( '_FUNC', 'lab_info.php'); break; case 'customer_info': //ຂໍ້ມູນຜູ້ໃຊ້ define( '_FUNC', 'customer_info.php'); break; default: // No function define( '_FUNC', 'functionnotfound.php'); break; } if( defined( '_FUNC') && constant( '_FUNC') !='') require( "func/" . _FUNC); on customer_info.php $error = array(); if(isset($_POST['user']) != 'lung'){ $error['status'] = "422"; $error['title'] = "Authentication Fail"; $error['detail'] = "Invalid user authentication"; echo json_encode($error);die(); } if(!isset($_POST['user'])){ $error['status'] = "401"; $error['title'] = "Invalid Attribute"; $error['detail'] = "Invalid Attribute For Information"; echo json_encode($error);die(); } $result = $conn->query("select Lab_Name,Lab_Username,Lab_Password from tb_labmanagers"); $customer = array(); while($row =mysqli_fetch_assoc($result)) { $customer[] = $row; } echo json_encode($customer); this image attached file is result from postman, client need to send user = 'lung' to get information
This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=353345.0 can abybody tell where to write php code & sql statements in Xampp Hi, i had today problem with my script. Everything worked well on my localhost(xampp server) and when i uploaded on dedi machine functions with MySQL database stoped working. Problem was with mysql_real_escape_string and i forgot that i must first open connection and then mysql_real_escape_string... But strange thing is that on xampp server i dont need to open connection for mysql_real_escape_string, and everything worked well... is there any solutio to php scripts on xampp worke same as php script on linux apache server? Please help. I am running xampp for windows - it contains apache, ssl, php, mysql. I am unable to generate a key/cert via php even though everything is apparently set up and running correctly. I ran a script and it said the following Quote Warning: openssl_csr_sign() [function.openssl-csr-sign]: cannot get CSR from parameter 1 in C:\xampp\htdocs\cert.php on line 31 Warning: openssl_csr_export() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\cert.php on line 40 Warning: openssl_x509_export() [function.openssl-x509-export]: cannot get cert from parameter 1 in C:\xampp\htdocs\cert.php on line 41 Warning: openssl_pkey_export() [function.openssl-pkey-export]: cannot get key from parameter 1 in C:\xampp\htdocs\cert.php on line 42 error:02001003:system library:fopen:No such process error:2006D080:BIO routines:BIO_new_file:no such file error:0E064002:configuration file routines:CONF_load:system lib error:02001003:system library:fopen:No such process error:2006D080:BIO routines:BIO_new_file:no such file error:0E064002:configuration file routines:CONF_load:system lib error:02001003:system library:fopen:No such process error:2006D080:BIO routines:BIO_new_file:no such file error:0E064002:configuration file routines:CONF_load:system lib error:02001003:system library:fopen:No such process error:2006D080:BIO routines:BIO_new_file:no such file error:0E064002:configuration file routines:CONF_load:system lib cert.php <?php $configargs = array( 'config' => '../apache/bin/openssl.cnf', 'digest_alg' => 'md5', 'x509_extensions' => 'v3_ca', 'req_extensions' => 'v3_req', 'private_key_bits' => 666, 'private_key_type' => OPENSSL_KEYTYPE_RSA, 'encrypt_key' => false, ); $dn = array( "countryName" => "IE", "stateOrProvinceName" => "cork", "localityName" => "cork", "organizationName" => "org", "organizationalUnitName" => "Organizational Unit Name", "commonName" => "example.com", "emailAddress" => "Email Address" ); // Generate a new private (and public) key pair $privkey = openssl_pkey_new($configargs); // Generate a certificate signing request $csr = openssl_csr_new($dn, $privkey); // You will usually want to create a self-signed certificate at this // point until your CA fulfills your request. // This creates a self-signed cert that is valid for 365 days $sscert = openssl_csr_sign($csr, null, $privkey, 365); // Now you will want to preserve your private key, CSR and self-signed // cert so that they can be installed into your web server, mail server // or mail client (depending on the intended use of the certificate). // This example shows how to get those things into variables, but you // can also store them directly into files. // Typically, you will send the CSR on to your CA who will then issue // you with the "real" certificate. openssl_csr_export($csr, $csrout) and var_dump($csrout); openssl_x509_export($sscert, $certout) and var_dump($certout); openssl_pkey_export($privkey, $pkeyout, "mypassword") and var_dump($pkeyout); // Show any errors that occurred here while (($e = openssl_error_string()) !== false) { echo $e . "\n"; } ?> Hey guys! I am using xampp 1.7.7 usb edition for my php server and I am trying to include a php file that's different from where I have all my php files at. I have them in: \xampp\htdocs\xampp\RecipeSite. Is there a certain path I should use instead of <?php include('/xampp/splash.php'); ?> to allow for xampp to pick up my file? I appreciate your solutions guys. I have a Xampp Timezone Error Error Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for '-5.0/no DST' instead in C:\Users\cory j\Desktop\xampp\htdocs\NoXIp\Toplist\inc\vote.php on line 56 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' NOW())' at line 1 Line 56 $diffrence = time() - strtotime($getDate['lastVoteDate']); The Date Function in Php.ini [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = "America/New_York" date.timezone = "America/New_York" ; http://php.net/date.default-latitude ;date.default_latitude = 31.7667 ; http://php.net/date.default-longitude ;date.default_longitude = 35.2333 ; http://php.net/date.sunrise-zenith ;date.sunrise_zenith = 90.583333 ; http://php.net/date.sunset-zenith ;date.sunset_zenith = 90.583333 |