PHP - Php Version Question
This may sound like a really stupid question, but this is really bugging me.
If i code something in PHP 5.5.11 and upload it to a server that is running PHP 5.4, would the code work correctly? I didnt think there was a super amount of difference between the two versions. Perhaps im wrong.
The reason i asked is because someone has given me a project to help them with. Im running php 5.5.11. I coded it, tested in in xampp, working great. I upload it to his website, which he told me is currently running 5.4 (i tried phpinfo() but they have disabled it) and a majority of the functions i coded are no longer working. Things are not writing to the database, things collected from the database either dont show up on the website or they only show up when something gets posted after it, in which case the something posted after it doesnt show e.c.t.
Is the difference that much it can break code?
Thanks!
Similar TutorialsHi all, But of a PHP newbie so treat me nice but this one is driving me nuts I have the exact same login.php file running on two different servers and they have slightly different versions of PHP installed as follows: 1. PHP Version 5.0.4 - version http://www.trafficpaymaster.com/tpm/phpversion.php 2. PHP Version 5.2.15 - version http://www.dentistsinflorida.org/tpm/phpversion.php The login works fine on the first server from he http://www.trafficpaymaster.com/tpm/login.php Email: test@test.com Pwd: test But try it on the second server he http://www.dentistsinflorida.org/tpm/login.php Using the same email and password (which is correct) it just loops round not letting the user into the main script at index.php Question: Why? What have I got wrong for that later version of PHP? Many thanks guys. Hi all,
is it possible to install php version 5.2.3 on windows server 2012R2 ?
will it work ? are they any security issues ?
Best regards,
Amit menasahe
HI, I've upgraded from PHP version 5.2 to PHP version 5.4 and are not able to load / find mssql extension ? How do I use MSSQL in version 5.4 ?? Is MSSQL not supported in this version or am I (hopingly) missing something ??? Regards Dieter I have a part of my code that requires php 5.3+ how can I test to see if the user has 5.3 or greater? At first I thought this would be a good idea, but then I realized that it isn't such as a version: 5.2.10 (not sure if that is an actual version or not). if((int)preg_replace("/\./", "", phpversion()) >= 530){ // Allow functionality } using my code, using 5.2.10 it would allow it, but it shouldn't because it isn't larger than 5.3. what can I do? PHP Version : 5.3.28 is this outdated or what?
i run this on the server - which is configured and administered by a friend of me.
i run a wordpress-cms
and i have issues with the image upload.
all image uploads in the connections-plugin run in to a blank page
what can i do !?
i need your help and your ideas
love to hear from you
greetings
"I'm also running a forked version of php, that has many custom additions and modifications that I added to it, which helps keep everything running as fast as it does" what does saying u have a "forked" version of php and makes your site run super fast, wats this mean? What exactly can u edit in your php config to make it faster? I thought only php accelerators do that? lol Can anyone tell me how I can find out which version of sqlsrv that I need to load to work with my IIS server and MSSQL server?
After being forced to have the server upgraded I am having problems with my 'reset password' pages. What I wondered is, has there been any changes to PHP or MySQL between these versions ? The PHP version was 5.2.9 and is now 5.2.14 The MySQL version was Client API version 5.0.45 and is now Client API version 5.0.90 Some one clicks a link like this. www.site.com/resetpw.php?pwr=a1b2c3d4e5f6 the code would be a 32 char hash that is checked against the database, but my code now (which was never changed before or after the server change) seems to find the database line and update it but show the message that it was invalid ? instead of showing the the message, your password will be sent to you after changing the DB does anyone have any ideas ? Code: [Select] <?php include('includes/connection.php'); include('includes/functions.php'); date_default_timezone_set('Europe/London'); if(isset($_POST['reset']) && trim($_POST['reset']) == 'Reset') { $email = mysql_real_escape_string($_POST['email']); $checkVerify = mysql_query("SELECT account_id FROM customers WHERE email='$email' AND verified='No' LIMIT 1"); $checkBanned = mysql_query("SELECT account_id FROM customers WHERE email='$email' AND suspended='Yes' LIMIT 1"); if(!$email) { $thisError = 'Please enter your e-mail address.'; } else if(!$password) { $thisError = 'Please enter your password.'; } else if(mysql_num_rows($checkVerify)) { $thisError = 'Your account has not been approved by an Admin.'; } else if(mysql_num_rows($checkBanned)) { $thisError = 'Your account has been suspended by an Admin.'; } else { $password = md5($password); $checkAccount = mysql_query("SELECT account_id FROM customers WHERE email='$email' AND password='$password' LIMIT 1"); if(mysql_num_rows($checkAccount)) { $_SESSION['FM_user'] = $email; header('Location: members.php'); exit; } else { $thisError = 'Your e-mail address and/or password is incorrect.'; } } } include('includes/header.php'); ?> <body> <div class="headerBar"> <?php include('includes/navigation.php');?> </div> <?php headerText(); ?> <div class="content"> <div class="widthLimiter contentStyle"> <div class="formWrapper"> <?php if(isset($thisError)) { echo '<div class="errorDiv">',$thisError,'</div>'; } ?> <?php if(isset($thisSuccess)) { echo '<div class="successDiv">',$thisSuccess,'</div>'; } ?> <span class="subHeader">Initiate Password Reset</span> <?php // include("sendmail2010.php"); $securitycode = ($_GET['pwr']); //echo("53:security:".$securitycode.":<br>"); if ($securitycode != "") { $sql = "SELECT * FROM `customers` WHERE `changeofpasswordcode` = '".mysql_real_escape_string($securitycode)."' LIMIT 1"; //echo("54:sql:".$sql.":<br>"); $res = mysql_query($sql) or die(mysql_error()); //echo("57:<br>"); if (mysql_num_rows($res) != 0) { //echo("59:sql:".$sql.":<br>"); $customerName = mysql_result($res, 0 ,'fullname'); $email = mysql_result($res, 0 ,'email'); $yourpasswordtologin = CreateNewPassword(); $format = 'Y-m-d H:i:s'; $date = date( $format ); $sql = "UPDATE `customers` SET `password` = '" . md5($yourpasswordtologin) . "', `password2` = '" . mysql_real_escape_string($yourpasswordtologin) . "', `changeofpasswordcode` = '', `newpasswordrequestedon` = '" . $date . "' WHERE `changeofpasswordcode` = '" . mysql_real_escape_string($securitycode) . "' LIMIT 1"; //echo("65:sql:".$sql.":<br>"); $res = mysql_query($sql) or die(mysql_error()); $_SESSION['customerName'] = $customerName; $_SESSION['customerEmail'] = $email; $_SESSION['generatePass'] = $yourpasswordtologin; //echo("send email"); $sendemailnow = createEmailSend('newPassword', 'Your new password', 'customer'); //echo("email sent ".$sendemailnow); ?><div style="margin: 30px;">Thank you for completing your password reset process.<br><br>An email with a randomly generated password has been sent to your email address, please check your email account for this email as you will need this password to access your <?=$_SESSION['siteName'];?> account.<br><br><strong><em>Please check your 'spam folder' in case our emails are showing up there.</em></strong><br><br>You may now <a href="<?=$_SESSION['webAddress'];?>">sign in</a> to your account.</div><?php //echo("72:end of IF send email<br>"); } else { //echo("74 bad link<br>"); ?><div style="margin: 20px;">Sorry the link you clicked is and old password reset link or is not valid, please delete the email.<br><br>If you were trying to reset your password, please click the<br>'Member Login' link on our site and then click the 'Reset Password' link.</div><?php //echo("end of IF bad<br>"); } //echo("78:end of first IF<br>"); } ?> </div> </div> </div> <?php include('includes/footer.php');?> </body> </html> Hi I have used in the past search.php?sl=y on a link to the page, and in the page I would use if($_GET[$sl]=='y'){ Show somw stuff here } This was good in php 5.6, but I'm in the process of upgrading my code to the newer version, and am looking for an updated way to acheive this. Help, pointers examples Thanks in advance.
Paul This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=334005.0 I am trying to implement the new version of captcha on my website.
What i did so far:
Inside the FORM:
echo '<div class="g-recaptcha" data-sitekey="XXXXXXXXXXXXXXXXXXXXXXXXXXXX"></div>';Inside PHP: $recaptcha = $_POST['g-recaptcha-response']; if(!empty($recaptcha)) { $google_url = "https://www.google.com/recaptcha/api/siteverify"; $secret = 'YYYYYYYYYYYYYYYYYYYYYYYYYYY'; $ip = $_SERVER['REMOTE_ADDR']; $url = $google_url."?secret=".$secret."&response=".$recaptcha."&remoteip=".$ip; $res = getCurlData($url); $res = json_decode($res, true); if($res['success'] == 'false') { $captcha_error = "Please re-enter your reCAPTCHA."; } }The getCurlData function: function getCurlData($url) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_TIMEOUT, 10); curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16"); $curlData = curl_exec($curl); curl_close($curl); return $curlData; }What i want to achieve is to know when the no-Captcha box is checked. I want to throw an error to the user if he/she did not check that box. So far i only throw an error if the response from Google is "We are not sure if you are human, please proceed to our second level of verification" [if($res['success'] == 'false')]. PS: most of the code is written by Srinivas Tamada. You can find it here. Thanks in advance. Hi everyone: When I do Classic ASP programming, I use a "Server.Transfer" method to move one page into another on the server, before it is dished out to a viewer's browser. Like this: Code: [Select] Page-1.asp <%@ language=vbscript%> <% server.transfer "Page-2.asp" %> <html> ... </html> Is there a method in PHP that would do this? It's easy in ASP, but I can't find an answer on GOOGLE. Thanks! This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=359402.0 Hey everyone! I'm an absolute beginner with PHP but in my struggle with a project, I keep seeing 'PHP' so here I am, asking for help from the experts. I have a client who wants a basic 'mobile version' of their website to be displayed automatically when people view it on a mobile device (iPhone, Android especially). I've tried a couple of JavaScript solutions but, for some reason, they wouldn't work on Android (despite the author of the code specifying that it 'should do'). This has led me to look into a server-side solution. If the user visits the site, e.g. www.mysite.com on a mobile device, I want it to redirect to the subdomain m.mysite.com (I could even use www.mysite.com/mobile). On this 'mobile version' there should be a link to view the full site (and vice versa). Does anyone know of any tried and tested methods to achieve this? I'm literally pulling my hair out now with this. Thank you so much in advance. Have a great day. Regards Darryl I am not very proficient at MySQL so this came as a shock today. I have moved an entire set of scripts from one machine to another and after ironing out some of the kinks I was hit this error "The used command is not allowed with this MySQL version" and just when I thought it was all over with. LOL
This is the command being run...
load data local infile './AM.dat' into table AM fields terminated by '|';
Hi,
I am trying to connect to a database using mysqli from a web developing software package called Sellerdeck.
This software is purely windows based, it has PHP configured to a certain extent it seems.
I ran the phpinfo(); command and can't find anything to do with MYSQL in the settings of the version.
So i tried to download the php_mysql.dll and libmysql.dll files, I have referenced them in the php.ini file by using
extension_dir="./"
extension=php_mysql.dll
extension=libmysql.dll
(Also best to mention that " extension_dir="./" " was the only line of text in the php.ini file by default)
This didn't seem to make a difference at all, still get the same error.
Is there anything I can try to do? I really can't understand it as php 5 comes with mysql built in, but it seems that Sellerdeck have stripped that usability from the php version!
Any advice appreciated
Edited by engy123, 30 January 2015 - 03:58 AM. Php programmers, I am getting this error: Fatal error: Uncaught mysqli_sql_exception: No index used in query/prepared statement (null) in C:\xampp\htdocs\test\select_adv.php:70 Stack trace: #0 C:\xampp\htdocs\test\select_adv.php(70): mysqli_stmt_execute(Object(mysqli_stmt)) #1 {main} thrown in C:\xampp\htdocs\test\select_adv.php on line 70
Line 70 is:
if(mysqli_stmt_execute($stmt) === FALSE)
Context:
if(mysqli_stmt_prepare($stmt,$query)) { mysqli_stmt_bind_param($stmt,'s',$_SESSION['search_column']); if(mysqli_stmt_execute($stmt) === FALSE) { printf("Error: %s.\n", mysqli_stmt_error($stmt)); printf("Error: %d.\n", mysqli_stmt_errno($stmt)); }
This removes the error:
if($stmt) === FALSE) { printf("Error: %s.\n", mysqli_stmt_error($stmt)); printf("Error: %d.\n", mysqli_stmt_errno($stmt)); }
I still want to know why this works:
if($stmt) === FALSE) {
but this doesn't work:
if(mysqli_stmt_execute($stmt) === FALSE) {
Let me know.
Full Code in case you're wondering just what on earth is going on ....
<?php //include('error_reporting.php'); error_reporting(E_ALL); ini_set('error_reporting',E_ALL);//Same as: error_reporting(E_ALL); ini_set('display_errors','1'); ini_set('display_startup_errors','1'); require('conn.php'); echo __LINE__; ?> <form name = "search" method = "POST" action=""> <label for="keywords">Keywords:*</label> <input type="text" name="keywords" id="keywords" placeholder="Input Keywords" required> <br> <label for="search_column">Search in ... ?</label> <select name="search_column" id="search_column"> <option value="page_url">Page Url</option> <option value="link_anchor_text">Link Anchor Text</option> <option value="page_description">Page Description</option> <option value="keyphrases">Keyphrase</option> <option value="keywords">Keywords</option> </select> <br> <label for="tos_agreement">Agree to TOS or not ? *</label> <select name="tos_agreement" id="tos_agreement" required> <option value="Yes">Yes</option> <option value="No">No</option> </select> <br> <button type="submit">Submit</button><br> <button type="submit" value="submit">Submit</button><br> <input type="submit" value="submit"><br> <button name=submit value=" ">Submit</button><br> <br> <input type="reset"> <br> </form> <?php session_start(); echo __LINE__; if($_SERVER['REQUEST_METHOD'] === 'POST') { echo __LINE__; if(ISSET($_POST['submit'])) { echo __LINE__; if(ISSET($_POST['search_column'])) { $_SESSION['search_column'] = $_POST['search_column']; echo $_SESSION['search_column']; echo __LINE__; } //Re-write the following 4 lines ... mysqli_report(MYSQLI_REPORT_ALL|MYSQLI_REPORT_STRICT); $conn = mysqli_connect("localhost","root","","test"); $conn->set_charset("utf8mb4"); //$query = "SELECT page_url,link_anchor_text,page_description,keyphrases,keywords FROM links WHERE $_SESSION['search_column'] = ?"; $query = "SELECT page_url,link_anchor_text,page_description,keyphrases,keywords FROM links WHERE {$_SESSION['search_column']} = ?"; //$query = "SELECT page_url,link_anchor_text,page_description,keyphrases,keywords FROM links WHERE " . $_SESSION['search_column'] . " = ?"; $stmt = mysqli_stmt_init($conn); if(mysqli_stmt_prepare($stmt,$query)) { mysqli_stmt_bind_param($stmt,'s',$_SESSION['search_column']); if(mysqli_stmt_execute($stmt) === FALSE) { printf("Error: %s.\n", mysqli_stmt_error($stmt)); printf("Error: %d.\n", mysqli_stmt_errno($stmt)); } $result = mysqli_stmt_bind_result($stmt,$page_url,$link_anchor_text,$page_description,$keyphrase,$keywords); mysqli_stmt_fetch($stmt); while(mysqli_stmt_fetch($stmt)) { echo "url"; echo "<br>"; echo "anchor_text"; echo "<br>"; echo "description"; echo "<br>"; echo "keyphrases"; echo "<br>"; echo "keywords"; echo "<br>"; echo "|"; echo "<br>"; } mysqli_stmt_close($stmt); mysqli_close($conn); } else { echo "1. QUERY failed!"; } if(mysqli_stmt_prepare($stmt,$query)) { mysqli_stmt_bind_param($stmt,'sssss',$_POST['page_url'],$_POST['link_anchor_text'],$_POST['page_description'],$_POST['keyphrases'],$_POST['keywords']); if(mysqli_stmt_execute($stmt) === FALSE) { printf("Error: %s.\n", mysqli_stmt_error($stmt)); printf("Error: %d.\n", mysqli_stmt_errno($stmt)); } $result = mysqli_stmt_get_result($stmt); while($row = mysqli_fetch_array($result,MYSQLI_ASSOC)) { $page_url = $row['page_url']; echo $page_url; echo "<br>"; $link_anchor_text = $row['link_anchor_text']; echo $link_anchor_text; echo "<br>"; $page_description = $row['page_description']; echo $page_description; echo "<br>"; $keyphrases = $row['keyphrases']; echo $keyphrases; echo "<br>"; $keywords = $row['keywords']; echo $keywords; echo "<br>"; echo "|"; echo "<br>"; } mysqli_stmt_close($stmt); mysqli_close($conn); } else { die("2. QUERY failed!"); } echo '<pre>' . print_r($_POST, 1) . '</pre>'; echo $_SESSION['search_column']; } } echo __LINE__; ?>
Hi Guys
I'm a bit stuck on a query and hoping someone can help. I'm sure this has a really simple solution.
Below is a simplified representation of a table and I'm trying to select all of the data but where there are instances of the same postID I want to only select the row with the highest version number.
So for instance in a select all on the table below I would expect to get IDs of 2,3 and 4.
id | postID | version I have just upgraded PHP on my ISP server and none of the php scripts work. I was using 5.2. And I am now on 5.4. Why would the scripts stop working? Are there and patches or changes I need to make to make them work? I need an answer urgently! I have a number of PHP helper scripts that are stored outside the root directory of my websites. Those scripts may be used by one or more of my websites. Let's say I have two websites Website A uses PHP 7.0 Website B uses PHP 7.3Will the helper scripts be potentially executed using different versions of PHP? In other words, if Website B calls a helper script using a require statement, does that helper script execute as PHP 7.3? But if Website A calls the script, it would be executed as PHP 7.0. |