Jump to content

pixeltrace

Members
  • Posts

    577
  • Joined

  • Last visited

    Never

Everything posted by pixeltrace

  1. hi, sorry i wasnt able to get back on this since the last reply. been busy on other projects im confused on the array... anyway, how can i just simplify this code? //computation for the scaling if ($distance >= 0 && $distance<=1000) { $scale=$distance*21; } if ($distance >= 1001 && $distance<=2000) { $scale=$distance*20; } if ($distance >= 2001 && $distance<=3000) { $scale=$distance*19; } if ($distance >= 3001 && $distance<=4000) { $scale=$distance*18; } if ($distance >= 4001 && $distance<=5000) { $scale=$distance*18; } if ($distance >= 5001 && $distance<=6000) { $scale=$distance*16; } if ($distance >= 6001 && $distance<=7000) { $scale=$distance*16; } if ($distance >= 7001 && $distance<=8000) { $scale=$distance*16; } if ($distance >= 8001 && $distance<=9000) { $scale=$distance*16; } if ($distance >= 9001 && $distance<=10000) { $scale=$distance*16; } hope you could help me with this. thanks!
  2. thanks so much!!!!! its working now!!!!!
  3. hi, any help on this? i tried fixing it. i set the column to 5 but its displaying the wrong way and its repeating the items http://ideas-people.com/engsoon/brands.php this is the current code i have now <? include 'admean/db_connect.php'; include("admean/pagina/my_pagina_class.php"); $letter = ''; if (isset($_GET['sort'])) { if($_GET['sort'] != ''){ $letter = "WHERE substring(brand_name,1,1) = '". $_GET['sort'] ."'"; } } $test = new JHpage; $test->sql = "SELECT * FROM engsoon_brands ".$letter.""; //$test->sql = "SELECT * FROM engsoon_brands ORDER BY ".$sort1 ." ".$sort3." ".$sort2." "; // the (basic) sql statement (use the SQL whatever you like) $result = $test->get_page_result(); // result set $num_rows = $test->get_page_num_rows(); // number of records in result set $nav_links = $test->navigation(" | ", "currentStyle"); // the navigation links (define a CSS class selector for the current link) $nav_info = $test->page_info(); // information about the number of records on page ("to" is the text between the number) $simple_nav_links = $test->back_forward_link(true); // the navigation with only the back and forward links, use true to use images $total_recs = $test->get_total_rows(); // the total number of records ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <table width="500" border="0" cellspacing="4" cellpadding="0"> <tr> <td><span class="h2">Our Brands</span></td> </tr> <tr> <td>view brands by alphabetical order </td> </tr> <tr> <td>total record found:<?php echo " " .$total_recs; ?> </td> </tr> <tr> <td><a href="brands.php?id=2&sort=">All</a> <a href="brands.php?id=2&sort=A">A</a> <a href="brands.php?id=2&sort=B">B</a> <a href="brands.php?id=2&sort=C">C</a> <a href="brands.php?id=2&sort=D">D</a> <a href="brands.php?id=2&sort=E">E</a> <a href="brands.php?id=2&sort=F">F</a> <a href="brands.php?id=2&sort=G">G</a> <a href="brands.php?id=2&sort=H">H</a> <a href="brands.php?id=2&sort=I">I</a> <a href="brands.php?id=2&sort=J">J</a> <a href="brands.php?id=2&sort=K">K</a> <a href="brands.php?id=2&sort=L">L</a> <a href="brands.php?id=2&sort=M">M</a> <a href="brands.php?id=2&sort=N">N</a> <a href="brands.php?id=2&sort=O">O</a> <a href="brands.php?id=2&sort=P">P</a> <a href="brands.php?id=2&sort=Q">Q</a> <a href="brands.php?id=2&sort=R">R</a> <a href="brands.php?id=2&sort=S">S</a> <a href="brands.php?id=2&sort=T">T</a> <a href="brands.php?id=2&sort=U">U</a> <a href="brands.php?id=2&sort=V">V</a> <a href="brands.php?id=2&sort=W">W</a> <a href="brands.php?id=2&sort=X">X</a> <a href="brands.php?id=2&sort=Y">Y</a> <a href="brands.php?id=2&sort=Z">Z</a></td> </tr> <tr> <td> <? $columns = 5; //change the number of column while($row = mysql_fetch_array($result)) { $rows = ceil($num_rows / $columns); $data[] = $row['brands_logo']; $data1[] = $row['bid']; } echo "<table width='500' border='0' cellspacing='3' cellpadding='0'>\n"; for ($i = 0; $i < $num_rows; $i++) { echo "<tr>\n"; for($j = 0; $j < $columns; $j++) { if(isset($data[$i + ($j * $rows)])) { $bid = $data1[$i + ($j * $rows)]; echo "<td><a href ='brands.php?id=1&bid=$bid'><img src=\"../engsoon/images/brandlogo/" . $data[$i + ($j * $rows)] . "\"width='70' height='70'". "></a></td>\n"; } } echo "</tr>\n"; } echo "</table>\n"; ?> </td> </tr> <tr> <td align="right"> <? echo "<span>".$nav_links."</span>"; ?> </td> </tr> </table> </body> </html> hope you could help me on this. thanks so much!
  4. hi, i need help, i have a list page that has pagination and the list should be displayed in 5 columns. unfortunately, i cant make the column display work this is the link http://ideas-people.com/engsoon/brands.php and this is my current code <? include 'admean/db_connect.php'; include("admean/pagina/my_pagina_class.php"); $letter = ''; if (isset($_GET['sort'])) { if($_GET['sort'] != ''){ $letter = "WHERE substring(brand_name,1,1) = '". $_GET['sort'] ."'"; } } $test = new JHpage; $test->sql = "SELECT * FROM engsoon_brands ".$letter.""; //$test->sql = "SELECT * FROM engsoon_brands ORDER BY ".$sort1 ." ".$sort3." ".$sort2." "; // the (basic) sql statement (use the SQL whatever you like) $result = $test->get_page_result(); // result set $num_rows = $test->get_page_num_rows(); // number of records in result set $nav_links = $test->navigation(" | ", "currentStyle"); // the navigation links (define a CSS class selector for the current link) $nav_info = $test->page_info(); // information about the number of records on page ("to" is the text between the number) $simple_nav_links = $test->back_forward_link(true); // the navigation with only the back and forward links, use true to use images $total_recs = $test->get_total_rows(); // the total number of records ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <table width="500" border="0" cellspacing="4" cellpadding="0"> <tr> <td><span class="h2">Our Brands</span></td> </tr> <tr> <td>view brands by alphabetical order </td> </tr> <tr> <td>total record found:<?php echo " " .$total_recs; ?> </td> </tr> <tr> <td><a href="brands.php?id=2&sort=">All</a> <a href="brands.php?id=2&sort=A">A</a> <a href="brands.php?id=2&sort=B">B</a> <a href="brands.php?id=2&sort=C">C</a> <a href="brands.php?id=2&sort=D">D</a> <a href="brands.php?id=2&sort=E">E</a> <a href="brands.php?id=2&sort=F">F</a> <a href="brands.php?id=2&sort=G">G</a> <a href="brands.php?id=2&sort=H">H</a> <a href="brands.php?id=2&sort=I">I</a> <a href="brands.php?id=2&sort=J">J</a> <a href="brands.php?id=2&sort=K">K</a> <a href="brands.php?id=2&sort=L">L</a> <a href="brands.php?id=2&sort=M">M</a> <a href="brands.php?id=2&sort=N">N</a> <a href="brands.php?id=2&sort=O">O</a> <a href="brands.php?id=2&sort=P">P</a> <a href="brands.php?id=2&sort=Q">Q</a> <a href="brands.php?id=2&sort=R">R</a> <a href="brands.php?id=2&sort=S">S</a> <a href="brands.php?id=2&sort=T">T</a> <a href="brands.php?id=2&sort=U">U</a> <a href="brands.php?id=2&sort=V">V</a> <a href="brands.php?id=2&sort=W">W</a> <a href="brands.php?id=2&sort=X">X</a> <a href="brands.php?id=2&sort=Y">Y</a> <a href="brands.php?id=2&sort=Z">Z</a></td> </tr> <tr> <td> <? $columns = 5; //change the number of column for ($i = 0; $i < $num_rows; $i++) { $brands_logo = mysql_result($result, $i, "brands_logo"); $bid = mysql_result($result, $i, "bid"); //$brand_name = mysql_result($result, $i, "brand_name"); $rows = ceil($num_rows / $columns); $data[] = $brands_logo; $data1[] = $bid; echo "<table width='500' border='0' cellspacing='3' cellpadding='0'>\n"; echo "<tr>\n"; for($j = 0; $j < $columns; $j++) { if(isset($data[$i + ($j * $rows)])) { echo "<td><img src=\"../engsoon/images/brandlogo/" . $data[$i + ($j * $rows)] . "\"width='100' height='100'". "></td>\n"; echo "<td valign=\"top\">" . $data1[$i + ($j * $rows)] . "</td>\n"; } } echo "</tr>\n"; } echo "</table>\n"; ?> </td> </tr> <tr> <td align="right"> <? echo "<span>".$nav_links."</span>"; ?> </td> </tr> </table> </body> </html> hope you could help me fix this thanks so much!
  5. hi, i need help, i have a form with the list menu option in my edit form and this is my current code <select name="select"> <option value="" selected="selected">by brands</option> <? $uSql = "SELECT brand_name FROM engsoon_brands ORDER by brand_name DESC"; $uResult = mysql_query($uSql, $connection); if(!$uResult){ echo 'no data found'; }else{ while($uRow = mysql_fetch_array($uResult)){ ?> <option value="<?= $uRow['brand_name']?>" <? if ($_SESSION['brand_name'] =='$uRow['brand_name']'){echo "selected";} ?>> <?= $uRow['brand_name']?> </option> <? } } ?> </select> here what i wanted to happen is that if the brand_name from engsoon_brands is the current brand_name of that item i am editing it will echo or print the selected. however, its not working and the list item's value and name is blank hope you could help me fix this. thanks!
  6. hi, another thing. its kinda weird because even if i replace the value of the filename into letters. this is what i did $sql="UPDATE engsoon_brands SET brands_logo='sdasdasdasda', brand_name='$brand_name', brand_details='$brand_details', brand_url='$brand_url' WHERE bid='$bid'"; it still doesnt update that specific field in my database table eventhough i already put a value for brands_logo. is there something that needs to be set on that field? currently that field type is set to varchar(125) hope you could help me fix this thanks!
  7. hi, i already echo the $filename and i can get the value. however when it is executing the query already. $sql="UPDATE engsoon_brands SET brand_name='$brand_name', brand_details='$brand_details', brand_url='$brand_url', brands_logo='$brands_logo' WHERE bid='$bid'"; brands_logo is the only field that is not being updated in my database table. i dont know what is wrong. hope you could help me fix this. thanks so much!
  8. hi, i need help, i have a edit form with the upload file function everything is working fine except that i cant get the fiilename to be updated in my database i echo the $filename and its not giving me any values. hope you could help me solve this. below is my current code <? session_start(); if (session_is_registered("username")){ $username = $_SESSION['username']; $bid = $_GET['bid']; include 'db_connect.php'; $query = mysql_query("SELECT brand_name, brand_details, brand_url, brand_logo FROM engsoon_brands WHERE bid= '$bid'") or die(mysql_error()); $row = mysql_fetch_array( $query ); $brand_name = $row["brand_name"]; $brand_details = $row["brand_details"]; $brand_url = $row["brand_url"]; $brand_logo = $row["brand_logo"]; if ($_GET['upload'] == 'yes'){ //uses $_FILES[] global array //see manual for older PHP version info //This function will be used to get the extension from the filename function get_extension($file,$length=-1){ $p = strrpos($file,"."); $p++; if($length!=-1){ $ext = substr($file,$p,$length); } if($length==-1){ $ext = substr($file,$p); } $ext = strtolower($ext); return $ext; } //Not good practice, but here anyway //change to suit your needs //also some have to be set in the ini //for this to correctly work //2meg max ini_set("upload_max_filesize","200K"); //turn on file uploads ini_set("file_uploads","1"); //set your temp dir ini_set("upload_tmp_dir","/tmp/"); //set post size large enough to accomidate //3 2meg files and some overhead ini_set("post_max_size","200K"); } ?> <? //check to see if we have submited yet if($_POST["submit"]!="submit"){ //not yet so lets make the form ?> <table width="100" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="6" align="left"><img src="../images/spacer.gif" width="6" height="10" /></td> <td width="100%"><table width="216" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td align="left" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td> <td width="214" valign="top"> <form name="fileup" method="post" enctype="multipart/form-data" action="<? echo $PHP_SELF; ?>"> <table width="515" border="0" cellspacing="2" cellpadding="3"> <tr> <td colspan="4" valign="top"><img src="images/spacer.gif" width="10" height="1" /></td> </tr> <tr> <td colspan="4" bgcolor="#999999" class="text2">BRAND INFORMATION</td> </tr> <tr> <td colspan="4" valign="top"><img src="images/spacer.gif" width="10" height="10" /></td> </tr> <tr> <td width="126" align="right" valign="top" class="text6">brand name : </td> <td> </td> <td colspan="2" class="text7"><input name="brand_name" type="text" size="40" value="<? echo "$brand_name"; ?>" readonly></td> </tr> <tr> <td align="right" valign="top" class="text6">details: </td> <td width="6"> </td> <td colspan="2"><textarea name="brand_details" cols="40" rows="5"><? echo "$brand_details"; ?></textarea></td> </tr> <tr> <td align="right" valign="top" class="text6">URL : </td> <td width="6"> </td> <td colspan="2"><span class="text7"> <input name="brand_url" type="text" size="40" value="<? echo "$brand_url"; ?>"> </span></td> </tr> <tr> <td align="right" valign="top" class="text6">current logo :</td> <td> </td> <td width="102"><img src=" <? if ($brand_logo == "") { echo "../images/nopic.gif"; }else{ echo "../images/brandlogo/$brand_logo"; } ?>" width="100" height="100" style="border:solid; border-color:#0000FF; border-width:1px"></td> <td width="247" align="left" valign="bottom"><a href="brandsmngr.php?id=3&bid=<? echo "$bid"; ?>&upload=yes" class="link1">upload new logo</a> </td> </tr> <? if ($_GET['upload'] == 'yes'){ echo " <tr> <td align='right' valign='top' class='text6'>update logo : </td> <td> </td> <td colspan='2'><input type='file' name='userfiles[]'></td> </tr> <tr> <td align='right' valign='top' class='text6'> </td> <td> </td> <td colspan='2' class='text6'>upload jpg or gif files only (max size 200K) </td> </tr> "; } ?> <tr> <td rowspan="2"> </td> <td rowspan="2"> </td> <td colspan="2"> <input type="hidden" name="MAX_FILE_SIZE" value="200000"> <input type="submit" value="submit" name="submit"> <input type="hidden" name="username" value="<? echo "$username"; ?>"> <input type=hidden value=http://www. name=redirect> <input type="hidden" value="<? echo "$brand_logo"; ?>" name="brand_logo" /> <input type="hidden" value="<? echo "$bid"; ?>" name="bid" /></td> </tr> <tr> <td colspan="2"> </td> </tr> </table> </form> </td> <td align="right" bgcolor="#3261BB" width="1"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> <tr> <td colspan="3" valign="top" bgcolor="#3261BB"><img src="images/spacer.gif" width="1" height="1" /></td> </tr> </table></td> <td width="6" align="right"><img src="../images/spacer.gif" width="6" height="10" /></td> </tr> </table> <? } ?> <? if ($_GET['upload'] =='yes'){ //see if we have submited and that the files array has been set if(($_POST["submit"]=="submit")&&(is_array($_FILES['userfiles']))){ $ftp_user_name="user"; //change to ftp username $ftp_user_pass="pass"; //change to ftp password $ftp_server="domain"; //change to ftp url $ftp_dump_dir="/location/"; //change to destination directory //go through all the files for($x=0;$x<count($_FILES['userfiles']['name']);$x++){ //now we do some file checking //check to see if file is there if($_FILES['userfiles']['name'][$x]!="none"){ //file has a name //check filesize if($_FILES['userfiles']['size'][$x]!=0){ //file is larger than 0 bytes //Check to see if it is uploaded if(is_uploaded_file($_FILES['userfiles']['tmp_name'][$x])){ //file has been uploaded! //let the user know their file has be uploaded echo "file ".$_FILES['userfiles']['name'][$x]." uploaded!<br>"; //conect to ftp server $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!<br>"; echo "Attempted to connect to $ftp_server for user $ftp_user_name"; exit; } else { echo "Connected to $ftp_server! <br>"; //set PASV mode if(!ftp_pasv($conn_id,TRUE)){ echo "Could not enter PASV mode!"; } //rename to file#_date.ext //$filename = "file".($x+1)."_".date("MdY"); $filename = $brand_name; $filename.= ".".get_extension($_FILES['userfiles']['name'][$x],3); //change directory if (@ftp_chdir($conn_id, $ftp_dump_dir)) { //maybe you want to make sure we are in the correct directory echo "Current directory is now : ", ftp_pwd($conn_id), "\n"; } else { //you want to know if it didn't work echo "Couldn't change directory\n"; } //upload the file and let the user know what happened if(ftp_put($conn_id,$filename,$_FILES['userfiles']['tmp_name'][$x],FTP_BINARY)){ echo "File ".$_FILES['userfiles']['name'][$x]." was sent successfully<br>"; echo "File was named ".$filename."<br>"; }else{ echo "There was a problem sending file ".$_FILES['userfiles']['name'][$x]."<br>";; } } // close the FTP stream ftp_close($conn_id); } else echo"brand was not added!<br>"; } } echo "<br>"; }//end for loop $brand_name = $_POST['brand_name']; $brand_details = $_POST['brand_details']; $brand_url = $_POST['brand_url']; $brand_name = stripslashes($brand_name); $brand_details = stripslashes($brand_details); $brand_url = stripslashes($brand_url); $sql="UPDATE engsoon_brands SET brand_name='$brand_name', brand_details='$brand_details', brand_url='$brand_url', brand_logo='$filename' WHERE bid='$bid'"; mysql_query($sql) or die("error:".mysql_error()); echo '<script language=javascript> alert("brand has been updated1!");top.location = "brandsmngr.php?id=2";</script>'; } } if(($_POST["submit"]=="submit")&&($upload !== 'yes')){ $brand_name = $_POST['brand_name']; $brand_details = $_POST['brand_details']; $brand_url = $_POST['brand_url']; $brand_logo = $_POST['brandlogo']; $brand_name = stripslashes($brand_name); $brand_details = stripslashes($brand_details); $brand_url = stripslashes($brand_url); $sql="UPDATE engsoon_brands SET brand_name='$brand_name', brand_details='$brand_details', brand_url='$brand_url', brand_logo='$brand_logo' WHERE bid='$bid'"; mysql_query($sql) or die("error:".mysql_error()); echo '<script language=javascript> alert("brand has been updated2!");top.location = "brandsmngr.php?id=2";</script>'; } }else{ echo "<font face=\"Arial\">You are not authorized to access this page ... Please <a href='../index.php'>Login</a></font>"; } ?> thanks so much!
  9. hi, i was able to solve it already. i used the codes from this page http://www.phpfreaks.com/quickcode/Basic-FTP-File-upload-with-form/622.php it really works. thanks!
  10. hi, any help on this one please? i was able to located the allowed folder already but when i run submit my form with the file upload. its telling me that the adding of the brand item is successful however when i go to the folder where the images were supposed to be save is empty. below is my codes <? session_start(); if (session_is_registered("username")){ }else{ echo "<font face=\"Arial\">You are not authorized to access this page ... Please <a href='../index.php'>Login</a></font>"; } include 'db_connect.php'; $brand_name = $_POST['brand_name']; $brand_details = $_POST['brand_details']; $brand_url = $_POST['brand_url']; $userfile = $_POST['userfile']; $date_created = date('Y-m-d'); $username = $_POST['username']; $photo = $_POST['photo']; if ($_FILES["photo"]["error"] > 0) { echo "Error: " . $_FILES["photo"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["photo"]["name"] . "<br />"; echo "Type: " . $_FILES["photo"]["type"] . "<br />"; echo "Size: " . ($_FILES["photo"]["size"] / 2000) . " Kb<br />"; echo "Stored in: " . $_FILES["photo"]["tmp_name"]; } if ($_FILES["photo"]["error"] > 0) { echo "Return Code: " . $_FILES["photo"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["photo"]["name"] . "<br />"; echo "Type: " . $_FILES["photo"]["type"] . "<br />"; echo "Size: " . ($_FILES["photo"]["size"] / 2000) . " Kb<br />"; echo "Temp file: " . $_FILES["photo"]["tmp_name"] . "<br />"; if (file_exists("tmp/brandlogo/" . $_FILES["photo"]["name"])) { echo $_FILES["photo"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["photo"]["tmp_name"], "tmp/brandlogo/" . $_FILES["file"]["name"]); echo "Stored in: " . "tmp/brandlogo/" . $_FILES["photo"]["name"]; } } //brand verification $sql_brand_name_check = mysql_query("SELECT brand_name FROM engsoon_brands WHERE brand_name='$brand_name'"); $brand_name_check = mysql_num_rows($sql_brand_name_check); if($brand_name_check > 0){ echo '<script language=javascript> alert("brand name already exist!");top.location = "brandsmngr.php?id=1";</script>'; unset($brand_name); exit(); } $brand_name = stripslashes($brand_name); $b_letter = stripslashes($b_letter); $brand_details = stripslashes($brand_details); $brand_url = stripslashes($brand_url); $$date_create = stripslashes($$date_create); $sql = mysql_query("INSERT INTO engsoon_brands (brand_name, brand_details, brand_url, date_created, brand_logo ) VALUES('$brand_name', '$brand_details', '$brand_url', '$date_created', '$photo')") or die (mysql_error()); if(!$sql){ echo '<script language=javascript> alert("Error adding brand");top.location = "brandsmngr.php?id=1";</script>'; exit(); } else { $bid = mysql_insert_id(); echo '<script language=javascript> alert("new brand has been added!");top.location = "brandsmngr.php?id=2";</script>'; } ?> hope you could help me with this. thanks so much!
  11. hi, i have a edit form for my brand items and one of the items that i may need some validation is the brand name. my problem is, i need a validation code for the brand name wherein if the brandname was changed it will execute this validation to check if there is already an existing brand name but if the brandname was not changed it will not execute this validation code. currently this the validation code that i am using $sql_brand_name_check = mysql_query("SELECT brand_name FROM engsoon_brands WHERE brand_name!='$brand_name' AND bid!='$bid'"); $brand_name_check = mysql_num_rows($sql_brand_name_check); if($brand_name_check > 0){ echo '<script language=javascript> alert("brand name already exist.<br>use a different brand name!");top.location = "brandsmngr.php?id=3&bid='.$bid.'";</script>'; unset($brand_name); exit(); this one no matter i modify the brand name or not, its still prompting me the message. hope you could help me fix this. thanks!
  12. hi, i have a pagination that has the alphabet buttons also. how to i set the query so that when i click the letter it will return the list wherein all names starts with that letter let say, i click letter "A" in the return list, all names starting at A will be listed. hope you could help me with this. thanks!
  13. thanks! its working now i just forgot to add the exit;
  14. hi, i have a from for you to add new brands, and in my validation page (addbrands.php) i am getting error on that validation code Fatal error: Call to undefined function: error() in /home/brennan/public_html/ideas-people/engsoon/admean/brands/addbrands.php on line 65 and this is my current code <? session_start(); if (session_is_registered("username")){ }else{ echo "<font face=\"Arial\">You are not authorized to access this page ... Please <a href='../index.php'>Login</a></font>"; } include '../db_connect.php'; $brandname = $_POST['brand_name']; $b_letter = $_POST['b_letter']; $brand_details = $_POST['brand_details']; $brand_url = $_POST['brand_url']; $brand_logo = $_POST['brand_logo']; $date_created = date('Y-m-d'); $username = $_POST['username']; //brand verification $sql_brandname_check = mysql_query("SELECT brand_name FROM engsoon_brands WHERE brand_name='$brandname'"); $brandname_check = mysql_num_rows($sql_brandname_check); if($brandname_check > 0){ error ('Brand already exist!'); } $brandname = stripslashes($brandname); $b_letter = stripslashes($b_letter); $brand_details = stripslashes($brand_details); $brand_url = stripslashes($brand_url); $$date_create = stripslashes($$date_create); $brand_logo = stripslashes($brand_logo); $sql = mysql_query("INSERT INTO engsoon_brands (brand_name, b_letter, brand_details, brand_url, date_created, brand_logo ) VALUES('$brandname', '$b_letter', '$brand_details', '$brand_url', '$date_created', '$brand_logo')") or die (mysql_error()); if(!$sql){ echo '<script language=javascript> alert("Error adding brand");top.location = "../brandsmngr.php?id=1&username='.$username.'";</script>'; exit(); } else { $bid = mysql_insert_id(); echo '<script language=javascript> alert("new brand has been added!");top.location = "../brandsmngr.php?id=2&username='.$username.'";</script>'; } ?> i dont know whats wrong on line 65 because its just an error message hope you could help me fix this. thanks so much!
  15. hi, from my understanding, this is already a settings that needs to be done in the php.ini is there any php code that you can run so that when you execute the file upload form it will either enable or disable the open_basedir in the php.ini? hope you could help me with this. thanks so much!
  16. hi, i tried another code but its giving me another error Warning: copy() [function.copy]: open_basedir restriction in effect. File(/public_html/ideas-people/engsoon/images/brandlogo/2ca0.jpg) is not within the allowed path(s): (/home/brennan:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/brennan/public_html/ideas-people/engsoon/admean/brands/addbrands.php on line 40 Warning: copy(/public_html/ideas-people/engsoon/images/brandlogo/2ca0.jpg) [function.copy]: failed to open stream: Operation not permitted in /home/brennan/public_html/ideas-people/engsoon/admean/brands/addbrands.php on line 40 upload failed! and this is my current code for my form <form action="brands/addbrands.php" method="post" enctype="multipart/form-data"> <table width="515" border="0" cellspacing="2" cellpadding="3"> <tr> <td colspan="3" valign="top"><img src="images/spacer.gif" width="10" height="1" /></td> </tr> <tr> <td colspan="3" bgcolor="#999999" class="text2">BRAND INFORMATION</td> </tr> <tr> <td colspan="3" valign="top"><img src="images/spacer.gif" width="10" height="10" /></td> </tr> <tr> <td width="137" align="right" valign="top" class="text6">brand name : </td> <td> </td> <td class="text7"><input name="brand_name" type="text" size="40"></td> </tr> <tr> <td align="right" valign="top" class="text6">letter : </td> <td width="7"> </td> <td width="363"><span class="text6"> <select name="b_letter"> <option value="">by letter</option> <option value="A">A</option> <option value="B">B</option> <option value="C">C</option> <option value="D">D</option> <option value="E">E</option> <option value="F">F</option> <option value="G">G</option> <option value="H">H</option> <option value="I">I</option> <option value="J">J</option> <option value="K">K</option> <option value="L">L</option> <option value="M">M</option> <option value="N">N</option> <option value="O">P</option> <option value="Q">Q</option> <option value="R">R</option> <option value="S">S</option> <option value="T">T</option> <option value="U">U</option> <option value="V">V</option> <option value="W">W</option> <option value="X">X</option> <option value="Y">Y</option> <option value="Z">Z</option> </select> </span></td> </tr> <tr> <td align="right" valign="top" class="text6">details: </td> <td width="7"> </td> <td><textarea name="brand_details" cols="50" rows="5"></textarea></td> </tr> <tr> <td align="right" valign="top" class="text6">URL : </td> <td width="7"> </td> <td width="363"><span class="text7"> <input name="brand_url" type="text" size="40" /> </span></td> </tr> <tr> <td align="right" valign="top" class="text6">logo : </td> <td> </td> <td><input type="file" name="userfile" class="button1" /></td> </tr> <tr> <td align="right" valign="top" class="text6"> </td> <td> </td> <td class="text6">upload jpg or gif files only (max size 100K) </td> </tr> <tr> <td rowspan="2"> </td> <td rowspan="2"> </td> <td><input type="submit" name="Submit" value="save" /> <input type="hidden" name="username" value="<? echo "$username"; ?>"> <input type=hidden value=http://www. name=redirect> </td> </tr> <tr> <td> </td> </tr> </table> </form> and this is the current code in my addbrands.php <? session_start(); if (session_is_registered("username")){ }else{ echo "<font face=\"Arial\">You are not authorized to access this page ... Please <a href='../index.php'>Login</a></font>"; } include '../db_connect.php'; $brand_name = $_POST['brand_name']; $b_letter = $_POST['b_letter']; $brand_details = $_POST['brand_details']; $brand_url = $_POST['brand_url']; $brand_logo = $_POST['brand_logo']; $date_created = date('Y-m-d'); $username = $_POST['username']; $path = "/public_html/ideas-people/engsoon/images/brandlogo/"; $max_size = 200000; if (!isset($HTTP_POST_FILES['userfile'])) exit; if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) { if ($HTTP_POST_FILES['userfile']['size']>$max_size) { echo "The file is too big<br>"; exit; } if (($HTTP_POST_FILES['userfile']['type']=="image/gif") || ($HTTP_POST_FILES['userfile']['type']=="image/pjpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/jpeg") || ($HTTP_POST_FILES['userfile']['type']=="image/png")) { if (file_exists($path . $HTTP_POST_FILES['userfile']['name'])) { echo "The file already exists<br>"; exit; } $res = copy($HTTP_POST_FILES['userfile']['tmp_name'], $path . $HTTP_POST_FILES['userfile']['name']); if (!$res) { echo "upload failed!<br>"; exit; } else { echo "upload sucessful<br>"; } echo "File Name: ".$HTTP_POST_FILES['userfile']['name']."<br>"; echo "File Size: ".$HTTP_POST_FILES['userfile']['size']." bytes<br>"; echo "File Type: ".$HTTP_POST_FILES['userfile']['type']."<br>"; } else { echo "Wrong file type<br>"; exit; } } $my_file = $HTTP_POST_FILES['userfile']['name']; $brand_name = stripslashes($brand_name); $b_letter = stripslashes($b_letter); $brand_details = stripslashes($brand_details); $brand_url = stripslashes($brand_url); $$date_create = stripslashes($$date_create); $brand_logo = stripslashes($brand_logo); $sql = mysql_query("INSERT INTO engsoon_brands (brand_name, b_letter, brand_details, brand_url, date_created, brand_logo ) VALUES('$brand_name', '$b_letter', '$brand_details', '$brand_url', '$date_created', '$userfile')") or die (mysql_error()); if(!$sql){ echo '<script language=javascript> alert("Error adding brand");top.location = "../brandsmngr.php?id=1&username='.$username.'";</script>'; exit(); } else { $bid = mysql_insert_id(); echo '<script language=javascript> alert("new brand has been added!");top.location = "../brandsmngr.php?id=2&username='.$username.'";</script>'; } ?> hope you could help me with this. thanks so much!
  17. hi any help on this please? thanks!
  18. hi, i tried changing the uploadpath already but i am still getting some errors this is the error i am getting Warning: move_uploaded_file() [function.move-uploaded-file]: open_basedir restriction in effect. File(/images/brandlogo/ogo/) is not within the allowed path(s): (/home/brennan:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/brennan/public_html/ideas-people/engsoon/admean/brands/addbrands.php on line 34 i print the $uploadfile already and this is what i get /images/brandlogo/ogo/ where does the "ogo" come from, since the upload path i used is "images/brandlogo/" below is my current code <? session_start(); if (session_is_registered("username")){ }else{ echo "<font face=\"Arial\">You are not authorized to access this page ... Please <a href='../index.php'>Login</a></font>"; } include '../db_connect.php'; $brand_name = $_POST['brand_name']; $b_letter = $_POST['b_letter']; $brand_details = $_POST['brand_details']; $brand_url = $_POST['brand_url']; $brand_logo = $_POST['brand_logo']; $date_create = ('Y-m-d'); $username = $_POST['username']; //set this to the directory where resume files will be uploaded //directory path $uploaddir = '/images/brandlogo/'; //get the dirrectory to send file to and the file name $uploadfile = $uploaddir . basename($_FILES['brand_logo']['brand_name']); // get the current file information. $file=$uploadfile; //get the . and file exstention. $ext = substr($file, -4); //convert varable to the uplaoded directory the new id and extention. $uploadfile=$uploaddir.$appid.$ext; //rename the file to the new one. @rename($file,$uploadfile); // if all the conditions are correct send the file to the directory. print_r($uploadfile); if(move_uploaded_file($_FILES['brand_logo']['tmp_name'], $uploadfile)) { $brand_name = stripslashes($brand_name); $b_letter = stripslashes($b_letter); $brand_details = stripslashes($brand_details); $brand_url = stripslashes($brand_url); $$date_create = stripslashes($$date_create); $brand_logo = stripslashes($brand_logo); $sql = mysql_query("INSERT INTO engsoon_brands (brand_name, b_letter, brand_details, brand_url, date_created, brand_logo ) VALUES('$brand_name', '$b_letter', '$brand_details', '$brand_url', '$date_created', '$uploadfile')") or die (mysql_error()); if(!$sql){ echo '<script language=javascript> alert("Error adding brand");top.location = "../brandsmngr.php?id=1&username='.$username.'";</script>'; exit(); } else { $bid = mysql_insert_id(); echo '<script language=javascript> alert("new brand has been added!");top.location = "../brandsmngr.php?id=2&username='.$username.'";</script>'; } } else{ echo '<script language=javascript> alert("error uploading image, please try again");history.back() = "brandsmngr.php?id=1&username='.$username.'";</script>'; } ?> hope you could help me with this. thanks so much!
  19. hi, any luck on this one? the link is meant for ftp file upload. hope someone could help me on this. thanks!
  20. hi, i need help, i have a form that submits text information and image file but currently i am having errors or problem with the file upload codes that i have below is the code of my form <form action="brands/addbrands.php" method="post" enctype="multipart/form-data"> <table width="515" border="0" cellspacing="2" cellpadding="3"> <tr> <td colspan="3" valign="top"><img src="images/spacer.gif" width="10" height="1" /></td> </tr> <tr> <td colspan="3" bgcolor="#999999" class="text2">BRAND INFORMATION</td> </tr> <tr> <td colspan="3" valign="top"><img src="images/spacer.gif" width="10" height="10" /></td> </tr> <tr> <td width="137" align="right" valign="top" class="text6">brand name : </td> <td> </td> <td class="text7"><input name="brand_name" type="text" size="40"></td> </tr> <tr> <td align="right" valign="top" class="text6">letter : </td> <td width="7"> </td> <td width="363"><span class="text6"> <select name="b_letter"> <option value="">by letter</option> <option value="A">A</option> <option value="B">B</option> <option value="C">C</option> <option value="D">D</option> <option value="E">E</option> <option value="F">F</option> <option value="G">G</option> <option value="H">H</option> <option value="I">I</option> <option value="J">J</option> <option value="K">K</option> <option value="L">L</option> <option value="M">M</option> <option value="N">N</option> <option value="O">P</option> <option value="Q">Q</option> <option value="R">R</option> <option value="S">S</option> <option value="T">T</option> <option value="U">U</option> <option value="V">V</option> <option value="W">W</option> <option value="X">X</option> <option value="Y">Y</option> <option value="Z">Z</option> </select> </span></td> </tr> <tr> <td align="right" valign="top" class="text6">details: </td> <td width="7"> </td> <td><textarea name="brand_details" cols="50" rows="5"></textarea></td> </tr> <tr> <td align="right" valign="top" class="text6">URL : </td> <td width="7"> </td> <td width="363"><span class="text7"> <input name="brand_url" type="text" size="40" /> </span></td> </tr> <tr> <td align="right" valign="top" class="text6">logo : </td> <td> </td> <td><input type="file" name="brand_logo" class="button1" /></td> </tr> <tr> <td align="right" valign="top" class="text6"> </td> <td> </td> <td class="text6">upload jpg or gif files only (max size 100K) </td> </tr> <tr> <td rowspan="2"> </td> <td rowspan="2"> </td> <td><input type="submit" name="Submit" value="save" /> <input type="hidden" name="username" value="<? echo "$username"; ?>"> <input type=hidden value=http://www. name=redirect> </td> </tr> <tr> <td> </td> </tr> </table> </form> and below is the code for my addbrands.php <? session_start(); if (session_is_registered("username")){ }else{ echo "<font face=\"Arial\">You are not authorized to access this page ... Please <a href='../index.php'>Login</a></font>"; } include '../db_connect.php'; $brand_name = $_POST['brand_name']; $b_letter = $_POST['b_letter']; $brand_details = $_POST['brand_details']; $brand_url = $_POST['brand_url']; $brand_logo = $_POST['brand_logo']; $date_create = ('Y-m-d'); $username = $_POST['username']; //set this to the directory where resume files will be uploaded //directory path $uploaddir = '../ideas-people/engsoon/images/brandlogo/'; //get the dirrectory to send file to and the file name $uploadfile = $uploaddir . basename($_FILES['brand_logo']['brand_name']); // get the current file information. $file=$uploadfile; //get the . and file exstention. $ext = substr($file, -4); //convert varable to the uplaoded directory the new id and extention. $uploadfile=$uploaddir.$appid.$ext; //rename the file to the new one. @rename($file,$uploadfile); // if all the conditions are correct send the file to the directory. if(move_uploaded_file($_FILES['brand_logo']['tmp_name'], $uploadfile)) { $brand_name = stripslashes($brand_name); $b_letter = stripslashes($b_letter); $brand_details = stripslashes($brand_details); $brand_url = stripslashes($brand_url); $$date_create = stripslashes($$date_create); $brand_logo = stripslashes($brand_logo); $sql = mysql_query("INSERT INTO engsoon_brands (brand_name, b_letter, brand_details, brand_url, date_created, brand_logo ) VALUES('$brand_name', '$b_letter', '$brand_details', '$brand_url', '$date_created', '$uploadfile')") or die (mysql_error()); if(!$sql){ echo '<script language=javascript> alert("Error adding brand");top.location = "../brandsmngr.php?id=1&username='.$username.'";</script>'; exit(); } else { $bid = mysql_insert_id(); echo '<script language=javascript> alert("new brand has been added!");top.location = "../brandsmngr.php?id=2&username='.$username.'";</script>'; } } else{ echo '<script language=javascript> alert("error uploading image, please try again");history.back() = "brandsmngr.php?id=1&username='.$username.'";</script>'; } ?> this is the error message i am getting Warning: move_uploaded_file(../ideas-people/engsoon/images/brandlogo/ogo/) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/brennan/public_html/ideas-people/engsoon/admean/brands/addbrands.php on line 33 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpRmad0S' to '../ideas-people/engsoon/images/brandlogo/ogo/' in /home/brennan/public_html/ideas-people/engsoon/admean/brands/addbrands.php on line 33 i have set the attributes of that folder already and is located at this exact directory /public_html/ideas-people/engsoon/images/brandlogo/ i cannot determine what was the problem hope you could help me fix the code thanks so much!
  21. but what if let say i am in http://www.yahoo.com or http://www.google.com? and i want to automatically grab the current URL for the $url? hope you could help me with this. thanks!
  22. Hi, i need help. i have a link "send to a friend" where in if i click it, it will pop up a new window and will supposed to be grabbing the URL of that page what is the code for me to add in my "send to a friend" button so i can grab the URL of that page and send it in the pop up form? currently this is the code that i have for my "send to a friend" button <a href='javascript:void(0)' onclick="window.open('index2.php?option=com_content&task=emailform&id=18&subjectline=Mumcentre%20Online%20Forum&customurl=option%3Dcom_simpleboard','win2','status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,resizable=yes,width=540,height=440,directories=no,location=no');"'><img src="images/M_images/sendafriend2.png" alt="Send To A Friend" name="Print" height="19" border="0" align="middle" /></a> what code will i use for this part index2.php?option=com_content&task=emailform&id=18 so it will automatically grab whatever the current url is? hope you could help me with this. thanks!
  23. hi, is there any pagination php script available online which also has an alphabetical buttons? thanks!
  24. thanks so much for all the responses i'll try these. thanks!
  25. hi, i have a project that needs a database but doesnt have MySQL DB any other suggestions as to what i can use to store its data? thanks!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.