PHP - Why Is This Happening And What Is The Solution?
Hi, I am having trouble with some GIF, PNG images the error I am receiving these errors
imagecreatefromgif() [function.imagecreatefromgif]: '/tmp/phpNAhLPI' is not a valid GIF and a similar one for PNG Is there a solution to this? and How can I hide these errors? So they never display to the user and Instead I echo a user friendly error. Please note again this is happening with some GIF and PNGs not all of them. Appreciate any help and thanks in advance! Similar TutorialsHi all I have several arrays set, and I can guarantee I have values in these as I have tested them by echoing out each value. However, when I pass it through a user defined function to produce a percentage for each value of the total arry, I get a null return. I don't even get any errors. Any ideas? // Produce the % array of each array for use in 2nd report $percent_morale1=percentCalc($morale_count1[1],$morale_count1[2],$morale_count1[3],$morale_count1[4],$morale_count1[5],$total_morale1); $percent_morale2=percentCalc($morale_count2[1],$morale_count2[2],$morale_count2[3],$morale_count2[4],$morale_count2[5],$total_morale2); $percent_morale3=percentCalc($morale_count3[1],$morale_count3[2],$morale_count3[3],$morale_count3[4],$morale_count3[5],$total_morale3); $percent_morale4=percentCalc($morale_count4[1],$morale_count4[2],$morale_count4[3],$morale_count4[4],$morale_count4[5],$total_morale4); $percent_morale5=percentCalc($morale_count5[1],$morale_count5[2],$morale_count5[3],$morale_count5[4],$morale_count5[5],$total_morale5); $percent_morale6=percentCalc($morale_count6[1],$morale_count6[2],$morale_count6[3],$morale_count6[4],$morale_count6[5],$total_morale6); <?php function percentCalc($value1,$value2,$value3,$value4,$value5,$total) { $array=array($value1,$value2,$value3,$value4,$value5); while (list($key,$arraycontent)= each($array)) { $c_percent=(($arraycontent/$total)*100); $final_array[]=$c_percent; } return $final_array; } ?> <?php echo"<td class=\"percent1\" > "; printf("%01.0f",$percent_morale1[1]); echo "%</td>"; echo"<td class=\"percent2\" > "; printf("%01.0f",$percent_morale1[2]); echo "%</td>"; echo"<td class=\"percent3\" > "; printf("%01.0f",$percent_morale1[3]); echo "%</td>"; echo"<td class=\"percent4\" > "; printf("%01.0f",$percent_morale1[4]); echo "%</td>"; echo"<td class=\"percent5\" > "; printf("%01.0f",$percent_morale1[5]); echo "%</td>"; ?> Over the last few weeks I have had people trying to access the following urls and some similar index.php?option=com_jce&task=plugin&plugin=imgmanager&file=imgmanager&method=form&cid=20&6bc427c8a7981f4fe1f5ac65c1246b5f=cf6dd3cf1923c950586d0dd595c8e20b by BOT for JCE /includes/exit.php?ID=999999.9 /*!30000union all select 0x31303235343830303536,0x31303235343830303536,0x31303235343830303536,0x31303235343830303536,0x31303235343830303536,0x31303235343830303536,0x31303235343830303536,0x3130323 /index.php?option=com_jce&task=plugin&plugin=imgmanager&file=imgmanager&method=form&cid=20&6bc427c8a7981f4fe1f5ac65c1246b5f=cf6dd3cf1923c950586d0dd595c8e20b what are these urls trying to do and should I be worried? James Edited by requinix, 24 May 2014 - 03:56 AM. unlinking ok so I'll login to my account then once I'm logged in I visit a page with a: while(mysql_fetch_array($v)){ in it and it logs me in as someone else. if I remove the while it wont but I need to while. what do I do and whys it doing this? Login: <?php $title="Login"; $metakeywords="login, email"; $metadescription="Login to $sitename"; include("header.php"); if(!$_POST['submit']) { ?> <html> <div class="header">Login</div> <div class="content"> <form method="post" action="index.php?action=login"> Email:<br /> <input id="email" type="text" name="email" maxlength="16"> <br /> Password:<br /> <input type="password" name="password" maxlength="16"> <br /> <input type="submit" name="submit" value="Login"> </form> <a href="index.php?action=signup">Register Here</a> </div> </html> <?php } else { $user = protect($_POST['email']); $pass = protect($_POST['password']); if($user && $pass) { $pass = md5($pass); //compare the encrypted password $sql="SELECT id,email,password,activation_key FROM `users` WHERE `email`='$user' AND `password`='$pass'"; $query=mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($query) > 0) { $row = mysql_fetch_assoc($query); if($row['activation_key'] == 0){ $_SESSION['id'] = $row['id']; $_SESSION['email'] = $row['email']; $_SESSION['password'] = $row['password']; echo '<meta http-equiv="REFRESH" content="0;url=index.php">'; }else{ echo "<div class='error'>You need to activate your account first!</div>"; } } else { echo "<div class='error'>Email and password combination is incorrect!</div>"; } } else { echo "<div class='error'>You need to gimme a email AND password!</div>"; } } include("footer.php"); ?> code that logs me into another account: $sql2 = "select * FROM cheats WHERE game_id='$datas[id]'"; $rec2 = mysql_query($sql2) or die(mysql_error()); while($datas2=mysql_fetch_array($rec2)){ echo "<div class='header'>$datas2[title]</div>"; echo "<div class='content'>$datas2[cheat]</div><br>"; } EDIT: Solved. I was calling duplicate variables from an include. Changing the name in this code to something (could be anything really) different fixed the issue. Thanks!! I am currently working on some PHP which grabs variables from the link so I can keep track of which user has been clicked on. Everything seemed to be working just fine until I got to a particular part of the code. Let me know if this makes any sense AT ALL!!! As usual my code can be found below. Thanks!! Code: [Select] <?php session_start(); // Put stored session variables into local php variable $staff_id = $_SESSION['sid']; $staff_username = $_SESSION['username']; $staff_fname = $_SESSION['staff_first_name']; $cust_edit_access = $_SESSION['cust_edit_access']; include_once "scripts/connect_to_mysql.php"; $customer_id = $_GET['cid']; $customer_id = mysql_real_escape_string($customer_id ); $customer_id = eregi_replace("`", "", $customer_id); $customer_project_id = $_GET['pid']; $customer_project_id = mysql_real_escape_string($customer_project_id ); $customer_project_id = eregi_replace("`", "", $customer_project_id ); include "left_nav_customers.php"; include "left_nav_tools.php"; include "pgbdy_header_left.php"; include "project_display.php"; $sql = mysql_query("SELECT * FROM company_info WHERE proj_id='$customer_project_id'"); while ($row = mysql_fetch_array($sql)) { $company_name = $row["company_name"]; $customer_address = $row["address"]; $customer_city = $row["city"]; $customer_state = $row["state"]; $customer_zip = $row["zip"]; $customer_email = $row["email"]; $customer_phone = $row["phone"]; $customer_fax = $row["fax"]; $cust_pre_meth_contact = $row["pref_meth_contact"]; $cust_entry_date = $row["entry_date"]; } $temp_project_id = ''; $start_date = date("F j, Y, g:i:s a"); $start_month = date('n'); if ($_POST['create_new_customer_project']) { $sql2 = mysql_query("INSERT INTO projects (cust_id, staff_id, start_date) VALUES('$customer_id','$staff_id','$start_date')") or die (mysql_error()); // Get the inserted ID here to use in the activation email $new_project_id = mysql_insert_id(); // Create directory(folder) to hold each user files(pics, MP3s, etc.) $temp_project_id = "$start_month-00$customer_id-0$new_project_id"; mkdir("customer_files/cust$customer_id/$temp_project_id", 0755); $sql3 = mysql_query("UPDATE projects SET proj_id='$temp_project_id' WHERE id='$new_project_id'"); } ?> <!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 rel="stylesheet" type="text/css" href="style.css"/> <!----------- ALL JAVASCRIPT ------------------------ ==================================================--> <script src="js/jquery-1.5.js" type="text/javascript"></script> <script language="javascript" type="text/javascript"> function toggleSlideBox(x) { if ($('#'+x).is(":hidden")) { $(".hiddenDiv").slideUp(200); $('#'+x).slideDown(300); } else { $('#'+x).slideUp(300); } } </script> <!--===========COMPANY INFO POPUP==============-- ==============================================--> <script type="text/javascript"> <!-- function edit_company_info() { window.open( "edit_company_info.php?sid=<?php echo "$staff_id"; ?>&cid=<?php echo "$customer_id"; ?>&pid=<?php echo "$customer_project_id"; ?>", "myWindow", "status = 1, toolbar = no, scrollbars = no, location = no, resizable = no, height = 580, width = 600, resizable = 0" ) } //--> </script> <!--===========COMPANY INFO POPUP==============-- ==============================================--> <!--===========GENERAL INFO POPUP==============-- ==============================================--> <script type="text/javascript"> <!-- function edit_general_info() { window.open( "http://www.google.com/", "myWindow", "status = 1, toolbar = no, scrollbars = no, location = no, resizable = no, height = 600, width = 600, resizable = 0" ) } //--> </script> <!--===========GENERAL INFO POPUP==============-- ==============================================--> <!--===========BILLING INFO POPUP==============-- ==============================================--> <script type="text/javascript"> <!-- function edit_billing_info() { window.open( "http://www.google.com/", "myWindow", "status = 1, toolbar = no, scrollbars = no, location = no, resizable = no, height = 600, width = 600, resizable = 0" ) } //--> </script> <!--===========BILLING INFO POPUP==============-- ==============================================--> <!--===========FACILITY INFO POPUP==============-- ==============================================--> <script type="text/javascript"> <!-- function edit_facility_info() { window.open( "http://www.google.com/", "myWindow", "status = 1, toolbar = no, scrollbars = no, location = no, resizable = no, height = 600, width = 600, resizable = 0" ) } //--> </script> <!--===========FACILITY INFO POPUP==============-- ==============================================--> <!--===========PRODUCT NEEDS INFO POPUP==============-- ==============================================--> <script type="text/javascript"> <!-- function edit_product_needs_info() { window.open( "http://www.google.com/", "myWindow", "status = 1, toolbar = no, scrollbars = no, location = no, resizable = no, height = 600, width = 600, resizable = 0" ) } //--> </script> <!--===========PRODUCT NEEDS INFO POPUP==============-- ==============================================--> <script type="text/javascript"> <!-- var sURL = unescape(window.location.pathname); function refresh() { window.location.href = sURL; } //--> </script> <!----------- ALL JAVASCRIPT ------------------------ ==================================================--> </head> <body> <div id="pg_container"> <!--HEADER SECTION--> <div id="header"> <div id="header_logo"></div> <div id="header_right"> Welcome <a href="template.php?id=<?php echo "$staff_id"; ?>"><?php echo $staff_fname; ?></a> | <a href="logout.php">Logout</a> </div> </div> <!--HEADER SECTION--> <!--PAGE CONTAINER--> <div id="pgbdy_container"> <div id="left_nav"> <div id="leftnav_header"></div> <div id="leftnav_bdy"> <div id="leftnav_content"> <div id="leftnav_customers"> <p> Select a Customer:<br /><br /> <?php echo "$list_customers"; ?> </p> </div> <hr /> <?php if($cust_edit_access == "1") { ?> <div id="leftnav_tools"> <p> <?php echo "$leftnav_links"; ?> </p> </div> <?php } else { ?> <div id="leftnav_tools"> <p> Edit Customers<br /><br /> You do not have access to edit customers. </p> </div> <?php } ?> </div> </div> </div> <div id="pgbdy"> <div id="bdy_header"></div> <div id="bdy_content_area"> <div id="bdy_content"> <div id="bdy_content_header"> <div id="bdy_content_selected_customer"> <p><?php echo "$contact_info_display"; ?></p> </div> <div id="bdy_content_current_projects"> <form action="customer_profile.php?sid=<?php echo "$staff_id"; ?>&cid=<?php echo "$customer_id"; ?>" method="post" enctype="multipart/form-data"> <p> Customer Projects <input name="create_new_customer_project" type="submit" class="create_new_customer_project_btn" value="" /><br /><br /> <?php echo "$list_customer_projects"; ?> </p> </form> </div> </div> <hr /> <div id="bdy_content_container"> <div id="company_information_section"> <a href="#" onclick="return false" onmousedown="javascript:toggleSlideBox('company_infoBox');">Company Information</a> <div class="hiddenDiv" id="company_infoBox" style="border:#FFF 2px solid; width:553px;"> <p>Please click the button below to edit the customer's company information.<br /> <input name="edit_company_info" onclick="edit_company_info()" type="button" value="Edit Company Information"/><br /><br /> //i placed this here just to make sure the issue was on this page. <?php echo "$customer_project_id"; ?> <b>Company Name: </b><?php echo "$company_name"; ?><br /> <b>Contact Name: </b><?php echo "$customer_fname"; ?> <?php echo "$customer_lname"; ?><br /> <b>Address: </b><?php echo "$customer_address"; ?><br /> <b>City, State, Zip: </b><?php echo "$customer_city"; ?>, <?php echo "$customer_state"; ?> <?php echo "$customer_zip"; ?><br /> <b>Email: </b><?php echo "$customer_email"; ?><br /> <b>Phone: </b><?php echo "$customer_phone"; ?><br /> <b>Fax: </b><?php echo "$customer_fax"; ?><br /> <b>Preferred Method of Contact: </b><?php echo "$cust_pre_meth_contact"; ?> </p> </div> </div> <div id="general_information_section"> <a href="#" onclick="return false" onmousedown="javascript:toggleSlideBox('general_infoBox');">General Information</a> <div class="hiddenDiv" id="general_infoBox" style="border:#FFF 2px solid; width:553px;"> <p>Please click the button below to edit the customer's general information.<br /> <input name="edit_general_info" onclick="edit_general_info()" type="button" value="Edit General Information"/> </p> </div> </div> <div id="billing_information_section"> <a href="#" onclick="return false" onmousedown="javascript:toggleSlideBox('billing_infoBox');">Billing Information</a> <div class="hiddenDiv" id="billing_infoBox" style="border:#FFF 2px solid; width:553px;"> <p>Please click the button below to edit the customer's billing information.<br /> <input name="edit_billing_info" onclick="edit_billing_info()" type="button" value="Edit Billing Information"/> </p> </div> </div> <div id="facility_information_section"> <a href="#" onclick="return false" onmousedown="javascript:toggleSlideBox('facility_infoBox');">Facility Information</a> <div class="hiddenDiv" id="facility_infoBox" style="border:#FFF 2px solid; width:553px;"> <p>Please click the button below to edit the customer's facility information.<br /> <input name="edit_facility_info" onclick="edit_facility_info()" type="button" value="Edit Facility Information"/> </p> </div> </div> <div id="product_needs_information_section"> <a href="#" onclick="return false" onmousedown="javascript:toggleSlideBox('product_needs_infoBox');">Product Needs Information</a> <div class="hiddenDiv" id="product_needs_infoBox" style="border:#FFF 2px solid; width:553px;"> <p>Please click the button below to edit the customer's product needs information.<br /> <input name="edit_product_needs_info" onclick="edit_product_needs_info()" type="button" value="Edit Product Needs Information"/> </p> </div> </div> </div> </div> </div> </div> <div id="right_nav"> <div id="rightnav_header"></div> <div id="rightnav_bdy"> <div id="rightnav_bdy_content"> <div id="rightnav_proj_status"> <p> All Current Associated Project Statuses </p> </div> <hr /> <div id="rightnav_alerts"> <p> Any associated alerts sent so far </p> </div> </div> </div> </div> </div> <!--PAGE CONTAINER--> <div id="footer"></div> </div> </body> </html> The issue is that each of these ID echo statements (cid being customer id, sid being staff id, and pid being project id) echoes something. CID echoes correctly, SID does as well. For some reason, PID only echoes the last project ID that was entered for that particular user. So for example, if I add a project to a user and im staff it would be like this: Staff ID = my Staff ID = 1 Customer ID = customer I am currently working on = 11 (in this case...just a random number for example sake) Project ID = the current month number (no zeroes)-00(current customer id being worked on)-0(current project ID from table) = 3-0011-042 If our example is saying that the latest addition is 3-0011-042, and I click on project 3-0011-038, for some reason (EVEN THOUGH MY WEB LINK HAS THE CORRECT PID which is 3-0011-038) it only echoes the last PID entered in the table. Its almost like its completely ignoring what I have in my address bar and looks directly at my tables latest entry....this has really screwed with my brainnnn!!! I can't seem to figure it out for the life of me. I don't even know how I could run a $_GET function and not get what I am asking for.....crazy. Please help guys!!!! This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=352984.0 I keep trying to install every wordpress, or php web server software I can find, the lastest being WAMP. Nothing ever works. I feel like a complete retard here being that I can't even set up a stupid program, to be ABLE to program myself. Everything I install gives me a 404 not found error when I try to load the admin index page to a browser. I honestly have no friggn clue what is going on, I know syntax pretty decently for a lot of these languages, but as far as setting them up, I might as well just shoot myself. I know they can't make it any easier with these step by step tutorials, but it just doesn't seem to work on my comp.
Hello, ive got the right output from the code below, only my mysql query doesnt seem to be working as it should. Im not too great with mysql so please any help or suggestions would be great. I have tried the code but when I check my database nothing has been inserted. !?! Code: [Select] <?php include('db.php'); include('func.php'); ?><html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Chained Select Boxes using PHP, MySQL and jQuery</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#wait_1').hide(); $('#drop_1').change(function(){ $('#wait_1').show(); $('#result_1').hide(); $.get("func.php", { func: "drop_1", drop_var: $('#drop_1').val() }, function(response){ $('#result_1').fadeOut(); setTimeout("finishAjax('result_1', '"+escape(response)+"')", 400); }); return false; }); }); function finishAjax(id, response) { $('#wait_1').hide(); $('#'+id).html(unescape(response)); $('#'+id).fadeIn(); } </script> </head> <body> <p> <form action="" method="post"> Name: <input type="text" name="Name" /><br /> Phone: <input type="text" name="Phone" /><br /> Email: <input type="text" name="Email" /><br /> Postcode: <input type="text" name="Postcode" /><br /> Web Address: <input type="text" name="Website" /><br /><br /> <select name="drop_1" id="drop_1"> <option value="" selected="selected" disabled="disabled">Select a Category</option> <?php getTierOne(); ?> </select> <span id="wait_1" style="display: none;"> <img alt="Please Wait" src="ajax-loader.gif"/> </span> <span id="result_1" style="display: none;"></span> <br /> </form> </p> <p> <?php if(isset($_POST['submit'])){ $drop = $_POST['drop_1']; $tier_two = $_POST['Subtype']; echo "You selected "; echo $drop." & ".$tier_two; } $Name = $_POST["Name"]; $Phone = $_POST["Phone"]; $Email = $_POST["Email"]; $Postcode = $_POST["Postcode"]; $Website = $_POST["Website"]; echo "<br>"; echo $Name; echo "<br>"; echo $Website; mysql_query ("INSERT INTO business (Name, Type, Subtype, Phone, Email, Postcode, Web Address) VALUES ('$Name', '$drop', '$tier_two' , '$Phone', '$Email', '$Postcode', '$Website')"); ?> Im not sure it makes a difference but, I am adding data into each column of my database with the exception of the 1st column named 'ID' which is set to auto_increment. When signed in as a user, the username shows up on the top right page. Then, if I click a particular product of another user it changes the session variable to that of the other user. Why would this happen? It's really odd. Im having this error and have the not even the slightest clue on how to solve it... Code: [Select] Notice: Undefined offset: 2 in C:\wamp\www\updat5.php on line 146 <?php $picture = array(); while($row = mysql_fetch_assoc($result)) { $id = $row['id']; $picture = array(); switch ($row['icon']) { case 1: $picture[$id] = '<img src="img/apple.gif" title="apple" alt="apple" />'; echo $picture[$id]; break; case 2: $picture[$id] = '<img src="img/banana.gif" title="banana" alt="banana" />'; echo $picture[$id]; break; case 3: $picture[$id] = '<img src="img/orange.gif" title="orange" alt="orange" />'; echo $picture[$id]; break; default: $picture[$id] = ''; echo $row['icon'] . " is something other than 1 2 or 3"; break; } } ?> <hr> <?php echo $picture[2]; ?> And line 146 is: echo $picture[2]; My next post will be the full code if needed incase the error I have currently cant be fixed with the current snippet/block i posted. Can anyone tell me why this is not INSERTing? My array data is coming out just fine.. I've tried everything I can think of and cannot get anything to insert.. Ahhhh! <?php $query = "SELECT RegionID, City FROM geo_cities WHERE RegionID='135'"; $results = mysqli_query($cxn, $query); $row_cnt = mysqli_num_rows($results); echo $row_cnt . " Total Records in Query.<br /><br />"; if (mysqli_num_rows($results)) { while ($row = mysqli_fetch_array($results)) { $insert_city_query = "INSERT INTO all_illinois SET state_id=$row[RegionID], city_name=$row[City] WHERE id = null" or mysqli_error(); $insert = mysqli_query($cxn, $insert_city_query); if (!$insert) { echo "INSERT is NOT working!"; exit(); } echo $row['City'] . "<br />"; echo "<pre>"; echo print_r($row); echo "</pre>"; } //while ($rows = mysqli_fetch_array($results)) } //if (mysqli_num_rows($results)) else { echo "No results to get!"; } ?> Here is my all_illinois INSERT table structu CREATE TABLE IF NOT EXISTS `all_illinois` ( `state_id` varchar(255) NOT NULL, `city_name` varchar(255) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Here is my source table geo_cities structu CREATE TABLE IF NOT EXISTS `1` ( `CityId` varchar(255) NOT NULL, `CountryID` varchar(255) NOT NULL, `RegionID` varchar(255) NOT NULL, `City` varchar(255) NOT NULL, `Latitude` varchar(255) NOT NULL, `Longitude` varchar(255) NOT NULL, `TimeZone` varchar(255) NOT NULL, `DmaId` varchar(255) NOT NULL, `Code` varchar(255) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; SQL error2.Cannot add or update a child row: a foreign key constraint fails (`facility`.`fapplication`, CONSTRAINT `fapplication_ibfk_1` FOREIGN KEY (`fstaffid`) REFERENCES `fstaff` (`fstaffid`)) is there any solution for this problem cause my deadline is next week aaaaa... I'm really fond of your coding and need some help too I'm also trying to make a tree and save it in an xml file such that parent_id of one node is inserted in as pages key to the father node.By running this query $sql = "Select * from category order by parent_id ASC"; I'm getting the following result. Array ( => Array ( [category_id] => 2 [parent_id] => 0 [category_name] => Clothes ) [1] => Array ( [category_id] => 5 [parent_id] => 1 [category_name] => T-shirts ) [2] => Array ( [category_id] => 6 [parent_id] => 1 [category_name] => Cotton-Shirts ) [3] => Array ( [category_id] => 1 [parent_id] => 2 [category_name] => Upper ) [4] => Array ( [category_id] => 4 [parent_id] => 2 [category_name] => Lower ) [5] => Array ( [category_id] => 3 [parent_id] => 4 [category_name] => Pants ) ) My code is as follows but not executing correctly function searchTree($arr,$node,$i){ if(!in_array($node['parent_id'],$arr[$i])) { $stmt = '<pages_'.$i.'>'; $stmt .=$node; $stmt .='</pages_'.$i.'>'; return $stmt;} else{ //print_r($returnTree); print_r ($arr[$i]);//['category_id']; $returnTree = ($arr[$i]['category_id']==$node['parent_id'])? searchTree($arr,$node,$i++): searchTree($arr,'',$i++); } } $i=0; foreach($links as $link){ $myArr = searchTree($links,$link,$i);} The result should be as follows: <page_1> <label>Clothes</label> <uri>#</uri> <pages> <page_1_1> <label>Upper</label> <uri>#</uri> <pages> <label>T-Shirt</label> <uri>#</uri> <page_1_1> <page_1_1_1> <label>Short Sleaves</label> <uri>#</uri> </page_1_1_1> <page_1_1_2><label>Long Sleaves</label><uri>#</uri> </page_1_1_2></page_1_1></page_1> <page_1_2> <label>Lower</label> <uri>#</uri> <pages>....</page_1_2> Hopefully you can unsderstand this problem. Please help me. My friend has this problem, it needs a solution. I have no PHP experience, I don't know how to work with MD5 hash. A programming unit was compulsory on her course, but she completely fails on it. So let's be unethical and help her survive it. thanks in advance ===================== You are the website administrator for a website that requires a low level password for entry. The previous owner of the website forget to code in a password recovery feature and as such you now have to recover the passwords for a number of users of the website. You do have acess to the website databse BUT you are NOT allowed to manually change the passswords for users in the database as those passwords are heavily used in defining what permissions a user of the website has. e.g Moderators for the website forum all have a password begining with the lower case letter "m" in lower case. ALL letters are lowercase. Passwords were allocated to all users and the method of choice was to create a password which was built on two parts - a lowercase letter "m" and a number between 1 and 10000. An md5 hash was then created to form a 32 digit string. e.g the user with password "m1234" is represented in the database as the md5 hash: 77c12394ef7d4f23a8fa07d87309afd9 You have five users who need their orignal password. You know that the passwords all start with the letter "m". You decide that the simplest thing to do is to write some PHP code that uses a while loop to increment through the numbers 0 to 10000, concatenate that number with the "m" and then compare the md5 hash to that you recovered from the database. If the two hashes are the same then you have "cracked" the password. This technique is known as a "brute force" method of cracking passwords. You have a number of hashes to "crack" and you must enter the unique password into the answer box for each. As a starting point, the following PHP snippet will produce all of the lowercase letters: ___________________________________ Code: [Select] for ($i=97; $i<=122; $i++){ $x = chr($i); echo $x; } ?> Ok I have a form that will include some text boxes and two sliders where numbers can be selected. When a user clicks submit I want it to take them to a solutions page based on what numbers they have selected. I'm finding it hard to explain what I'm trying to do so heres an example of what I would like. http://www.cleardebt.co.uk/#help It will be a form like that which links to a solution. If someone could please tell me what I need to do or have a tutorial of something similar it would be a great help for me to start. This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=356124.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=349561.0 Hi guys, I have a simple INSERT code. It does not throw any errors and all seems ok but the data is just not appearing in the DB. I've spent ages looking over it but perhaps a 2nd set of eyes could help? Thanks! Code: [Select] $con = mysql_connect("localhost","posturep",""); $tablename = 'product'; if (!$con) { die('Could not connect: ' . mysql_error()); } //Form data sent $product_name = $_POST['product_name']; $product_active = $_POST['product_active']; $product_cat = $_POST['product_cat']; $product_desc = $_POST['product_desc']; $prod_inoutdoor = $_POST['prod_inoutdoor']; $prod_stackable = $_POST['prod_stackable']; $prod_discounted = $_POST['prod_discounted']; echo $product_name; $sql = "INSERT INTO $tablename (name) VALUES ($product_name)"; mysql_query($sql); echo "<p>Product Saved!</p>"; echo $sql; mysql_close($con); hey guys i wrote an quick and dirty anagram solver for a challenge on hts which works great but i am more interested on feedback of how I could have written it better / more efficiently. anyone have there own version of writing this? thanks Code: [Select] $scramwords = array("htssboe","rtefcelh","vteevl","edsiyn","awloddno","dtey1d","kuedci","seellhy","sernin","acianro"); $unscramwords = array(); $filename = '../wordlist.txt'; // loop through scrambled words foreach($scramwords as $scramword) { // open the file if($fh = fopen($filename,'r')) do { // read line $line = fgets($fh); // see if line and scrambled word are same length if((strlen(trim($line))) == (strlen(trim($scramword)))) { //if they are the same length split the line into and array and the scrambled word into an array $l = array(); for($i=0;$i<strlen(trim($line));$i++){ $l[$i] = substr(trim($line),$i,1); } $s = array(); for($i=0;$i<strlen(trim($scramword));$i++){ $s[$i] = substr(trim($scramword),$i,1); } $errors = 0; // see if the arrays are different $chk = array_diff($l,$s); if(!empty($chk)){ $errors = 1; } // see if arrays are different in reverse order $chk2 = array_diff($s,$l); if(!empty($chk2)){ $errors = 1; } // found scrambled word if(!$errors) { array_push($unscramwords,$line); } } }while(!feof($fh)); fclose($fh); } // print out comma seperated un scrambled words echo implode(",",$unscramwords); |