PHP - Using Php To Copy And Edit Another Php File
hey guys its me again. what i want is for me to be able to edit php using variables and post it as a new file. now to attchieve this i am simply copying the current template into the php file and telling it to grap what variables it needs. i have successfully done this with a .css file but when im doing it with a php file its erroring at <?php as the file is already in php. what i need to know is can i have the php file look at the <?php as just text to write to a file? my code is below
Code: [Select] $dir = "../Header/"; $file = "" . $branchid . ".php"; $dir = "$dir"."$file"; touch($dir); $Handle = fopen($dir, 'w'); $Data = " <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <?php //We count the number of new messages the user has $nb_new_pm = mysql_fetch_array(mysql_query('select count(*) as nb_new_pm from pm where ((user1="'.$_SESSION['user_id'].'" and user1read="no") or (user2="'.$_SESSION['user_id'].'" and user2read="no")) and id2="1"')); //The number of new messages is in the variable $nb_new_pm $nb_new_pm = $nb_new_pm['nb_new_pm']; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <style type="text/css"> /* Remove margins from the 'html' and 'body' tags, and ensure the page takes up full screen height */ html, body { margin:0; padding:0;} /* Set the position and dimensions of the background image. */ #page-background {position:fixed; top:0; left:0; width:100%; height:100%;} /* Specify the position and layering for the content that needs to appear in front of the background image. Must have a higher z-index value than the background image. Also add some padding to compensate for removing the margin from the 'html' and 'body' tags. */ #content {position:relative; z-index:1; padding:10px;} </style> <head> <title>Apollo - Data Management System</title> <!--Links--> <link rel="icon" type="image/ico" href="favicon.ico"></link> <link rel="stylesheet" media="all" type="text/css" href="/styles.css" /> </head> <body> <div id="Headerlogo"> <img src="/images/PaulKemp/PaulBanner.png" width="100%" alt="Smile"></div> <div class="wrapper1"> <div class="wrapper"> <div class="nav-wrapper"> <div class="nav"> <ul id="navigation"> <li class="active"> <a href="/Main/myaccount.php"> <span class="menu-left"></span> <span class="menu-mid">Main Menu</span> <span class="menu-right"></span> </a> </li> <li class=""> <a href="/PersonnelMessages/list_pm.php"> <span class="menu-left"></span> <span class="menu-mid"><b>Messages(<?php echo $nb_new_pm; ?> unread)</b></span> <span class="menu-right"></span> </a> <div class="sub"> <ul> <li> <a href="/PersonnelMessages/new_pm.php">New Personal Message</a> </li> </ul> <div class="btm-bg"></div> </div> </li> <?php if (checkMasterAdmin()) { ?> <li class=""> <a href="#"> <span class="menu-left"></span> <span class="menu-mid">Admin</span> <span class="menu-right"></span> </a> <div class="sub"> <ul> <li> <a href="/Admin/UploadServices.php">New KPI</a> </li> <li> <a href="/Admin/MonthReview.php">New Month Review</a> </li> <li> <a href="/Admin/CreateUser.php">New User</a> </li> <li> <a href="/Admin/EditUsers.php">Edit User</a> </li> <li> <a href="/Admin/HolidayRequests.php">Authorise Holidays</a> </li> <li> <a href="/Backup/BackupSite.php">Backup</a> </li> <li> <a href="/PersonnelMessages/CompanyAnnouncement.php">Company Announcements</a> </li> <li> <a href="/PersonnelMessages/DeleteAnnouncements.php">Delete Announcements</a> </li> </ul> <div class="btm-bg"></div> </div> </li> <?php } ?> <?php if (checkAdmin()) { ?> <li class=""> <a href="#"> <span class="menu-left"></span> <span class="menu-mid">Admin</span> <span class="menu-right"></span> </a> <div class="sub"> <ul> <li> <a href="/Admin/UploadServices.php">New KPI</a> </li> <li> <a href="/Admin//MonthReview.php">New Month Review</a> </li> <li> <a href="/Admin/CreateUser.php">New User</a> </li> <li> <a href="/Admin/EditUsers.php">Edit User</a> </li> <li> <a href="/Admin/HolidayRequests.php">Authorise Holidays</a> </li> <li> <a href="/Backup/BackupSite.php">Backup</a> </li> <li> <a href="/PersonnelMessages/CompanyAnnouncement.php">Company Announcements</a> </li> <li> <a href="/PersonnelMessages/DeleteAnnouncements.php">Delete Announcements</a> </li> </ul> <div class="btm-bg"></div> </div> </li> <?php } ?> <?php if (checkBranchOwner()) { ?> <li class=""> <a href="#"> <span class="menu-left"></span> <span class="menu-mid">Admin</span> <span class="menu-right"></span> </a> <div class="sub"> <ul> <li> <a href="/Admin/UploadServices.php">New KPI</a> </li> <li> <a href="/Admin//MonthReview.php">New Month Review</a> </li> <li> <a href="/Admin/CreateUser.php">New User</a> </li> <li> <a href="/Admin/EditUsers.php">Edit User</a> </li> <li> <a href="/Admin/HolidayRequests.php">Authorise Holidays</a> </li> <li> <a href="/Backup/BackupSite.php">Backup</a> </li> <li> <a href="/PersonnelMessages/CompanyAnnouncement.php">Company Announcements</a> </li> <li> <a href="/PersonnelMessages/DeleteAnnouncements.php">Delete Announcements</a> </li> </ul> <div class="btm-bg"></div> </div> </li> <?php } ?> <li class=""> <a href="#"> <span class="menu-left"></span> <span class="menu-mid">Staff</span> <span class="menu-right"></span> </a> <div class="sub"> <ul> <li> <a href="/Staff/ChangePassword.php">Change Password</a> </li> <li> <a href="/Staff/mysettings.php">Change Details</a> </li> <li> <a href="/Staff/HolidaysLeft.php">Holidays Left</a> </li> <li> <a href="/Staff/profile.php">My Profile</a> </li> <li> <a href="/Staff/MyServices.php">My Services</a> </li> <li> <a href="/Viewmonthreports.php">Month Review</a> </li> </ul> <div class="btm-bg"></div> </div> </li> <li class=""> <a href="#"> <span class="menu-left"></span> <span class="menu-mid">Referrers</span> <span class="menu-right"></span> </a> <div class="sub"> <ul> <li> <a href="/Referrers/Newreferrers.php">New Referrers</a> </li> <li> <a href="/Referrers/SendReferrers.php">Send Referrers</a> </li> </ul> <div class="btm-bg"></div> </div> </li> <li class=""> <a href="#"> <span class="menu-left"></span> <span class="menu-mid">Holidays</span> <span class="menu-right"></span> </a> <div class="sub"> <ul> <li> <a href="/Holidays/RequestHoliday.php">Book Off Holiday</a> </li> <?php if (checkAdmin()) { ?> <li> <a href="/Admin/HolidayAmendments.php">Amend Holidays</a> </li> <li> <a href="/Admin/CancelledHolidays.php">Show Cancelled Holidays</a> </li> </li> <li> <a href="/reports/holidayreports.php">holiday report</a> </li> <?php } ?> <?php if (checkMasterAdmin()) { ?> <li> <a href="/Admin/HolidayAmendments.php">Amend Holidays</a> </li> <li> <a href="/Admin/CancelledHolidays.php">Show Cancelled Holidays</a> </li> <li> <a href="/reports/holidayreports.php">holiday report</a> </li> <?php } ?> </ul> <div class="btm-bg"></div> </div> </li> <li class=""> <a href="/logout.php"> <span class="menu-left"></span> <span class="menu-mid">Logout</span> <span class="menu-right"></span> </a> </li> </ul> </div> </div> </div> </div> <br /> "; fwrite($Handle, $Data); $Data = "Bilbo Jones\n"; fwrite($Handle, $Data); print "Data Written"; fclose($Handle); Similar TutorialsIn this multi file upload form, choose three images, click submit and preview the images on the preview page. If the user wishes to delete or replace an image, click edit and the form will go back to the previous page. Select the replace radio button for example on one of the three images and select a new image from the file input prompt and click submit. The form will go to the preview page again to display the images. During this process the image names are being input into a table and the images are being moved to a directory. The table is `id` AUTO_INCREMENT, `image0` `image1` `image2` `status` So input name='image[image0]' can be directed to table `image0` and so on. The code for keep and delete work fine, but how do I replace an image? I have two foreach blocks. The first one deletes the image file from the directory and deletes the image name from the table, but the second foreach dose not move the new image file into the directory. Thanks. <input type='radio' name='image[image0]' value='keep' checked='checked'/> <input type='radio' name='image[image0]' value='delete' /> <input type='radio' name='image[image0]' value='replace' /> <input type="file" name="image[]" /> <input type='radio' name='image[image1]' value='keep' checked='checked'/> <input type='radio' name='image[image1]' value='delete' /> <input type='radio' name='image[image1]' value='replace' /> <input type="file" name="image[]" /> <input type='radio' name='image[image2]' value='keep' checked='checked'/> <input type='radio' name='image[image2]' value='delete' /> <input type='radio' name='image[image2]' value='replace' /> <input type="file" name="image[]" /> <?php if (isset($_POST['status'])) { $status = $_POST['status']; $confirm_code = $status; #--------------------------- replace -------------------------------------------- if (isset($_POST['submitted']) && ($image = $_POST['image'])) { foreach($image as $imageKey => $imageValue) { if ($imageValue == 'replace') { $query = "SELECT $imageKey FROM table WHERE status = '$status' "; if($result = $db->query( $query )){ $row = $result->fetch_array(); } unlink( UPLOAD_DIR.$row[0] ); $query = "UPDATE table SET $imageKey = '' WHERE status = '$status' "; } } foreach($image as $imageKey => $imageValue) { if ($imageValue == 'replace') { $filenm = $_FILES['image']['name']; $file = $_FILES['image']['tmp_name']; move_uploaded_file($file, UPLOAD_DIR . $filenm); $filename[] = $filenm; $query = "INSERT INTO table VALUES ('','$filename[0]','$filename[1]','$filename[2]','$confirm_code')"; } } } } ?> So my hosting server does not allow fopen anymore, so I was wondering if anyone had an alternative to copying a file from a remote server via a URL to a local folder? Any alternatives is apprecited. Hi all I am trying to write a piece of code that copies files from a multiple selected form. Here's the form: Code: [Select] <form action="" method="post" enctype="multipart/form-data"> <input type="file" name="image[]" multiple="multiple" /> <input name="submit" type="submit" value="submit"> </form> Here's my PHP code: Code: [Select] if(isset($_POST['submit'])) { $count=0; foreach($_FILES['image'] as $filename){ copy($_FILES['image']['tmp_name'], WEB_UPLOAD."/images/galleries/".$filename) or die("Error uploading image "); $count++; } } I get the message, Array to string conversion and no such directory found. Am I right in thinking I am sending the files as arrays? Many thanks for your help. I am trying from several hours to sort and issue but i donno what the problem.. this is the following code i am using mkdir("news_upload/$year/$month/$day",0777); touch("news_upload/$year/$month/$day/$title.php"); chmod("news_upload/$year/$month/$day/$title.php",0777); $template = "news_template.php"; $new = "news_upload/$year/$month/$day/$title.php"; copy($template,$new); I have created the directories and given the permission the made a new empty file.. i added permissions to the new made file.. but it didnt apply as i check it.. (PROBLEM) then i have a template designed with the name news_template.php wanted to copy this template to the new created file.. the file gets created.. but the new file is not copying the template file on itself.. have i done anything rong??? help please? Hi Have searched this and other forums for an answer to this and found lots of similar questions but nothing dealing with exactly what I'm after. I want to copy a file located in parent/dir1/file.pdf (for example) to another directory parent/dir2/id/file.pdf. This is straightforward enough using copy(). But... I don't want users to be able to access the original file directly (eg by just putting /parent/dir1/file.pdf into their browser. The only way I seem to be able to do this is by removing the 'read' permission, but then the copy() command gives an error. If this is possible, I assume the solution is somehow linked to the various file and directory permissions but I can't figure out the correct settings. Can someone help out? Thanks in advance Ok I have a file with my emails and passwords like this email:pass email:pass email:pass email:pass and so on.. Is it possible to make a script that will delete everything after the ":" and replace the ":" with a comma? Im not sure what functions or w/e I could use to make this possible? Any ideas? Thanks ok I have text files with my logins to my emails and such.. Well I have this script to prepare the logins for another script the files with the logins are in this format email pass email pass email pass email pass $filename = 'text.txt'; $file = file($filename); $begin = "$"; foreach($file as $b){ list($email,$password) = explode(" ",$b); $emails[] = $begin."header[]=get_header('".$email."','".$password."');";} file_put_contents($filename,implode($emails)); echo "Text file edited"; sleep(5); Is what I am using to get the email and password in this format $header[]=get_header('email','pass'); but it is putting it like this $header[]=get_header('email','pass '); $header[]=get_header('email','pass '); $header[]=get_header('email','pass '); $header[]=get_header('email','pass '); $header[]=get_header('email','pass Why is it putting '); on a new line? I need it to be right behind the password so it looks like this $header[]=get_header('email','pass'); $header[]=get_header('email','pass'); $header[]=get_header('email','pass'); $header[]=get_header('email','pass'); $header[]=get_header('email','pass'); any ideas? Thanks Hello people, well the question couldn't be more explicit. I just learned how to view the php.ini configuration of my server using the phpinfo()script. But apparently it is a read only file. So how does one edit it? I am trying to extend session timeout. Thanks. Hi guys, I'm trying to edit a .conf file with php... I've tried using the parse_ini_file function to read it, but it fails at this point 1000 => 1234,a,b,,yes 2000 => 1234, ,,,no How can I edit this with php? For example changing "a" to "b", deleting a line, and adding a new line. Thanks guys i really appreciate the help from this forum!!! Let me apologize in advance for what may seem like a very stupid question for most of you. I am very new to php. I am simply trying to view/html in a .PHP file using Alleycode text editor. When I download the file from the server to my local PC, open the file in Alleycode, I cannot see the HTML. All that I see is the PHP code. Can someone provide me with instruction on how I might view then edit the HTML? Here is the code from Alleycode: <?php /*******************************************************************\ * CashbackEngine v1.1 * http://www.CashbackEngine.net * * Copyright (c) 2010 CashbackEngine Software. All rights reserved. * ------------ CashbackEngine IS NOT FREE SOFTWARE -------------- \*******************************************************************/ session_start(); require_once("inc/config.inc.php"); require_once("inc/pagination.inc.php"); $results_per_page = RESULTS_PER_PAGE; $cc = 0; function getCategory($category_id, $description = 0) { if (isset($category_id) && is_numeric($category_id) && $category_id != 0) { $query = "SELECT name, description FROM cashbackengine_categories WHERE category_id='".(int)$category_id."'"; $result = smart_mysql_query($query); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result); if ($description == 1) return $row['description']; else return $row['name']; }else { return "Category not found"; } } else { if ($description != 1) return "Retailers"; } } ////////////////// filter ////////////////////// if (isset($_GET['column']) && $_GET['column'] != "") { switch ($_GET['column']) { case "title": $rrorder = "title"; break; case "added": $rrorder = "added"; break; case "visits": $rrorder = "visits"; break; case "cashback": $rrorder = "cashback"; break; default: $rrorder = "title"; break; } } else { $rrorder = "title"; } if (isset($_GET['order']) && $_GET['order'] != "") { switch ($_GET['order']) { case "asc": $rorder = "asc"; break; case "desc": $rorder = "desc"; break; default: $rorder = "asc"; break; } } else { $rorder = "asc"; } ////////////////////////////////////////////////// if (isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] > 0) { $page = (int)$_GET['page']; } else { $page = 1; } $from = ($page-1)*$results_per_page; $where = ""; if (isset($_GET['cat']) && is_numeric($_GET['cat']) && $_GET['cat'] > 0) { $cat_id = (int)$_GET['cat']; unset($retailers_per_category); $retailers_per_category = array(); $retailers_per_category[] = "111111111111111111111"; $sql_retailers_per_category = smart_mysql_query("SELECT retailer_id FROM cashbackengine_retailer_to_category WHERE category_id='$cat_id'"); while ($row_retailers_per_category = mysql_fetch_array($sql_retailers_per_category)) { $retailers_per_category[] = $row_retailers_per_category['retailer_id']; } $where .= "retailer_id IN (".implode(",",$retailers_per_category).") AND"; } if (isset($_GET['letter']) && in_array($_GET['letter'], $alphabet)) { $ltr = mysql_real_escape_string(getGetParameter('letter')); if ($ltr == "0-9") { $where .= " title REGEXP '^[0-9]' AND"; }else{ $ltr = substr($ltr, 0, 1); $where .= " UPPER(title) LIKE '$ltr%' AND"; } } $where .= " status='active'"; if ($rrorder == "cashback") $query = "SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY ABS(cashback) $rorder LIMIT $from, $results_per_page"; else $query = "SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY $rrorder $rorder LIMIT $from, $results_per_page"; $total_result = smart_mysql_query("SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY title ASC"); $total = mysql_num_rows($total_result); $result = smart_mysql_query($query); $total_on_page = mysql_num_rows($result); /////////////// Page config /////////////// $PAGE_TITLE = getCategory($_GET['cat']); require_once ("inc/header.inc.php"); ?> <h1><?php echo getCategory($_GET['cat']); ?></h1> <?php if ($total > 0) { ?> <p class="category_description"><?php echo getCategory($_GET['cat'], 1); ?></p> <div id="alphabet"> <ul> <li><a href="/retailers.php">All</a></li> <?php $numLetters = count($alphabet); $i = 0; foreach ($alphabet as $letter) { $i++; if ($i == $numLetters) $lilast = ' class="last"'; else $lilast = ''; if (isset($cat_id) && is_numeric($cat_id)) echo "<li".$lilast."><a href=\"/retailers.php?cat=$cat_id&letter=$letter\">$letter</a></li>"; else echo "<li".$lilast."><a href=\"/retailers.php?letter=$letter\">$letter</a></li>"; } ?> </ul> </div> <div class="browse_top"> <div class="sortby"> <form action="retailers.php" id="form1" name="form1" method="get"> <span>Sort by:</span> <select name="column" id="column" onChange="document.form1.submit()"> <option value="title" <?php if ($_GET['column'] == "title") echo "selected"; ?>>Name</option> <option value="visits" <?php if ($_GET['column'] == "visits") echo "selected"; ?>>Popular</option> <option value="added" <?php if ($_GET['column'] == "added") echo "selected"; ?>>Newest</option> <option value="cashback" <?php if ($_GET['column'] == "cashback") echo "selected"; ?>>Cashback</option> </select> <select name="order" id="order" onChange="document.form1.submit()"> <option value="desc"<?php if ($_GET['order'] == "desc") echo "selected"; ?>>Descending</option> <option value="asc" <?php if ($_GET['order'] == "asc") echo "selected"; ?>>Ascending</option> </select> <?php if ($cat_id) { ?><input type="hidden" name="cat" value="<?php echo $cat_id; ?>" /><?php } ?> <?php if ($ltr) { ?><input type="hidden" name="letter" value="<?php echo $ltr; ?>" /><?php } ?> <input type="hidden" name="page" value="<?php echo $page; ?>" /> </form> </div> <div class="results"> Showing <?php echo ($from + 1); ?> - <?php echo min($from + $total_on_page, $total); ?> of <?php echo $total; ?> </div> </div> <table align="center" width="100%" border="0" cellspacing="0" cellpadding="5"> <?php while ($row = mysql_fetch_array($result)) { $cc++; ?> <tr class="<?php if (($cc%2) == 0) echo "even"; else echo "odd"; ?>"> <td width="125" align="center" valign="middle"> <?php if ($row['featured'] == 1) { ?><span class="featured" alt="Featured Retailer" title="Featured Retailer"></span><?php } ?> <div id="shadow"><a href="/view_retailer.php?rid=<?php echo $row['retailer_id']; ?>"><img src="<?php if (!stristr($row['image'], 'http')) echo "/img/"; echo $row['image']; ?>" width="<?php echo IMAGE_WIDTH; ?>" height="<?php echo IMAGE_HEIGHT; ?>" alt="<?php echo $row['title']; ?>" title="<?php echo $row['title']; ?>" border="0" class="imgs" /></a></div> </td> <td align="left" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td width="80%" align="left" valign="top"> <a class="retailer_title" href="/view_retailer.php?rid=<?php echo $row['retailer_id']; ?>"><?php echo $row['title']; ?></a> </td> <td nowrap="nowrap" width="20%" align="right" valign="top"> <span class="cashback"><?php echo DisplayCashback($row['cashback']); ?>X Points</span> </td> </tr> <tr> <td colspan="2" valign="middle" align="left"><p class="retailer_description"><?php echo $row['description']; ?> </p></td> </tr> <tr> <td valign="middle" align="left"> <?php if ($row['conditions'] != "") { ?> <div class="cashbackengine_tooltip"> <a class="conditions" href="#">Conditions</a> <span class="tooltip"><?php echo $row['conditions']; ?></span> </div> <?php } ?> <a class="favorites" href="#" onclick="if (confirm('Are you sure you want to add this retailer to your favorites?') )location.href='/myfavorites.php?act=add&rid=<?php echo $row['retailer_id']; ?>'">Add to Favorites</a> </td> <td valign="middle" align="right"> <a class="go2store" href="/go2store.php?id=<?php echo $row['retailer_id']; ?>" target="_blank">Go to Store</a> </td> </tr> </table> </td> </tr> <?php } ?> <tr> <td valign="middle" align="center" colspan="2"> <?php $params = ""; if (isset($cat_id) && $cat_id > 0) { $params = "cat=$cat_id&"; } if (isset($ltr) && $ltr != "") { $params = "letter=$ltr&"; } echo ShowPagination("retailers",$results_per_page,"retailers.php?".$params."column=$rrorder&order=$rorder&","WHERE ".$where); ?> </td> </tr> </table> <?php }else{ ?> <p align="center">There are no stores to list in this category!<br/><br/><a class="goback" href="#" onclick="history.go(-1);return false;">Go Back</a></p> <?php } ?> <?php require_once ("inc/footer.inc.php"); ?> Here is the code from the browser (View Source) <!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> <title>Retailers | Bonus.me</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <link rel="stylesheet" type="text/css" href="/css/style.css" /> <script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="/js/jquery.autocomplete.js"></script> <script type="text/javascript" src="/js/cashbackengine.js"></script> <link rel="shortcut icon" href="/favicon.ico" /> <link rel="icon" type="image/ico" href="/favicon.ico" /> </head> <body> <div id="container"> <div id="header"> <div id="logo"><a href="http://www.bonus.me/"><img src="/images/LogoSiteFinal.png" alt="Bonus.me" title="Bonus.me" border="0" /></a></div> <div id="links"> <a href="/login.php">Log In</a> | <a href="/register.php">Sign Up</a> </div> <div id="searchbox"> <form action="search.php" method="get" id="searchfrm" name="searchfrm"> <input type="text" id="searchtext" name="searchtext" class="search_inputt" value="Search for stores..." onclick="if (this.defaultValue==this.value) this.value=''" onkeydown="this.style.color='#000000'" onblur="if (this.value=='') this.value=this.defaultValue" /> <input type="hidden" name="action" value="search" /> <input type="submit" class="search_button" value="" /> </form> </div> </div> <div id="menu"> <a href="/">Home</a> <a href="/retailers.php">Online Shopping</a> <a href="/instore.php">In Store Shopping</a> <a href="/myaccount.php">My Account</a> <a href="/withdraw.php">My Rewards</a> <a href="/invite.php">Get More</a> <a href="/benny.php">Benny</a> </div> <div id="column_left"> <div class="box"> <div class="top">Member Login</div> <div class="middle"> <form action="login.php" method="post"> Email Address:<br/> <input type="text" class="inputt" name="username" value="" size="22" /> Password:<br/> <input type="password" class="inputt" name="password" value="" size="22" /> <input type="hidden" name="action" value="login" /> <input type="submit" class="butt" style="margin-top: 2px;" name="login" id="login" value="Login" /> <br/><br/><a href="/forgot.php">Forgot your password?</a> <br/><br/>Not a Member? <a href="/register.php">Sign Up!</a> </form> </div> <div class="bottom"> </div> </div> <div class="box"> <div class="top">Shop by Category</div> <div class="middle"> <ul id="categories"> <li><a href="/retailers.php">All Stores</a></li> <ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=41">Art, Music & Photo</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=40">Automotive</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=1">Books & Magazines</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=38">Department & Discount</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=6">Education</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=7">Electronics & Computers</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=2">Fashion & Apparel</a></li></ul><ul style='padding-left:10px;margin:0;'><li><a href="/retailers.php?cat=36">Children's Fashion</a></li></ul><ul style='padding-left:10px;margin:0;'><li><a href="/retailers.php?cat=35">Men's Fashions</a></li></ul><ul style='padding-left:10px;margin:0;'><li><a href="/retailers.php?cat=42">Shoes</a></li></ul><ul style='padding-left:10px;margin:0;'><li><a href="/retailers.php?cat=34">Women's Fashion</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=9">Flowers</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=10">Food & Drink</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=12">Gifts & Party</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=13">Health & Beauty</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=14">Home & Garden</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=16">Jewelry</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=17">Mobile Phones & Accesories</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=19">Office</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=22">Pets</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=39">Recreation & Leisure</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=15">Software</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=23">Sports & Fitness</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=24">Toys & Games</a></li></ul><ul style='padding-left:0px;margin:0;'><li><a href="/retailers.php?cat=37">Travel</a></li></ul> </ul> </div> <div class="bottom"> </div> </div> </div> <div id="column_center"> <h1>Retailers</h1> <p class="category_description"></p> <div id="alphabet"> <ul> <li><a href="/retailers.php">All</a></li> <li><a href="/retailers.php?letter=0-9">0-9</a></li><li><a href="/retailers.php?letter=A">A</a></li><li><a href="/retailers.php?letter=B">B</a></li><li><a href="/retailers.php?letter=C">C</a></li><li><a href="/retailers.php?letter=D">D</a></li><li><a href="/retailers.php?letter=E">E</a></li><li><a href="/retailers.php?letter=F">F</a></li><li><a href="/retailers.php?letter=G">G</a></li><li><a href="/retailers.php?letter=H">H</a></li><li><a href="/retailers.php?letter=I">I</a></li><li><a href="/retailers.php?letter=J">J</a></li><li><a href="/retailers.php?letter=K">K</a></li><li><a href="/retailers.php?letter=L">L</a></li><li><a href="/retailers.php?letter=M">M</a></li><li><a href="/retailers.php?letter=N">N</a></li><li><a href="/retailers.php?letter=O">O</a></li><li><a href="/retailers.php?letter=P">P</a></li><li><a href="/retailers.php?letter=Q">Q</a></li><li><a href="/retailers.php?letter=R">R</a></li><li><a href="/retailers.php?letter=S">S</a></li><li><a href="/retailers.php?letter=T">T</a></li><li><a href="/retailers.php?letter=U">U</a></li><li><a href="/retailers.php?letter=V">V</a></li><li><a href="/retailers.php?letter=W">W</a></li><li><a href="/retailers.php?letter=X">X</a></li><li><a href="/retailers.php?letter=Y">Y</a></li><li class="last"><a href="/retailers.php?letter=Z">Z</a></li> </ul> </div> <div class="browse_top"> <div class="sortby"> <form action="retailers.php" id="form1" name="form1" method="get"> <span>Sort by:</span> <select name="column" id="column" onChange="document.form1.submit()"> <option value="title" >Name</option> <option value="visits" >Popular</option> <option value="added" >Newest</option> <option value="cashback" >Cashback</option> </select> <select name="order" id="order" onChange="document.form1.submit()"> <option value="desc">Descending</option> <option value="asc" >Ascending</option> </select> <input type="hidden" name="page" value="1" /> </form> </div> <div class="results"> Showing 1 - 2 of 2 </div> </div> <table align="center" width="100%" border="0" cellspacing="0" cellpadding="5"> <tr class="odd"> <td width="125" align="center" valign="middle"> <div id="shadow"><a href="/view_retailer.php?rid=13"><img src="<a href="http://click.linksynergy.com/fs-bin/click?id=8jghEyj/xMI&offerid=226353.10000004&subid=0&type=4"><IMG border="0" alt="Fanzz General Banner 120x90" src="http://ad.linksynergy.com/fs-bin/show?id=8jghEyj/xMI&bids=226353.10000004&subid=0&type=4&gri" width="120" height="60" alt="Fanzz.com" title="Fanzz.com" border="0" class="imgs" /></a></div> </td> <td align="left" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td width="80%" align="left" valign="top"> <a class="retailer_title" href="/view_retailer.php?rid=13">Fanzz.com</a> </td> <td nowrap="nowrap" width="20%" align="right" valign="top"> <span class="cashback">7X Points</span> </td> </tr> <tr> <td colspan="2" valign="middle" align="left"><p class="retailer_description">Fanzz.com sells licensed sports apparel and gifts from the NFL, NBA, MLB, NCAA, NHL, MLS, NASCAR and WNBA. We have dozens of top brands on our site including Nike, Adidas, Reebok, New Era, Antigua, Baseline, Fathead, Fanmats, Majestic, Mitchell and Ness, Under Armour, Wilson, Wincraft and many more. </p></td> </tr> <tr> <td valign="middle" align="left"> <a class="favorites" href="#" onclick="if (confirm('Are you sure you want to add this retailer to your favorites?') )location.href='/myfavorites.php?act=add&rid=13'">Add to Favorites</a> </td> <td valign="middle" align="right"> <a class="go2store" href="/go2store.php?id=13" target="_blank">Go to Store</a> </td> </tr> </table> </td> </tr> <tr class="even"> <td width="125" align="center" valign="middle"> <div id="shadow"><a href="/view_retailer.php?rid=14"><img src="http://www.ftjcfx.com/image-5471697-10807939" width="120" height="60" alt="Pets Warehouse" title="Pets Warehouse" border="0" class="imgs" /></a></div> </td> <td align="left" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td width="80%" align="left" valign="top"> <a class="retailer_title" href="/view_retailer.php?rid=14">Pets Warehouse</a> </td> <td nowrap="nowrap" width="20%" align="right" valign="top"> <span class="cashback">9X Points</span> </td> </tr> <tr> <td colspan="2" valign="middle" align="left"><p class="retailer_description">Founded in 1974 Pets Warehouse® provides the broadest selection of pet supplies available anywhere online, add value to your site and benefit your customers with low prices. </p></td> </tr> <tr> <td valign="middle" align="left"> <a class="favorites" href="#" onclick="if (confirm('Are you sure you want to add this retailer to your favorites?') )location.href='/myfavorites.php?act=add&rid=14'">Add to Favorites</a> </td> <td valign="middle" align="right"> <a class="go2store" href="/go2store.php?id=14" target="_blank">Go to Store</a> </td> </tr> </table> </td> </tr> <tr> <td valign="middle" align="center" colspan="2"> </td> </tr> </table> </div> <div id="column_right"> <div class="center"> <p align="center"> <a href="/invite.php"><img src="/images/ReferAFriend.gif" border="0"></a></br> <a href="/invite.php">Refer A Friend<br/>And Get More!</a> </p> </div> </div> <div id="footer"> <a href="/terms.php">Terms & Conditions</a> · <a href="/contact.php">Contact Us</a> · <a href="/help.php">FAQs</a> <p>© December, 2011. Bonus.Me. All rights reserved.</p> </div> </div> </body> </html> $results_per_page = RESULTS_PER_PAGE; $cc = 0; function getCategory($category_id, $description = 0) { if (isset($category_id) && is_numeric($category_id) && $category_id != 0) { $query = "SELECT name, description FROM cashbackengine_categories WHERE category_id='".(int)$category_id."'"; $result = smart_mysql_query($query); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result); if ($description == 1) return $row['description']; else return $row['name']; }else { return "Category not found"; } } else { if ($description != 1) return "Retailers"; } } ////////////////// filter ////////////////////// if (isset($_GET['column']) && $_GET['column'] != "") { switch ($_GET['column']) { case "title": $rrorder = "title"; break; case "added": $rrorder = "added"; break; case "visits": $rrorder = "visits"; break; case "cashback": $rrorder = "cashback"; break; default: $rrorder = "title"; break; } } else { $rrorder = "title"; } if (isset($_GET['order']) && $_GET['order'] != "") { switch ($_GET['order']) { case "asc": $rorder = "asc"; break; case "desc": $rorder = "desc"; break; default: $rorder = "asc"; break; } } else { $rorder = "asc"; } ////////////////////////////////////////////////// if (isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] > 0) { $page = (int)$_GET['page']; } else { $page = 1; } $from = ($page-1)*$results_per_page; $where = ""; if (isset($_GET['cat']) && is_numeric($_GET['cat']) && $_GET['cat'] > 0) { $cat_id = (int)$_GET['cat']; unset($retailers_per_category); $retailers_per_category = array(); $retailers_per_category[] = "111111111111111111111"; $sql_retailers_per_category = smart_mysql_query("SELECT retailer_id FROM cashbackengine_retailer_to_category WHERE category_id='$cat_id'"); while ($row_retailers_per_category = mysql_fetch_array($sql_retailers_per_category)) { $retailers_per_category[] = $row_retailers_per_category['retailer_id']; } $where .= "retailer_id IN (".implode(",",$retailers_per_category).") AND"; } if (isset($_GET['letter']) && in_array($_GET['letter'], $alphabet)) { $ltr = mysql_real_escape_string(getGetParameter('letter')); if ($ltr == "0-9") { $where .= " title REGEXP '^[0-9]' AND"; }else{ $ltr = substr($ltr, 0, 1); $where .= " UPPER(title) LIKE '$ltr%' AND"; } } $where .= " status='active'"; if ($rrorder == "cashback") $query = "SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY ABS(cashback) $rorder LIMIT $from, $results_per_page"; else $query = "SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY $rrorder $rorder LIMIT $from, $results_per_page"; $total_result = smart_mysql_query("SELECT * FROM cashbackengine_retailers WHERE $where ORDER BY title ASC"); $total = mysql_num_rows($total_result); $result = smart_mysql_query($query); $total_on_page = mysql_num_rows($result); /////////////// Page config /////////////// $PAGE_TITLE = getCategory($_GET['cat']); require_once ("inc/header.inc.php"); ?> <h1><?php echo getCategory($_GET['cat']); ?></h1> <?php if ($total > 0) { ?> <p class="category_description"><?php echo getCategory($_GET['cat'], 1); ?></p> <div id="alphabet"> <ul> <li><a href="/retailers.php">All</a></li> <?php $numLetters = count($alphabet); $i = 0; foreach ($alphabet as $letter) { $i++; if ($i == $numLetters) $lilast = ' class="last"'; else $lilast = ''; if (isset($cat_id) && is_numeric($cat_id)) echo "<li".$lilast."><a href=\"/retailers.php?cat=$cat_id&letter=$letter\">$letter</a></li>"; else echo "<li".$lilast."><a href=\"/retailers.php?letter=$letter\">$letter</a></li>"; } ?> </ul> </div> <div class="browse_top"> <div class="sortby"> <form action="retailers.php" id="form1" name="form1" method="get"> <span>Sort by:</span> <select name="column" id="column" onChange="document.form1.submit()"> <option value="title" <?php if ($_GET['column'] == "title") echo "selected"; ?>>Name</option> <option value="visits" <?php if ($_GET['column'] == "visits") echo "selected"; ?>>Popular</option> <option value="added" <?php if ($_GET['column'] == "added") echo "selected"; ?>>Newest</option> <option value="cashback" <?php if ($_GET['column'] == "cashback") echo "selected"; ?>>Cashback</option> </select> <select name="order" id="order" onChange="document.form1.submit()"> <option value="desc"<?php if ($_GET['order'] == "desc") echo "selected"; ?>>Descending</option> <option value="asc" <?php if ($_GET['order'] == "asc") echo "selected"; ?>>Ascending</option> </select> <?php if ($cat_id) { ?><input type="hidden" name="cat" value="<?php echo $cat_id; ?>" /><?php } ?> <?php if ($ltr) { ?><input type="hidden" name="letter" value="<?php echo $ltr; ?>" /><?php } ?> <input type="hidden" name="page" value="<?php echo $page; ?>" /> </form> </div> <div class="results"> Showing <?php echo ($from + 1); ?> - <?php echo min($from + $total_on_page, $total); ?> of <?php echo $total; ?> </div> </div> <table align="center" width="100%" border="0" cellspacing="0" cellpadding="5"> <?php while ($row = mysql_fetch_array($result)) { $cc++; ?> <tr class="<?php if (($cc%2) == 0) echo "even"; else echo "odd"; ?>"> <td width="125" align="center" valign="middle"> <?php if ($row['featured'] == 1) { ?><span class="featured" alt="Featured Retailer" title="Featured Retailer"></span><?php } ?> <div id="shadow"><a href="/view_retailer.php?rid=<?php echo $row['retailer_id']; ?>"><img src="<?php if (!stristr($row['image'], 'http')) echo "/img/"; echo $row['image']; ?>" width="<?php echo IMAGE_WIDTH; ?>" height="<?php echo IMAGE_HEIGHT; ?>" alt="<?php echo $row['title']; ?>" title="<?php echo $row['title']; ?>" border="0" class="imgs" /></a></div> </td> <td align="left" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td width="80%" align="left" valign="top"> <a class="retailer_title" href="/view_retailer.php?rid=<?php echo $row['retailer_id']; ?>"><?php echo $row['title']; ?></a> </td> <td nowrap="nowrap" width="20%" align="right" valign="top"> <span class="cashback"><?php echo DisplayCashback($row['cashback']); ?>X Points</span> </td> </tr> <tr> <td colspan="2" valign="middle" align="left"><p class="retailer_description"><?php echo $row['description']; ?> </p></td> </tr> <tr> <td valign="middle" align="left"> <?php if ($row['conditions'] != "") { ?> <div class="cashbackengine_tooltip"> <a class="conditions" href="#">Conditions</a> <span class="tooltip"><?php echo $row['conditions']; ?></span> </div> <?php } ?> <a class="favorites" href="#" onclick="if (confirm('Are you sure you want to add this retailer to your favorites?') )location.href='/myfavorites.php?act=add&rid=<?php echo $row['retailer_id']; ?>'">Add to Favorites</a> </td> <td valign="middle" align="right"> <a class="go2store" href="/go2store.php?id=<?php echo $row['retailer_id']; ?>" target="_blank">Go to Store</a> </td> </tr> </table> </td> </tr> <?php } ?> <tr> <td valign="middle" align="center" colspan="2"> <?php $params = ""; if (isset($cat_id) && $cat_id > 0) { $params = "cat=$cat_id&"; } if (isset($ltr) && $ltr != "") { $params = "letter=$ltr&"; } &nbs Hello I have a problem. I have been trying to copy my music folders structure but not copying the mp3s; instead using the file names as a file name for a .txt file and inserting the URL to the file in the .txt file. Eg. E:\My Music folder 1 folder 1.1 file.mp3 folder 2 folder 3 to G:\My Music folder 1 folder 1.1 file.txt folder 2 folder 3 and inside "file.txt" would be one line saying "http://www.xxx.com/my_music/file.mp3 Seems this should be easy, but I'm not finding the solution. Functions like scandir, readdir, and glob that I've been looking at all seem to need me to actually know more about my directory path than I can ahead of time. Here's what I want to do: 1. expand a .tar file (consists of directory, subdirectories, files, and is variable) that I've uploaded to the server 2. look through that expanded directory for a subdirectory named ".pn" -- (note that all my .tar files will have this folder deep in several subdirectories that will be variable in number and have different names depending on the original .tar file) 3. copy the entire contents of the .pn folder to another folder already on my server The hosting company, no doubt, has likely blocked some of the functions I'll need as well, but if someone can point me in the right direction to start, it would be greatly appreciated. Thanks! Satre Hi, I've been googling for a while now for an example of how to read, edit and write a configuration file. This part was easy to find... <?php $icon_settings = parse_ini_file("test.desktop"); print_r($icon_settings); ?> ...the above code works great, but how do I edit and write back a configuration file like this... Code: [Select] #!/usr/bin/env xdg-open [Desktop Entry] Version=1.0 Name=Firefox Web Browser Comment=Browse the World Wide Web GenericName=Web Browser Exec=firefox %u Terminal=false X-MultipleArgs=false Type=Application Icon=firefox # ... and so on back to the drive? Thanks. Other than downloading the file, editing it on the local PC, saving it, and uploading it back to the server using some applicable script, any ideas?
I want to add text to a file, getting it printed out in index.php and later want to edit/delete per row. I give codes page wise. first the form to take data: add.php: Code: [Select] <?php ?> <form method="post" action="add_data.php"> <fieldset> <legend>Student List</legend> Name : <input type="text" name="uname" /><br> Content : <input type="text" name="age" /> <br> <input type="submit" name="submit" value="send" /> </fieldset> </form> Next adding text to a file: add_data.php: Code: [Select] <?php $id = 1; if (file_exists("data.txt")) { $fp = fopen("data.txt", 'r'); $str = fread($fp, filesize("data.txt")); $str_arr = explode("|", $str); foreach ($str_arr as $rec) { if ($rec) { $id++; } } } $mode = (file_exists("data.txt"))? "a" : "w"; $fp = fopen("data.txt", $mode); $line = $id . "--" . $_POST['uname'] . "--" . $_POST['age'] . "|"; $res = fwrite($fp, $line); fclose($fp); header("location:index.php"); ?>In the index.php, I'd like to fetch data and edit them per row: Code: [Select] <?php $fp = fopen("data.txt", 'r'); $str = fread($fp, filesize("data.txt")); $str_arr = explode("|", $str); echo "<table border='1'>"; echo "<tr><td>ID</td><td>Name</td><td>Age</td><td>Option</td></tr>"; foreach ($str_arr as $rec) { if ($rec) { $rec_arr = explode("--", $rec); echo "<tr>"; foreach ($rec_arr as $col) { echo "<td>$col</td>"; } print "<td><a href=\"edit.php?id=$id\">Edit</a>/<a href=\"delete.php?id=$id\">Delete</a></td></tr>"; } } echo "</table>"; echo "<a href=\"add.php\">Add Data</a>"; ?> Next I want to Edit per row: edit.php: Code: [Select] <?php $fp = fopen("data.txt", 'r'); $str = fread($fp, filesize("data.txt")); $str_arr = explode("|", $str); foreach ($str_arr as $rec) { if ($rec) { $rec_arr = explode("--", $rec); $id = $rec_arr[0]; $name = $rec_arr[1]; $age = $rec_arr[2]; if ($id == $_REQUEST["id"]) { echo "<form action='edit_data.php' method='post'>"; echo "Name :<input type='text' name='uname' value='$name' /><br>"; echo "Age: <input type='text' name='age' value=$age /><br>"; echo "<input type='hidden' name='uid' value=$id />"; echo "<input type='submit' value='Edit'>"; echo "</form>"; } } } ?> From edit.php to edit_data.php where I practically try to edit per row: Code: [Select] <?php $fp = fopen("data.txt", 'r'); $str = fread($fp, filesize("data.txt")); $str_arr = explode("|", $str); foreach ($str_arr as $rec) { if ($rec) { $rec_arr = explode("--", $rec); $id = $rec_arr[0]; $name = $rec_arr[1]; $age = $rec_arr[2]; if ($id == $_POST['uid']) { $new_str = $id . "--" . $_POST['uname'] . "--" . $_POST['age'] . "|"; } else { $new_str = $id . "--" . $name . "--" . $age . "|"; } } } fclose($fp); $fp = fopen("data.txt", 'w'); fwrite($fp, $new_str); fclose($fp); ?> The mechanism is simple. Taking datas from a form, explode them to an array and get them into col/row pattern to edit and delete them. But my problem is when I want to edit in index.php page, specially in this part: Code: [Select] print "<td><a href=\"edit.php?id=$id\">Edit</a> It says, undefined index. But I try to catch this $id in the edit.php page, in this manner, as you see in my code: Code: [Select] foreach ($str_arr as $rec) { if ($rec) { $rec_arr = explode("--", $rec); $id = $rec_arr[0]; $name = $rec_arr[1]; $age = $rec_arr[2]; if ($id == $_REQUEST["id"]) { echo "<form action='edit_data.php' method='post'>"; echo "Name :<input type='text' name='uname' value='$name' /><br>"; echo "Age: <input type='text' name='age' value=$age /><br>"; echo "<input type='hidden' name='uid' value=$id />"; echo "<input type='submit' value='Edit'>"; echo "</form>"; } } } Have I done any mistake here? If anyone points out, I'll be obliged. i have 200 photos in a folder .. can i move random a photo to with changing photo name anoter file Hai..
currently i am developing client dashboard using php/mysql.Here is my problem i need to create a tab named as notes.Using this tab the logged in users can add a new note or edit his existing note and save as text file.. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=345742.0 Hi guys, I am wirting a script to upload an image file, but I get the error: copy() [function.copy]: Filename cannot be empty in Obviouly it has something to do with the copy() function - (copy($HTTP_POST_FILES['product_img']['tmp_name'], $path)) I think it is not copying from my temp folder or something. Can anyone help me out? Code is: Code: [Select] //IMAGE FILE $file_name = $_FILES['product_img']['name']; echo '<p>File Name:' . $file_name . '</p>'; //IMAGE UPLOAD // random 4 digit to add to file name $random_digit=rand(0000,9999); //combine random digit to file name to create new file name //use dot (.) to combile these two variables $new_image_name = $random_digit.$file_name; echo $new_image_name; //SET DESINATION FOLDER $path= "uploads/".$new_image_name; echo '<p>Path:' . $path . '</p>'; if($product_img !=none) { if(copy($HTTP_POST_FILES['product_img']['tmp_name'], $path)) { echo "Successful<BR/>"; echo "File Name :".$new_file_name."<BR/>"; echo "File Size :".$HTTP_POST_FILES['product_img']['size']."<BR/>"; echo "File Type :".$HTTP_POST_FILES['product_img']['type']."<BR/>"; } else { echo "Image upload Error<BR/>"; } } Any help would be greatly appreciated! Thanks Ok I am designing a php upload that will take a image file from a form and change the name of the file to the productnumber also recieved from the form. I had it working the otherday now it says Warning: copy() [function.copy]: open_basedir restriction in effect File() is not within the allowed path(s): (/home:/tmp:/usr) addpro.php on line 51. my files are attached.... note that $pnum is the product number gotten from my form and image is the image being uploaded gotten from the form also. The thing is it worked the other day but now it don't is it a change to the server ( I dont run the server) or did I mess up my code since then? I really need a code that will do this two time over once for a small image being put into a folder called small and once for a folder called large both images being uploaded and being changed to $pnum.ext so they will both be displayed when being called out by the product number. but I can work on that after I get this one working. line 51 is $copied = copy($_FILES['image']['tmp_name'], $newname); |