PHP - Php4 To Php5 Upgrade Broke Scripts - Not Working Now... :(
I have had a problem with some scripts I wrote (Screenscrapers) that worked great in PHP4, but stopped working the minute I upgraded to PHP5.
I can change all of my filenames to have the .PHP4 extension and this solves the problem, but since this encompasses a number of sites, internal links and hundreds of files, this is not my first choice solution. Here is the scraper, what it does, is it takes items from the zazzle Results Page by category, strips out the formatting, adds my affiliate ID and then I can present these items on my page. <!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=iso-8859-1" /> <title>Test of scrape</title> <link rel="stylesheet" type="text/css" href="/css/scraper.css" /> <script type='text/javascript' src='http://www.zazzle.com/js/logging/omniture/s_code.zjs/r-52.78223/site-zazzle.js'></script> </head> <body> <div class="gridCell " id="page_productsGrid_assetCell1"> <?php $page = file_get_contents("http://www.zazzle.com/cool+smiley+gifts"); //comment out the <span> tags completely $page = preg_replace('/<span/', "<!-- <span", $page); $page = preg_replace('/<\/span>/', "<\/span> -->", $page); $page = preg_replace('/<a /', "<a rel=\"nofollow\" ", $page); $rf_id="238219236805025733"; // Regular expression to parse "&rf=" and the $rf_id into the existing link $page=preg_replace("/(.*?)(href\s*=+\s*[\"\'])(.*?)([\"\'])(.*?)/is","$1$2$3?rf=$rf_id$4$5",$page); $test = explode('<div style="position:relative" class="clearfix">',$page); for($t=1;$t<=count($test)-2;$t++){ print "<div class=\"gridCellInfo\" id=\"page_products\">"; print $test[$t]; } ?> </body> </html> This works find in PHP4; not at all in PHP5. My ideal solution would be an .htaccess file that I could put in any directory under PHP5 to make it default to php4. I have tried this, to no avail (.htaccess): Code: [Select] <IfModule mod_rewrite.c> RewriteEngine On AddType text/html .php4 AddHandler php4-script .php .html php5 </IfModule> I have also tried a few alternatives... this appears to be a common problem and I have scoured the web and found no solution. Here are the two pages in PHP4 and PHP5: php4: http://www.killersmiley.com/test/cool-smiley.php4 php5: http://www.killersmiley.com/test/cool-smiley.php Similar TutorialsHi... I could really do with some help, I have some form code I have been using for a very long time. how every my server company will not install php4 anymore Can someone have a look at this code and let me know why its not php5 compatible. Thanks <?php /* $sendto is the email where form results are sent to */ $sendto = "........"; /* $ccto is the email where form results can be carbon copied to */ $ccto = "..........."; /* O P T I O N A L V A R I A B L E S */ /* TO POST PHP ERRORS TO PAGE FOR DEBUGING SET: $report_errors = "ALL"; TO REMOVE PHP ERRORS FROM POSTING TO THE PAGE FOR USE SET: $report_errors = "NONE"; */ $report_errors = "NONE"; $setokurl = "1"; $okurls = "http://www.dwcontractors.com"; if ($report_errors == "NONE") { error_reporting(0); }else{ error_reporting(E_ALL); } /* --- I F S E T O K U R L = 1 ----- */ if ($setokurl == "1"){ $found_url = "0"; $referer =$_SERVER["HTTP_REFERER"]; $referer = str_replace("://", "[CS]", $referer); $referer_sp = explode("/", $referer); $referer = "$referer_sp[0]"; $referer .= "/"; $referer = str_replace("[CS]", "://", $referer); $referer = strtolower($referer); $okurls = split(",", $okurls); foreach ($okurls as $myokurls) { $myokurls = strtolower($myokurls); if ($referer == strtolower($myokurls)) { $found_url = "1"; } } if ($found_url == "0") { $ERROR_action = "bad_okurl"; include("$PATH_error$PAGE_error"); } } /* --- E N D I F S E T O K U R L = 1 --- */ /* check to see if posted */ if ($HTTP_GET_VARS || ! $HTTP_POST_VARS || $_GET || ! $_POST) { include("nverror.php4"); no_pst(); }else{ /* IF OLDER VERSION OF PHP CONVERT TO NEWER VARIABLES */ if (! $_POST) { $_POST = "$HTTP_POST_VARS"; } if (! $_SERVER) { $_SERVER = "$HTTP_SERVER_VARS"; } $year = date("Y"); $month = date("m"); $day = date("d"); $hour = date("h"); $min = date("i"); $tod = date("a"); $ip=$_SERVER["REMOTE_ADDR"]; $SEND_prnt = "The form below was submited by " . $_POST{"email"} . " from Ip address: $ip on $monthnameactual $month/$day/$year at $hour:$min $tod \n"; $SEND_prnt .= "--- DW Contractors ---\n\n"; /* CHECK TO SEE IF $_POST{"required"} IS SET */ if ($_POST{"required"}){ $post_required = $_POST{"required"}; $required = split(",", $post_required); $reqnum = count($required); for ($req=0; $req < $reqnum; $req++) { $REQ_name = $required[$req]; $REQ_value = $POST{"$REQ_name"}; if ($REQ_name == "email") { $goodem = ereg("^[^@ ]+@[^@ ]+\.[^@ \.]+$", $_POST{"email"}, $trashed); if (! $goodem) { include("nverror.php4"); msng_email(); } /* end ! $goodem */ } elseif (! $_POST{"$REQ_name"}) { $isreqe = "1"; $REQ_error .= "<li> $REQ_name "; } /* end ! req val */ } /* end REQ for loop */ /* IF THERE ARE ANY REQUIRED FIELDS NOT FILLED IN */ if ($isreqe == "1") { include("nverror.php4"); msng_required(); } } /* END CHECK TO SEE IF $_POST{"required"} IS SET */ /* END IF THERE ARE ANY REQUIRED FIELDS NOT FILLED IN */ /* GET POSTED VARIABLES */ foreach ($_POST as $NVPOST_name => $NVPOST_value) { $NVPOST_value = str_replace("\n", "", $NVPOST_value); $NVPOST_value = str_replace("\r", "", $NVPOST_value); $NVPOST_value = preg_replace("'\cc:'si", "Cc ", $NVPOST_value); $NVPOST_value = preg_replace("'\bcc:'si", "bcc ", $NVPOST_value); $NVPOST_value = preg_replace("'\to:'si", "to ", $NVPOST_value); $NVPOST_value = preg_replace("'\bc:'si", "bc ", $NVPOST_value); if (strtolower($NVPOST_name) == "subject") { $NVPOST_value = str_replace(":", ";", $NVPOST_value); } /* G E T E M A I L */ if (strtolower($NVPOST_name) == "email") { $SEND_email = "$NVPOST_value"; $SEND_email = str_replace(":", "", $SEND_email); $SEND_email = str_replace(" ", "", $SEND_email); } /* END GET LEADS EMAIL */ if (! $_POST{"sort"}) { /* CHECK TO SEE IF CONFIG FIELD */ if ($NVPOST_name == "subject" || $NVPOST_name == "sort" || $NVPOST_name == "required" || $NVPOST_name == "success_page"){}else{ $SEND_prnt .= "$NVPOST_name: $NVPOST_value \n\n"; } } /* end ! sort */ } /* end foreach */ /* END GET POSTED VARIABLES */ if ($_POST{"sort"}) { /* SORT VARIABLES */ $sortvars = split(",", $_POST{"sort"}); $sortnum = count($sortvars); for ($num=0; $num < $sortnum; $num++) { $SEND_prnt .= "$sortvars[$num]: " . $_POST{"$sortvars[$num]"} . " \n\n"; } } /* END SORT VARIABLES */ /* send mail */ if (! $ccto) { $header = "From: $SEND_email\r\nReply-to: $SEND_email"; }else{ $header = "From: $SEND_email\r\nReply-to: $SEND_email\r\nCc: $ccto"; } mail($sendto, $_POST{"subject"}, $SEND_prnt, $header); /* END sendmail */ /* CHECK TO SEE IF FORM SPECIFYS A SUCCESS PAGE */ if (! $_POST{"success_page"}) { include("nverror.php4"); default_success(); }else{ $successpage=$_POST{"success_page"}; header("Location: $successpage"); /* redirect */ exit; } } /* END IF POSTED */ ?> I just finished (or so I thought) a project. But my client's server runs PHP4, so I need to adapt my code. Here's what stopped working: Code: [Select] $localClasses = new DOMDocument; $localClasses -> load("file.xml"); $localClasses -> get_elements_by_tagname('Title') -> item(0) -> firstChild -> nodeValue Here's my petty attempt at trying to adapt this code to run in PHP4: Code: [Select] $file = file_get_contents("localClasses.xml"); $localClasses = new DOMDocument($file); $test = $localClasses -> get_elements_by_tagname('Title'); $testText = $test -> item[0] -> firstChild -> nodeValue; print $testText; This doesn't give me any errors, but nothing shows up. Any help would be appreciated. Thanks for reading! I am trying to convert a php4 app to php5 and am getting this error (Fatal error: Cannot re-assign $this in ) when I call this class. $this = $this->createUnique($new); is the line that generates the error. I try to rename $this to $_this but it does not help. I think I lose the reference to the object later on in the code. Then I will get an error like (Fatal error: Call to a member function createUnique() on a non-object in) Is there another way to reference the current instance of an object in php5? Any help appreciated... Code Example: Code: [Select] class imageobject{ var $handle; var $height=0; var $width=0; var $directory; var $filename; //constructor function imageobject($directory,$filename,$width=0,$height=0,$color="FFFFFF") { $this->directory = $directory; $this->filename = $filename; if ($filename=="" && $width>0 && $height>0){ $new = $this->createImage($width,$height); $this = $this->createUnique($new); }elseif (file_exists($directory.$filename)){ $size = GetImageSize($directory.$filename); if ($size) $this->handle = $this->getHandle($directory.$filename,$size[2]); $this->width = $size[0]; $this->height = $size[1]; } function createUnique($imgnew) { $this->type = substr($this->output,0,3); $unique_str = $this->uniqueName(); switch ($this->type){ case "png": imagepng($imgnew,RES_DIR.$unique_str); break; default: imagejpeg($imgnew,RES_DIR.$unique_str,$this->quality); break; } $this->handle && imagedestroy($this->handle); $newobject = new imageobject(RES_DIR,$unique_str,$this->type); return $newobject; } )//end class I have an application that was written back in PHP4 days and has ceased development ever since. PHP 4 is basically gone, i can't get it to install on any of my machines now and what i use on my windows boxes (XAMPP) doesn't include PHP4 anymore. When i set everything up, i get ~50 of these: Deprecated: Assigning the return value of new by reference is deprecated in.... and on every line it looks like: $var =& _____ or $var = &something... yada-yada and removing the & symbol removes the error message. Using editplus i removed all the "=&" and "= &" and just replaced the & with space, i had read on google PHP5 doesn't need it anymore so that should've worked. But as my luck would have it, the server errors out with 500 code until i replace all the &'s back, and then the errors show up yet again. Is there anyway to force php5 to run this program despite having php4 things in it? So this script did work in previous versions oh php but in php5 I get the error, "Sorry, uploaded images must be of type jpg or jpeg, (not )." So it looks like it's not recognizing my file as a jpeg?? Any contributions towards a fix are GREATLY appreciated!!! If there are clean, nice (EASY) php5 scripts available for this simple image uploading and thumbnail creation I would consider starting this over. //Listing page code: echo "<form name=\"addCat\" enctype=\"multipart/form-data\" action=\"preview.php\" method=\"post\">"; <INPUT type="file" name="pic1" size="50" value=""> <INPUT type="file" name="pic2" size="50" value=""> <INPUT type="file" name="pic3" size="50" value=""> <INPUT type="file" name="pic4" size="50" value=""> <input type="submit" value="Upload Images"> //preview.php page code: $pic1 = $_FILES['pic1']; $pic2 = $_FILES['pic2']; $pic3 = $_FILES['pic3']; $pic4 = $_FILES['pic4']; function ResizeImage($im,$maxwidth,$maxheight,$name){ $width = imagesx($im); $height = imagesy($im); if(($maxwidth && $width > $maxwidth) || ($maxheight && $height > $maxheight)){ if($maxwidth && $width > $maxwidth){ $widthratio = $maxwidth/$width; $RESIZEWIDTH=true; } if($maxheight && $height > $maxheight){ $heightratio = $maxheight/$height; $RESIZEHEIGHT=true; } if($RESIZEWIDTH && $RESIZEHEIGHT){ if($widthratio < $heightratio){ $ratio = $widthratio; }else{ $ratio = $heightratio; } }elseif($RESIZEWIDTH){ $ratio = $widthratio; }elseif($RESIZEHEIGHT){ $ratio = $heightratio; } $newwidth = $width * $ratio; $newheight = $height * $ratio; if(function_exists("imagecopyresampled")){ $newim = imagecreatetruecolor($newwidth, $newheight); imagecopyresampled($newim, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); }else{ $newim = imagecreate($newwidth, $newheight); imagecopyresized($newim, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); } ImageJpeg (($newim),$name . ".jpg"); ImageDestroy ($newim); }else{ ImageJpeg ($im,$name . ".jpg"); } } // Set up some variables flush(); set_time_limit(210); // set process page limit to 3.5 minutes $maxfilesize = "102400"; //# individual file size limit - in bytes (102400 bytes = 100KB) $path="2012images"; $thumbpath="thumbs"; // two data pulls to rename images - would be easier to have a permanent counter...fix later $mysql[getpicname] = mysql_query("select pic from picname"); $z = mysql_fetch_array($mysql[getpicname]); $new_filename=$z[pic]; $new_z[pic]=$z[pic]+$total_pics; if(@mysql_query("UPDATE picname SET pic = '$new_z[pic]' ")) echo ""; // Create thumbnail from imgurl and store in thumbs // Height to reszie image to (in pixels) $RESIZEHEIGHT=200; // Width to reszie image to (in pixels) $RESIZEWIDTH=200; //thumbnail to thumbs folder, named same as 1st image $FILENAME=$thumbpath."/".$new_filename; $thumb_name=$thumbpath."/".$new_filename.".jpg"; // create a thumbnail from the first image only $im = imagecreatefromjpeg($_FILES['pic1']['tmp_name']); if($im) { if(file_exists("$pic_1.jpg")) { unlink("$pic_1.jpg"); } if (ResizeImage($im,$RESIZEWIDTH,$RESIZEHEIGHT,$FILENAME)) ImageDestroy ($im); } //now upload the images..... for ($i=1;$i<5;$i++) { //check if blank or image $xpic="pic".$i; if (($$xpic<>"none") and ($$xpic<>"")) { // check if jpg $cert1 = "image/pjpeg"; //jpg $cert2 = "image/jpeg"; //jpg (for MAC) $xtype =$HTTP_POST_FILES[$xpic]['type']; $xsize =$HTTP_POST_FILES[$xpic]['size']; if (($xtype <> $cert1) AND ($xtype <> $cert2)) { echo "<DIV class=\"errorsubheading\"><br><br>Alert - Missing or Invalid Information</DIV><br>"; echo "<DIV class=\"requiredtext\">Sorry, uploaded images must be of type jpg or jpeg, (not $xtype).</DIV><BR>"; echo "<BR><br><br>"; include ("footer.php"); exit(); } if ($xsize > $maxfilesize) { echo "<DIV class=\"errorsubheading\"><br><br>Alert - Missing or Invalid Information</DIV><br>"; echo "<DIV class=\"requiredtext\">Sorry, uploaded images must be under the maximum size requirements.</DIV><BR>"; echo "<BR><br><br>"; include ("footer.php"); exit(); } else { // upload to server $dest=$path."/".$new_filename.".jpg"; If (move_uploaded_file($$xpic, $dest)) { $photo[$i]=$dest; $new_filename+=1; } else { echo "<DIV class=\"errorsubheading\"><br><br>Alert - Upload Failed!</DIV><br>"; echo "<BR><br><br>"; include ("footer.php"); exit(); } // upload sucessful } // end type check } // end check if blank }
The Wordpress Atahualpa theme does not appear to be compatible with php 7.2. I know very little about php. I get the following error message in my error log: Hi everyone, would be grateful if anyone can help me. I recently changed my hosting package and didnt realize that the new package uses PHP 5. There is no option to use an earlier version but my thumbnail script that worked on PHP 4 just shows a red cross where the thumbnail should be. Can anyone tell me why the script below would not work with PHP 5. I have a basic understanding of how scripts work but I am not an expert so if you could make any replies easy to understand I have checked and the new server does have GD library version 2.0.34 installed - not sure if there is anything else I need to check ? script called: uktn.php Code: [Select] <? $maxwidth = 200; $maxheight = 200; $image_path = $_GET['im']; $ext = explode('.', $image_path); $i = count($ext)-1; if ($ext[$i] == 'jpg' || $ext[$i] == 'jpeg' || $ext[$i] == 'JPG' || $ext[$i] == 'JPEG' ) { $img = @imagecreatefromjpeg($image_path); } else if ($ext[$i] == 'png' || $ext[$i] == 'PNG') { $img = @imagecreatefrompng($image_path); } else if ($ext[$i] == 'gif' || $ext[$i] == 'GIF') { $img = @imagecreatefromgif($image_path); } if ($img) { $width = imagesx($img); $height = imagesy($img); $scale = min($maxwidth/$width, $maxheight/$height); if ($scale < 1) { $new_width = floor($scale*$width); $new_height = floor($scale*$height); $tmp_img = imagecreatetruecolor($new_width, $new_height); imagecopyresized($tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height); imagedestroy($img); $img = $tmp_img; } } if (!$img) { exit ("You must specify an image!"); } header("Content-type: image/png"); imagepng($img,'',100); ?> Many thanks, Dave I have a small php upload/download script, it always worked on older php4 -5 but not on php5.3 ,gobal varitables must be on , I dont know to much about php and was hoping someone will look at at and let me know what to change to make it work on php5.3 or higher..............................THANKS! for any help in fixing this issue
<body link="#FFFF00" vlink="#FF0000" alink="#FFFF00"><? $extlimit = "yes"; //Do you want to limit the extensions of files uploaded $limitedext = array(".zip",".sim",".car",".jpg",".gif"); //Extensions you want files uploaded limited to. $sizelimit = "no"; //Do you want a size limit, yes or no? $sizebytes = "30033000"; //size limit in bytes $dl = "xxxxxxxxxxx"; //url where files are uploaded $absolute_path = "xxxxxxxxxxx"; //Absolute path to where files are uploaded $websiteurl = "xxxxxxxx"; //Url to you website $websitename = "Car File Manger"; if (!isset($action)) { $action = ""; } switch($action) { default: echo" <html> <head> <title>Upload Or Download</title> </head> <body> <a href=$PHP_SELF?action=upload>Upload</a> | <a href=$PHP_SELF?action=download>Download</a> | <a href=$websiteurl>Return to $websitename</a> <br><br> </body> </html>"; break; case "download": echo " <html> <head> <title>File Download</title> </head> <body><a href=$PHP_SELF?action=upload>Upload File</a> | <a href=$websiteurl>Return to $websitename</a>"; $list = "<table width=500 border=0 bordercolor=#000000 style=\"border-collapse: collapse\">"; $list .= "<tr><td width=500><center><b>Click To Download</b></center></td></tr>"; $dir = opendir($absolute_path); while($file = readdir($dir)) { if (($file != "..") and ($file != ".")) { //Download files with spaces fix by Kokesh $list .= "<tr><td width=700><a href='$dl/$file'>$file</a></center></td></tr>"; } } $list .= "</table>"; echo $list; echo" <br><br> </body> </html>"; break; case "upload": echo" <html> <head> <title>File Upload</title> </head> <body> <form method=POST action=$PHP_SELF?action=doupload enctype=multipart/form-data> <p>File to upload:<br> <input type=file name=file size=30> <p><button name=submit type=submit> Upload </button> </form> <br><br> </body> </html>"; break; //File Upload case "doupload": $dir = "dir"; if ($file != "") { if (file_exists("$absolute_path/$file_name")) { die("File already exists"); } if (($sizelimit == "yes") && ($file_size > $sizebytes)) { die("File is to big. It must be $sizebytes bytes or less."); } $ext = strrchr($file_name,'.'); if (($extlimit == "yes") && (!in_array($ext,$limitedext))) { die("The file you are uploading doesn't have the correct extension."); } @copy($file, "$absolute_path/$file_name") or die("The file you are trying to upload couldn't be copied to the server"); } else { die("Must select file to upload"); } echo " <html> <head> <title>File Uploaded</title> </head> <body>"; echo $file_name." was uploaded"; echo "<br> <a href=$PHP_SELF?action=upload>Upload </a> | <a href=$PHP_SELF?action=download> Download </a> | <a href=$websiteurl> Return to $websitename</a><br><br> </body> </html>"; break; } ?> Edited by Ch0cu3r, 01 September 2014 - 06:05 AM. 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! A while back my webhost upgraded to PHP5 and broke a few of my simple scripts - primarily forms using a text box for entry. I renamed and relinked the forms to .php4 and it "solved" the problem. I've decided to fix them correctly and use proper PHP 5 code. What's the easiest way to actually retrieve the value of a text input in PHP5? My old reference tricks return null. When I started reading up I saw only PHP4 examples and then in over my head with global variables, httaccess and php.ini. I don't want to mess about with the default settings. I'm sure I zoomed right past a simple answer on my way to that mess. A simple example script: Code: [Select] <FORM NAME="form1" ID="form1" METHOD="POST" ACTION="simple.php"> <INPUT Type='Text' Name="i1Text" ID="i1Text" Value="Default"> <INPUT Type="Submit" Name="Submit1" Value="Read the Text"> </FORM> <?PHP if (isset($_POST['Submit1'])) { $RefText=$i1Text; print "Text: $RefText"; <!-- Returns blanks unless .php4 --> } ?>So, how do I actually get to that text value? Thanks in advance! Hi guys, a few days i upgrade php from 5.1 to 5.2.16 all seem fine and last 2 days i start to find some bugs. I use this code to get url var and pass from a form: <?php echo $_GET['id']; ?> <input name="ids" type="hidden" id="ids" value="<?php $_GET['id'];?>" /> In the email i receive all data from the form, but not this that i get from the URL. in code to send to email i just use: $_POST[id] This work fine in 5.1 but not in this version. anyone have an idea why? Wipe Do any one have an Idea on how to transmit xml or json from one site to another with php4......... any help please.. Thanks in advance I am UPGRADING some old files to MySQLi and while doing so have decided to complete some leftover projects. In this project, I was counting vegetables sold to customers that displayed a report displaying information like this:
There were 3 orders for carrots for 1 lbs. each The code I used to generate the messages was: while($row = mysqli_fetch_array($result)){ echo "There were ". $row['COUNT(carrots)'] ." orders for carrots for ". $row['carrots'] ." lbs. each <br />"; } At the time, I was going to call a separate script for carrots, potatoes, and celery. Now, with my worldly advancement (or maybe not.. LOL) I realize I should be able to use the same single script and assign a variable to accommodate each vegetable item. After declaring the $item = 'carrots' I inserted it to test my theory. I tested the output in stages and all seemed okay until I did this: while($row = mysqli_fetch_array($result)){ echo "There were ". $row['COUNT($item)'] ." orders for carrots for ". $row['$item'] ." lbs. each <br />"; } Is there an issue with using a variable inside a $row? Is there a syntax error (no error messages)? Perhaps a MySQLi addition that is required? I have 2 pages in my flash site that call some PHP files. The pages are a feedback page and a locator page. When my server went from PHP4 to PHP5 both pages stopped displaying the content. When I load the flash pages with Fiddler open, fiddler shows a 500 error on the PHP files that the flash is calling. I'm certain my database connections are good, file paths have not changed since the server maintenance, and I have .htaccess files except they are blank. Can anyone advise what I can do to find where the problem is? I have the PHP code below that showed the 500 errors. Any help would be really appreciated. This is the locator page: Code: [Select] <?php include_once('db_connect.inc.php'); $query = "SELECT state FROM stores group BY state ORDER BY state"; $result = mysql_query($query); if(mysql_num_rows($result)==NULL){ $r_string = '&error=1&msg=No Records Found.'; }else{ $r_string = '&error=0&n='.mysql_num_rows($result) . '&r_states='; $i = 0; $r=''; while ($row = mysql_fetch_assoc($result)) { if($r!='') $r .= '||'; $r .= $row['state']; $i++; } $r_string .= $r; // add extra & to prevent returning extra chars at the end $r_string .='&'; } echo $r_string; ?> This is the feedback page: Code: [Select] <?php include_once('inc/feedbackconn.inc.php'); echo '&rsult='; $query = "SELECT * FROM messages where active!=0"; $result = mysql_query($query); $num = @mysql_num_rows($result); $cfeed=$_POST['sFeed']; $cfeed--; $query = "SELECT * FROM messages where active='1' ORDER BY id LIMIT " . $cfeed . ',1'; $result = mysql_query($query); //$row = mysql_fetch_array($result); if($num==NULL){ echo "No Records."; exit(); } while($row = @mysql_fetch_array($result)){ $b_name = stripslashes($row[strName]); $b_loc = stripslashes($row[strLocation]); $b_mes = stripslashes($row[strMessage]); $b_id = $row[id]; $b_active = $row[active]; $feedArray[] = array("name"=>$b_name,"location"=>$b_loc,"feedback"=>$b_mes,"id"=>$b_id,"active"=>$b_active); } /* /////////////// DISPLAY THE RECORDS ///////////////// */ $numOfMessages = sizeOf($feedArray); for($i=0;$i<$numOfMessages;$i++){ //------------------------------------------------------------------ //echo $feedArray[$i]['id']."<br>\n"; echo '<b><i>' . $feedArray[$i]['feedback']."</i><br><br>"; echo $feedArray[$i]['name']."<br>"; echo $feedArray[$i]['location']."</b>"; //--------------------------------------------------------------------- } echo '&tFeeds=' . $num; echo '&cFeed=' . $_POST['sFeed']; ?> See below my website is showing like this
I think debian upgraded from php 7.3 or 4 to 8.0 I am wondering if I am missing some php packages if run php -v at terminal I get php -v PHP 8.0.7 (cli) (built: Jun 4 2021 23:17:30) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.7, Copyright (c) Zend Technologies with Zend OPcache v8.0.7, Copyright (c), by Zend Technologies and if I run php -m at terminal i get php -m [PHP Modules] calendar Core ctype date dom exif FFI fileinfo filter ftp gd gettext hash iconv json libxml mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql Phar posix readline Reflection session shmop SimpleXML sockets sodium SPL standard sysvmsg sysvsem sysvshm tokenizer xml xmlreader xmlwriter xsl Zend OPcache zlib [Zend Modules] Zend OPcache
I've been out of coding for about 4 years. My client called and said that they upgraded his server and now nothing works. I've don't done some reading and see that there are changes to queries. I originally wrote the program using mysql_query which is now deprecated replaced with MySQLi and PDO_MySQL which I thought would be that simple. Apparently not. My code is below. The error I get is Fatal error: Call to undefined function MySQLi() in /home1/zipclick/public_html/marketingteamates.com/_ZABP_merchants/main-w.php on line 304 which leads me to believe that the upgrade is now solely object oriented.
$result = MySQLi( "SELECT * FROM $users WHERE username = '$username'" ) or die("SELECT Error: ". mysqli_errno()); $num_rows = mysqli_num_rows($result); while ($row = mysqli_fetch_array($result)) { extract($row); }
This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=355561.0 Code: [Select] $colorarray = isset($_POST['form']['color']) ? intval($_POST['form']['color']) : 0; $color = array( "1", "2", "3", "4", "5", "6", "7", "8", "8", "9", "10", "11", "12", "13", "14", "15", "16" ); if (in_array($color, $colorarray)) { echo "search found"; exit; }else{ echo "hacker"; exit; } i submit my $_POST['form']['color'] as 1 through 16 and it always says hacker? Code: [Select] $birthday = implode(",",$_POST['BirthDay']); $bday = array( "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" ); echo $birthday['0']; exit; //var_dump($colorarrays); if (!in_array($birthday['0'], $bday)) { message("Please select a Correct Birthday, or u trying to hack"); } Okay, if I enter "55325" for my first birthday POST, it only shows "5" and thus making the in_array not work correctly how can i implode my data correctly ty |