Jump to content

SEO optimization help


daxguy

Recommended Posts

i have a random no. of directories and files being created using the mkdir and touch functions and the newly created files are copying a pre-made template.. the links of the pages which were being created had %20 signs between the spaces.. i wanted to change them with "-" soo i used the following code.. but it gives errors.. as invalid arguments in mkdir and touch and as well as copy function

 

can anyone help?

here is the code

while ($row = mysql_fetch_assoc($result1) )
						 {

							$hosting = explode(',', $row['host']);		
							$linking = explode(',', $row['links']);
							$parts = explode(',', $row['link_no']);
							$no_host = count($hosting); //miniusing the no of loops to make it accurate
							$count_host = count($hosting);
							$count_links = count($parts);
							$current_k = 0;									
							$sum = 0;
							$parts_href = '';
							$new = null;
							$updated_part = null;
							for($i=0; $i<($count_host-1); $i++ )
							{
								$j = $i+1;
								$hos = str_replace(":","",$hosting[$i]);
								$path = "$base_folder/{$hos}";

         							echo "<br />{$hos}";
								echo "<br />{$path}";

								mkdir($path);


								for($k=$current_k; $k<($count_links); $k++)
								{
									for($f=0; $f<$parts[$current_k]; $f++ )
									{
										$for_touch = "$base_folder/{$hos}/".$linking[$sum].".php";
										$for_touch = str_replace(" ","-",$for_touch);
										touch("$for_touch");
										$new_seo = "{$part_href}/{$hos}/".$linking[$sum].".php";
										$new_seo = str_replace(" ","-",$new_seo);
									    $new = "$new_seo";
											$updated_part = $updated_part.$new;
										$updated_part = $updated_part.",";
										//copy function
										$old_file = "$for_touch";
										$new_file = "{$part_page}/part".$sum.".php";
										$new_file = str_replace(" ","-",$new_file);
										$new_file = "$new_file";
										copy($new_file,$old_file);
										$sum++;	

									}
									$query_href = 'update movies set href_parts = \''.$updated_part.'\'';
										mysql_query($query_href) or die('COULD NOT EXECUTE THE QUERY FOR PARTS HREF');											
										echo "<br />{$updated_part}";
									$sum = $sum;
									$current_k = $current_k+1;
									break;

								}

							}

 

 

PLEASE HELP ME!

 

Link to comment
Share on other sites

These are the errors

Warning: touch() [function.touch]: Unable to create file C:/xampp/htdocs/gl/uploads/movies/2010/08/I-Hate-Luv-Storys-2010-Hindi-Movie-Watch/Dailymotions-Video-Link--Alternative-Link-/I-Hate-Luv-Storys-2010-Hindi-Movie-Watch-Part-1.php because No such file or directory in C:\xampp\htdocs\gl\movie_process.php on line 197

 

Warning: copy(C:/xampp/htdocs/gl/uploads/movies/2010/08/I-Hate-Luv-Storys-2010-Hindi-Movie-Watch/Dailymotions-Video-Link--Alternative-Link-/I-Hate-Luv-Storys-2010-Hindi-Movie-Watch-Part-1.php) [function.copy]: failed to open stream: No such file or directory in C:\xampp\htdocs\gl\movie_process.php on line 208

 

The complete code

$part_href = "http://localhost/gl/uploads/movies/{$year}/{$month}/{$title}";
  $base_folder = "{$base}uploads/movies/{$year}/{$month}/{$title}";
   $base = $_SERVER['DOCUMENT_ROOT']."/gl/";
  $path = "http://localhost/gl/albums";

$query1 = "select * from movies where title = '".$title."' ;";
						 $result1 = mysql_query($query1) or die('Could Not Execute The Query');
						 while ($row = mysql_fetch_assoc($result1) )
						 {

							$hosting = explode(',', $row['host']);		
							$linking = explode(',', $row['links']);
							$parts = explode(',', $row['link_no']);
							$no_host = count($hosting); //miniusing the no of loops to make it accurate
							$count_host = count($hosting);
							$count_links = count($parts);
							$current_k = 0;									
							$sum = 0;
							$parts_href = '';
							$new = null;
							$updated_part = null;
							for($i=0; $i<($count_host-1); $i++ )
							{
								$j = $i+1;
								$hos = str_replace(":","",$hosting[$i]);
								$path = "$base_folder/{$hos}";

         							echo "<br />{$hos}";
								echo "<br />{$path}";

								mkdir($path);


								for($k=$current_k; $k<($count_links); $k++)
								{
									for($f=0; $f<$parts[$current_k]; $f++ )
									{
										$for_touch = "$base_folder/{$hos}/".$linking[$sum].".php";
										$for_touch = str_replace(" ","-",$for_touch);
										touch("$for_touch");
										$new_seo = "{$part_href}/{$hos}/".$linking[$sum].".php";
										$new_seo = str_replace(" ","-",$new_seo);
									    $new = "$new_seo";
											$updated_part = $updated_part.$new;
										$updated_part = $updated_part.",";
										//copy function
										$old_file = "$for_touch";
										$new_file = "{$part_page}/part".$sum.".php";
										$new_file = str_replace(" ","-",$new_file);
										$new_file = "$new_file";
										copy($new_file,$old_file);
										$sum++;	

									}
									$query_href = 'update movies set href_parts = \''.$updated_part.'\'';
										mysql_query($query_href) or die('COULD NOT EXECUTE THE QUERY FOR PARTS HREF');											
										echo "<br />{$updated_part}";
									$sum = $sum;
									$current_k = $current_k+1;
									break;

								}

							}

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.