PHP - Platform/versions Migration Problem
Any pointers would be much appreciated.
I got my PHP app working (not without some great help from this forum) but when I migrated my PHP scripts and MySQL database to my ISP's platform the app fell apart since the web is the destination for this app, I then had to diagnose and fix what happened. The problem: On the ISP's platform, a query string passed unescaped with say a QUOTE in it came in on the subsequent GET ESCAPED. On my platform they arrived UNESCAPED. Is this a php.ini discrepancy or a version discrepancy between us please? Thing is I'd like to get the local version working again after all the changes because what worked on one broke on the other, now the other is fixed the one is broken if you get my drift. Platform / Version variations: Local implementation is Win7, Apache 2.2.19 / PHP 5.3.6 / MySQL 5.5 ISP is Linux not sure of the Apache version believe it is 2.? PHP 5.2.14 / MySQL Client Api 4.1.22 Any input or links for reading would be appreciated. Jamie Similar TutorialsI am working on a migration project; i am not an expert in PHP though ! I have a class and an object of the class is used to display the values in the form controls and on submit of the form the object is updated with new values from the form and then a method in the class is invoked which performs the update query. $field=$this -> $this_field; The above code works perfect in PHP 4 but after moving the new machine with PHP 5 it doesnot update. Any help would be greatly appreciated. I am in the process of creating a web page form and related scripts that will take a file (or listing of files) posted in a form and enter the data into a database and then use rsync to move from a staging web server to a production web server. With the current form i have written i am able to do a single file and i am able to handle an entire directory (basically because there is only a single row of data extracted from and inserted into the database that rsync then reads and moves. So, my problem is the form page and related insert into the database. I am not sure what i need to do in the form to be able to allow a developer or qa person to drop a listing of files into it, and have that then get extracted and inserted as individual rows into the database. Does anyone have any thoughts on a good way to do this? Basically taking this snippet <form method="post" action="<?php echo $PHP_SELF;?>"> File Name:<input type="text" size="12" maxlength="12" name="name"><br /> File to Sync:<input type="text" size="12" maxlength="255" name="dir_path"><br /> <br /> <input type="submit" value="submit" name="submit"> </form> and re-working it to handle a listing of fully pathed files and then insert that into the db, which is done currently by this snippet $conn=mysql_connect (DB_HOST, DB_USER, DB_PASS) or die(mysql_error($conn)); mysql_select_db(DB_NAME); $sql="INSERT INTO fsfiles (name, dir_path) VALUES ('$_POST[name]','$_POST[dir_path]')"; if (!mysql_query($sql,$conn)) { die('Error: ' . mysql_error()); } echo "File: ".$name." added for sync<br />"; mysql_close($conn); Any help would be GREATLY appreciated. Thank you in advance Hi, Having completed a site migration this am everything went well aside from issues with logging into and out of our site where two files are used and appear as white pages. When logging into our site, proc_login.php is used and when logging out proc_logout.php is used. Both processes result in a white "blank" page instead of the php files forwarding on. I've no idea about php generally and have been trying my best to find useful and similar information online to attempt to resolve the problem. I am now stuck. The site works perfectly on my local web server, and what is really baffling me is the site also works perfectly on Domain B on the exact same server I'm trying to get the site running under as Domain A. In other words as both Domain A & B are configured on the same host server I'm thinking all the inherited php/apache/mysql settings should be identical (or pretty much thereabouts) and therefore am more confused than ever! I simply don't know where to start therefore in resolving this problem. I've tried looking in the error log file and have also played around with turning on error enabling on those specific php files to try and follow any errors, however the "errors" generated are no different than the ones present on sites where the login/logout process works just fine. I've hopefully attached both files and if anyone could assist in helping me narrow down my search for a solution I'd be very appreciative. Thanks. About the project.
We are looking to build a Car Dealer Platform (CMS) to be able to offer it as a “Software as a Service” to range of our clients. What we would like to achieve is something similar to what is currently available on the market. I did a little research and the are a lot of scripts, plugins, software and such already available online (i.e. http://www.hotscripts.com/category/scripts/php/scripts-programs/classified-ads/autos/, http://www.worksforweb.com/classifieds-software/iAuto/, http://intersofts.com/) however, we require some functionality that are not included in the above mentioned and we want this to be a bespoke platform tailored for us.
The platform must have:
ability to accommodate Comcar data (http://comcar.co.uk/)
ability to accommodate Cap data (http://www.cap.co.uk/)
ability to accommodate finance calculator (i.e. https://ivendi.com/)
ability to accept stock feeds from Dealership Management System (i.e. http://www.2ndbyte.com/)
ability to send used car stock feed to used car portals such as AutoTrader (http://www.autotrader.co.uk/), Motors (http://www.motors.co.uk/), AA Cars (http://www.vcars.co.uk/)
full registration lookup on used car stock through a Vehicle Registration Mark (http://business.cap.co.uk/products-and-services/vrm-look)
Service and MOT booking to include registration lookup
easily add multi locations and assign stock for each location
capture leads via contact forms
of course must be responsive, SEO friendly and compliant with the latest web standards
easy to add new pages, locations, franchise
easy to upload the offer banners for the home page
easy to customize for each client / dealer (CSS, HTML, JS)
I am fully aware this is not a small project and it will take a lot of time and manpower to accomplish this, however I am positive about it. This would be developed in stages so we could start offering it to our clients with ideally long time support from the creators of the platform.
Here are some examples of platforms currently available on the market and few websites created based on these platforms:
NetDirector - http://www.gforces.co.uk/
http://www.hrowen.co.uk/
http://www.thurlownunn.co.uk/
http://www.deswinks.com/
http://www.glynhopkin.com/
http://www.trustford.co.uk/
http://www.westlandsmotorgroup.co.uk/ (as two franchises and uses latest version of platform)
Web21st - http://www.web21st.com/
http://www.wjking.co.uk/
http://www.sussexusedcars.uk.com/
http://www.wilsonandco.com/
http://www.findvauxhall.co.uk/
Bluesky Interactive - http://www.blueskyinteractive.co.uk/ - Cognition CMS based (http://www.blueskyinteractive.co.uk/admin/)
http://www.fish-bros.co.uk/
http://www.nowvauxhall.co.uk/
http://www.alandayvw.co.uk/
http://dinnages.co.uk/
http://griffinmill.co.uk/
Denison Automotive - http://www.denison.co.uk/automotive/
http://www.perrys.co.uk/
http://www.trusteddealers.co.uk/
http://www.westwaynissan.co.uk/
http://www.tilsungroup.com/
Please feel free to PM me anything related to the topic and ask questions if something is unclear as well as if you require more info.
What I am hoping to achieve by posting this here is to get some advice from experienced / senior php developers to point us in the right direction and hopefully to start a partnership.
We are based in North London.
Thank you.
Alek
php74 is installed as my primary php, but I am also working with a different framework that can only use php73 and set up a separate pool to deal with it. Recently, my installed composer1 told me I should upgrade to composer2 and I did so, but then found that the previously mentioned other framework also doesn't work with composer2 but only composer1. When updating a package with composer, sometimes I get composer errors or even worse no composer errors but PHP errors later on where classes don't exist, and I think it relates to using the wrong version of PHP (and maybe even composer). Is it always required to consistently use composer with a single version of PHP? Anything to worry about different versions of composer or will I just get a message. Any other best practices? Any issues how I set up composer below? Thanks! curl -sS https://getcomposer.org/installer | php # or if desired, use resulting composer.phar as: $ php (or php73) composer.phar update/install/etc chmod +x composer.phar sudo mv composer.phar /usr/local/bin/composer sudo ln -s /usr/local/bin/composer /usr/local/bin/composer2 curl -sS https://getcomposer.org/installer | php73 chmod +x composer.phar sudo mv composer.phar /usr/local/bin/composer2_73 php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php --version=1.10.19 chmod +x composer.phar sudo mv composer.phar /usr/local/bin/composer1 php73 composer-setup.php --version=1.10.19 chmod +x composer.phar sudo mv composer.phar /usr/local/bin/composer1_73 rm composer-setup.php
The following script comes from create a decorator example. Please take a look at __construct() and $pathItem. Doesn't look like any PHP I've ever seen. Agree? I don't think it matters and just stating so to make sure, but I am not using a docket but have api-platform on the local server. I've gotten all to work until now. <?php // api/src/OpenApi/JwtDecorator.php declare(strict_types=1); namespace App\OpenApi; use ApiPlatform\Core\OpenApi\Factory\OpenApiFactoryInterface; use ApiPlatform\Core\OpenApi\OpenApi; use ApiPlatform\Core\OpenApi\Model; final class JwtDecorator implements OpenApiFactoryInterface { public function __construct( private OpenApiFactoryInterface $decorated ) {} public function __invoke(array $context = []): OpenApi { $openApi = ($this->decorated)($context); $schemas = $openApi->getComponents()->getSchemas(); $schemas['Token'] = new ArrayObject([ 'type' => 'object', 'properties' => [ 'token' => [ 'type' => 'string', 'readOnly' => true, ], ], ]); $schemas['Credentials'] = new ArrayObject([ 'type' => 'object', 'properties' => [ 'email' => [ 'type' => 'string', 'example' => 'johndoe@example.com', ], 'password' => [ 'type' => 'string', 'example' => 'apassword', ], ], ]); $pathItem = new Model\PathItem( ref: 'JWT Token', post: new Model\Operation( operationId: 'postCredentialsItem', responses: [ '200' => [ 'description' => 'Get JWT token', 'content' => [ 'application/json' => [ 'schema' => [ '$ref' => '#/components/schemas/Token', ], ], ], ], ], summary: 'Get JWT token to login.', requestBody: new Model\RequestBody( description: 'Generate new JWT Token', content: new ArrayObject([ 'application/json' => [ 'schema' => [ '$ref' => '#/components/schemas/Credentials', ], ], ]), ), ), ); $openApi->getPaths()->addPath('/authentication_token', $pathItem); return $openApi; } } I am thinking that maybe the constructor needs to be changed to: private $decorated; public function __construct(OpenApiFactoryInterface $decorated) { $this->decorated = $decorated; } Regarding $pathItem, Model\PathItem's constructor is as follows. Any thoughts on what they are suggesting? Thanks public function __construct( string $ref = null, string $summary = null, string $description = null, Operation $get = null, Operation $put = null, Operation $post = null, Operation $delete = null, Operation $options = null, Operation $head = null, Operation $patch = null, Operation $trace = null, ?array $servers = null, array $parameters = [] ) {/* ... */}
Edited January 28 by NotionCommotion Not using docket Hi, I'm currently coding a script, where I would like to post news & versions changes etc into my client's portal. So my client install the script, they login to the admin area, and they see messages from me, optionally if there's a new version available. I was thinking about doing this with cUrl, and just have a page that display my news, and then call it from the client portal, not sure about it though. What would you guys suggest? i want the code for review approval platform (costumer reviews for a product )and in backend editing the code and updating it Ran the following but got a segfault as it doesn't seem to support php7.4. ./vendor/bin/concrete5 c5:install -i So I changed ./vendor/bin/concrete5 from: #!/usr/bin/env php <?php ... to #!/usr/bin/env php72 <?php ... I am sure I will forget I did this and would rather configure either the directory or the user to use php72. Is this possible? Also, should I be making any other changes? For instance, maybe: "config": {"platform": {"php": "7.2.30"}} Thanks Guys thanks for helping me solve the problem i had but now i have another problem and i am lost. i have included the code below for you to have overview.
This is the code:
<table style="width:100%; margin-left:auto; margin-right:auto"> Hello everyone Just found this forum and really need some help. I'm trying to create a popup contact form for my product pages. I managed to get a php form from a random site and i cant get the form to pop up. http://www.e-sol.co.uk/printer-scanner-copier.php If someone could help i would be very grateful. The problem is whit the var $threadid . It dosent work here(it dosen't display the data from database): $dbh = "SELECT *FROM comments WHERE threadid = '".$threadid."' "; But if I assign a value before the that code the html page show correctly. Code: [Select] include("config.php"); $name = $_POST['name']; $comment = $_POST['comment']; $threadid = $_POST['threadid']; if($name & $comment) { $dbh="INSERT INTO comments (name,comment,threadid) VALUES ('$name','$comment','$threadid') "; mysql_query($dbh); } $dbh = "SELECT *FROM comments WHERE threadid = '".$threadid."' "; $req = mysql_query($dbh); while($row=mysql_fetch_array($req)) { echo "<li>"; echo "<br>"."<b>".$row['name']."</b></br>"."<br>".$row['comment']."</br>"; echo "</li>"; } Code: [Select] $('.submit').click(function(){ location.reload(); var name = $("#name").val(); var comment = $("#comment").val(); var threadid = $("#v").val(); var dat = 'name='+name+'&comment='+comment+'&threadid='+threadid; $.ajax({ type:"post", url:"comment.php", data:dat, success:function(){ console.log("dat"); } }); return false; }); I am trying to use the following code snippet to return values from a database with a "," after each value apart form the last one. At the moment for testing I have 2 rows with values 1 and 3 $totalRows_Recordset3 equals 2 (I echoed this to check) $i=1; while($row_Recordset3 = mysql_fetch_assoc($Recordset3)) { if($i < $totalRows_Recordset3) { $str = $str.$row_Recordset3['reading'].","; $i=$i+1; } else { $str = $str.$row_Recordset3['reading']; $i=$i+1; } } I get the number 3 which is the last value in the database, but I can't see why I don't get "1,3" I am sure it is something simple but it just escapes me. Thanks in advance for any help Gordon Hi. I am from poland. I am 17 old age and like webmastering. I write my social network. I have new server 10 GB VPS and my script no runing In my server. in my server do can not login. No runing function Code: [Select] mb_strtolower();as delete function mb_strtolower() ; this login runing. In my server haven`t installing liberary GD and no runing upload avatars. my code upload is: elseif ($_GET['act'] == "upload") { echo <<< KONIEC <hr> <center> <p> <h2>Dodaj zdjęcie</h2> <ul class="gallery clearfix"> <li class="extra"> KONIEC; error_reporting(E_ALL); // we first include the upload class, as we will need it here to deal with the uploaded file include('include/class.upload.php'); // retrieve eventual CLI parameters $cli = (isset($argc) && $argc > 1); if ($cli) { if (isset($argv[1])) $_GET['file'] = $argv[1]; if (isset($argv[2])) $_GET['dir'] = $argv[2]; if (isset($argv[3])) $_GET['pics'] = $argv[3]; } // set variables $dir_dest = (isset($_GET['dir']) ? $_GET['dir'] : 'test'); $dir_pics = (isset($_GET['pics']) ? $_GET['pics'] : $dir_dest); if (!$cli) { } // we have three forms on the test page, so we redirect accordingly if ((isset($_POST['action']) ? $_POST['action'] : (isset($_GET['action']) ? $_GET['action'] : '')) == 'simple') { // ---------- SIMPLE UPLOAD ---------- // we create an instance of the class, giving as argument the PHP object // corresponding to the file field from the form // All the uploads are accessible from the PHP object $_FILES $handle = new Upload($_FILES['my_field']); // then we check if the file has been uploaded properly // in its *temporary* location in the server (often, it is /tmp) if ($handle->uploaded) { // yes, the file is on the server // now, we start the upload 'process'. That is, to copy the uploaded file // from its temporary location to the wanted location // It could be something like $handle->Process('/home/www/my_uploads/'); $handle->Process($dir_dest); function TestProcess(&$handle, $title = 'test', $details='') { global $dir_pics, $dir_dest; $unlink = 'test/'. $handle->file_dst_name; $myid = $_SESSION['id']; $opis = htmlspecialchars(stripslashes(strip_tags(trim($_POST["opis"]))), ENT_QUOTES); $handle->Process($dir_dest); if ($handle->processed) { unlink("$unlink"); $link = ''.$dir_pics.'/' . $handle->file_dst_name .''; $addphoto = mysql_query("INSERT INTO photo VALUES('', '$myid', '$link', '$opis')"); echo <<< KONIEC <br> <center> <img src="$link" > <br> <br /> </center> KONIEC; } else { echo '<fieldset class="classuploadphp">'; echo ' <legend>' . $title . '</legend>'; echo ' Error: ' . $handle->error . ''; if ($details) echo ' <pre class="code php">' . htmlentities($details) . '</pre>'; echo '</fieldset>'; } } if (!file_exists($dir_dest)) mkdir($dir_dest); // ----------- $handle->image_convert = 'jpg'; $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_x = 500; $handle->image_precrop = 15; $handle->image_watermark = "watermark_large.png"; $handle->image_watermark_x = 20; $handle->image_watermark_y = -20; TestProcess($handle, '15px pre-cropping (before resizing 800 wide), large watermark automatically reduced, position 20 -20', "\$foo->image_convert = 'jpg';\n\$foo->image_resize = true;\n\$foo->image_ratio_y = true;\n\$foo->image_x = 800;\n\$foo->image_precrop = 15;\n\$foo->image_watermark = 'watermark_large.png';\n\$foo->image_watermark_x = 20;\n\$foo->image_watermark_y = -20;"); } else { // one error occured echo '<fieldset>'; echo ' <legend>file not uploaded to the wanted location</legend>'; echo ' Error: ' . $handle->error . ''; echo '</fieldset>'; } // we copy the file a second time // we delete the temporary files $handle-> Clean(); } else { // if we are here, the local file failed for some reasons echo '<fieldset>'; echo ' <legend>local file error</legend>'; echo ' Error: ' . $handle->error . ''; echo '</fieldset>'; } echo <<< KONIEC <li> </ul> </p> </center> KONIEC; is it the only problem that isn`t installing GD as i have something off in php.ini ? Plise Help me Hi, im creating a script for a website that will list products, i have the basic construct which lists the products from the database but it lists then vertically, i have set the width of each 'product' to 200px so i could have around 3 colums and many rows. can anybody advise how i would make them run vertically aswell as horizontally? my code below: <?php include_once("include/globals.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link href="styles/stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main"> <?php //Get database Results $result = mysql_query("SELECT * FROM Products WHERE is_active = 1") or die(mysql_error()); //keeps getting the next row until no more records while($row = mysql_fetch_array($result)) { //echo results ($result) echo '<div id="holder">'; echo '<div class="title">' . $row['Name'] . '</div>'; //insert image here echo '<div class="image">'; echo '<img src="' . $row['image'] . '" width="100" alt="">'; echo '</div>'; echo '<div class="tag_line">'; echo $row['Tag_Line']; echo '</div>'; echo '<div class="price">Now Only: £'; echo $row['Website_Price']; echo '</div>'; echo '<div class="prod-footer"></div>'; echo '</div>'; } ?> </div> </body> </html> table structu Field Type Null Default Comments MIME ID int(11) No product_code varchar(255) No Name varchar(255) Yes NULL Tag_Line varchar(255) Yes NULL Description varchar(255) Yes NULL Specification varchar(255) Yes NULL Technical_Info varchar(255) Yes NULL Cost_Price_USD decimal(10,2) Yes NULL Cost_Price_GBP decimal(10,2) Yes NULL Built_in_delivery decimal(10,2) Yes NULL Trade_Price decimal(10,2) Yes NULL Trade_Plus_Price decimal(10,2) Yes NULL Website_Price decimal(10,2) Yes NULL Is_active int(1) No image varchar(255) Yes NULL i'm getting this erro "Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /***/***/*****.php on line 278 not an active session, starts new" this is the code: if ($phase = mysql_result(mysql_query("SELECT `phase` FROM `as_support` WHERE `mission` = '$var2'"),0,0)) { if ($phase=='5') { // mysql_query("DELETE FROM `as_support` WHERE `mission` = '$var2'"); // header("Location: https://www.**********/*******/*******.php"); } else { echo date('h:i:s') . ": PHASE is $phase<br />"; echo "\$var1=$var1,\$var2=$var2<br />"; } } else { echo "not an active session, starts new<br />"; echo "\$var1=$var1,\$var2=$var2<br />"; mysql_query("INSERT INTO `as_support` (`mission`, `phase`) VALUES ('$var2', '0')") OR DIE(mysql_error()); the first line is line no. 278 can someone please tell me what to do? tnx shirley I have a simple text file called bio.txt: Code: [Select] wohlersr; Richie Wohlers; Intermediate; Four Aces meyersg; Greg Meyers; Novice; Four Aces I wrote a little script, to return the info for Greg Meyers if the user id is correct, or say "Member not found" if incorrect. For some reason, my output is giving me both. I assume it's a context error, but can't figure it out. Here's my script: Code: [Select] <?php $file=file("bio.txt"); $count=count($file); $i=0; while($i<=$count) { $row = explode(";", $file[$i]); $id = $row[0]; $name = $row[1]; $class = $row[2]; $club = $row[3]; if($id=="meyersg"){ echo $name."</br>"; echo $class."</br>"; echo $club."</br>"; }else{ echo "Member not found."; } $i++; } ?> And here's the output I'm getting: Code: [Select] Member not found. Greg Meyers Novice Four Aces Member not found. Hi, i use mysql_real_escape_string() function when insert in db, but when echo i use htmlentities($var, ENT_QUOTES, "UTF-8") Now problem is '\ in that text. In db it write text with single quote with \, example That\'s wrong, and when echo it show just the same like in db.. How can i fix this ? Elo, I'm creating a very simple image list that is function generated which pulls the source from a table in my database, this is my code Code: [Select] $output = "<ul>"; $img_src = get_all_image_src($sel_event['id']); while($src = mysql_fetch_array($img_src)) { for($i=0;$i <= 9; $i++) { $output .= "<li>"; $output .= "<a"; $output .= " class ='album'"; $output .= " rel='group'"; $output .= " href='/images/gallery/'" . $src['img_src'] . $i; $output .= ".jpg"; $output .= " title='sample 1'"; $output .= ">"; //Image Thumb $output .= "<img"; $output .= " src='/images/gallery/'"; $output .= $src['img_thumb_src']. $i . ".jpg"; $output .= "alt='image01' "; $output .= "title='sample title' />"; $output .= "tae"; $output .= "</a>"; $output .= "</li>"; } } $output .= "</ul>"; return $output; and the img src doesnt seems to add up... my folder structure is Sandbox>image>gallery>2011>Mall>Event>Thumbs where Sandbox is the main directory. i tried echoing the $src['img_src'] and it displays correctly the data to be added (which is 2011/Mall/Event/ plus $i and a .jpg) .. sorry noob here... any thoughts? am i missing a simple detail? |