[Solved] parse and sort links [closed]

[ad_1] You can do it just by extracting the domain and using it as index for an array with the encrypted values, like so: $url=$_POST[‘url’]; $url=nl2br($url); $url=explode(“<br />”,$url); $urls = array(); foreach ($url as $value ){ $arr = explode(‘www.’,$value); $encrypt = md5($value); $urls[$arr[1]][]= $encrypt; //this line now fixed, had an error } foreach($urls as $key … Read more

[Solved] How to Add last column in mysql table

[ad_1] Given the code you’ve posted, here’s how I’d handle this. First, I’d create an associative lookup array whose keys are the column names and whose values are the corresponding point values; it would look something like this: $pointVals = array(’email1′ => 2, ’email2′ => 5, ’email3′ => 2, … ); You can generate this … Read more

[Solved] get first element of an array

[ad_1] If you want the first element of an array, you should use reset. This function sets the pointer to the first element and returns it. $firstValue = reset($value[‘record’][‘records’]); Edit.. after reading your question again, it seems, you dont want the first element. You rather want this if (isset($value[‘record’][‘records’][0]) && is_array($value[‘record’][‘records’][0])) { // multiple return … Read more

[Solved] Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in [duplicate]

[ad_1] mysql_real_escape_string() needs an active connection to the MySQL server and will initiate one with the default data from the php.ini configuration if there is none. Do not use this function without first connecting to the database. Also, do not use the mysql_* functions. They are deprecated and will be removed from PHP. 2 [ad_2] … Read more

[Solved] .php file on website, source in html [closed]

[ad_1] It would be a horrendous security hole if you could view source and see the underlying PHP code – you’d see database credentials, trade secrets, etc. PHP is a server-side language. It gets executed on the server, usually to build HTML that then gets output to the browser. [ad_2] solved .php file on website, … Read more

[Solved] php login verification [closed]

[ad_1] What you propose here does not prevent the user from accessing the ‘member’ pages – however it should determine which page the user is sent to after submitting a password. If the latter is not the case then there’s something going wrong elsewhere in the code. But as I mentioned, if you want to … Read more

[Solved] php syntax errors on simple sendmail code [closed]

[ad_1] Change the code to if(isset($_POST[‘submit’])) { $msg = ‘Name: ‘ .$_POST[‘FirstName’] .$_POST[‘LastName’] .”\n” .’Email: ‘ .$_POST[‘Email’] .”\n” .’Message: ‘ .$_POST[‘Message’]; mail(’[email protected]’, ‘Message from website’, $msg); header(‘location: contact-thank-you.php’); } else { header(‘location: contact.php’); exit(0); } You need to have { and } instead of ( & ) 1 [ad_2] solved php syntax errors on simple … Read more

[Solved] php get the first part of postcode

[ad_1] This will not cover 100% of all possible UK postcodes, but will do for like 99.999% or so 🙂 /** * @param string $postcode UK Postcode * @return string */ function getUKPostcodeFirstPart($postcode) { // validate input parameters $postcode = strtoupper($postcode); // UK mainland / Channel Islands (simplified version, since we do not require to … Read more