Jump to content

Seamless

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Everything posted by Seamless

  1. ok, i edited my php.ini to show errors and this is the error i get even though i have increased the memory_limit in the php.ini to 128MB [quote] Allowed memory size of 134217728 bytes exhausted (tried to allocate 15488 bytes) [/quote] I'm getting a bit nervous now, i've never altered the memory_limit so i have a few questions: 1. Is there a maximum i can increase it to? 2. What are the effects of increasing it? Seamless
  2. i'm not getting one, the server i'm using has errors turned off by default. Is there a statement i can use which will display an error like mysql_error(); does? I don't really want to have to go in and edit my php.ini, but if i have to i suppose i can. Seamless
  3. cheers for the thought but i have checked 'post_max_size' its set at 8MB and upload_max_filesize is set to 10MB. Thats why i'm a bit stuck, could it be the execution time perhaps?
  4. hi, i'm not an expert but i don't think the error you have quoted relates to the code you are showing. but regarding the error you are showing (correct me if i am wrong) doesn't the less than or equal to have to be like this: =< Seamless.
  5. Hi, I have written a page to parse the uploading of images. I usually test it with the default images you get with windows XP (you the sunset one etc..) and everything worked fine... It uploads the image resizes the original outouts it and then creates a thumbnail and again outputs it. Until... I tried uploading a larger jpeg (3.1Mb) it uploads it to the php tmp directory and it gets as far as [code] imagejpeg($image_p,$target,$jpegqual); [/code] and gives up. here's a snippet from the page, like i said everything works fine until the imagejpeg part. [code] if($filetype == "image/pjpeg" or $filetype == "image/jpeg"){ list($orig_width, $orig_height) = getimagesize($tmp_name); $ext = ".jpg"; $target = $uploaddir.$new_name.$ext; $target_small = $uploaddir."thumbs/".$new_name.$ext; $width = $orig_width; $height = $orig_height; $width_small = $orig_width; $height_small = $orig_height; // RESIZE LARGE IMAGE if($height > $max_height){   $width = ($max_height / $height) * $width;   $height = $max_height; } if($width > $max_width){   $height = ($max_width / $width) * $height;   $width = $max_width; } $image_p = imagecreatetruecolor($width, $height)or die("Cannot Initialize new GD image stream"); $image = imagecreatefromjpeg($tmp_name)or die("Cannot Initialize new GD image stream2"); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $orig_width, $orig_height); imagejpeg($image_p,$target,$jpegqual); [/code] i've checked the syntax and i don't think its that does anyone have any ideas?? Thanks in advance Seamless.
  6. Thanks for your suggestions i am using a session for the users to login anyway so that is probably the best solution. Although i kinda wanted to solve the problem rather than create a workaround. But you just triggered my memory when you mentioned headers i had not included [code] header("Cache-control: private"); [/code] beneath session_start(); at the top of the two pages, so i have added it and that has solved the problem! I don't know why i did not include it as i usually do. A lesson learnt for me now, i won't be making that mistake again! Thanks for your help Seamless
  7. cheers for the reply. there are 2 seperate files: 1. form.php 2. form-parse.php your part right -  a form on form.php posts variables to form-parse.php. I think you are a little confused about the next part, maybe my explaination wasn't very good... Here's the script my form posts its variables to - form-parse.php [code] <? $x = 0;     $form_error = " "; if(!$_POST[customer]){ $form_error .= "<p>A customer is required.</p>"; $x++; } if(!$_POST[cust_contact]){ $form_error .= "<p>A customer contact is required.</p>"; $x++; } if($_POST[cust_contact_email]){ if(!validate_email($_POST[cust_contact_email])){ $form_error .= "<p>A valid email address must be entered for the customer contact email.</p>"; $x++; } } if(!$_POST[part_des]){ $form_error .= "<p>A Part Description is required.</p>"; $x++; }     if(!$_POST[change_des]){ $form_error .= "<p>Details of the change is required.</p>"; $x++; } if(!$_POST[effects_des]){ $form_error .= "<p>Effects of the change is required.</p>"; $x++; } if($_POST[action1] == "0" or $_POST[action_by1] == "0" or $_POST[custom_action1] == ""){ $form_error .= "<p>At least 1 action must be selected.</p>"; $x++;     } if($x > 0){ echo "<p><b>Please correct the errors below.</b></p><br />"; echo "$form_error"; echo "<form action=\"create-change.php\" method=\"post\"> <input type=\"hidden\" name=\"customer\" value=\"$_POST[customer]\" /> <input type=\"hidden\" name=\"cust_contact\" value=\"$_POST[cust_contact]\" /> <input type=\"hidden\" name=\"cust_contact_email\" value=\"$_POST[cust_contact_email]\" /> <input type=\"hidden\" name=\"part_des\" value=\"$_POST[part_des]\" /> <input type=\"hidden\" name=\"cust_part_number\" value=\"$_POST[cust_part_number]\" /> <input type=\"hidden\" name=\"bwm_num\" value=\"$_POST[bwm_num]\" /> <input type=\"hidden\" name=\"samples\" value=\"$_POST[samples]\" /> <input type=\"hidden\" name=\"cost_charge\" value=\"$_POST[cost_charge]\" /> <input type=\"hidden\" name=\"cust_order_num\" value=\"$_POST[cust_order_num]\" /> <input type=\"hidden\" name=\"total_cost\" value=\"$_POST[total_cost]\" /> <input type=\"hidden\" name=\"change_des\" value=\"$_POST[change_des]\" /> <input type=\"hidden\" name=\"effects_des\" value=\"$_POST[effects_des]\" /> <input type=\"hidden\" name=\"delivery\" value=\"$_POST[delivery]\" /> <input type=\"hidden\" name=\"compatibility\" value=\"$_POST[compatibility]\" /> <input type=\"hidden\" name=\"action1\" value=\"$_POST[action1]\" /> <input type=\"hidden\" name=\"custom_action1\" value=\"$_POST[custom_action1]\" /> <input type=\"hidden\" name=\"action_by1\" value=\"$_POST[action_by1]\" /> <input type=\"hidden\" name=\"action2\" value=\"$_POST[action2]\" /> <input type=\"hidden\" name=\"custom_action2\" value=\"$_POST[custom_action2]\" />                 <input type=\"hidden\" name=\"action_by2\" value=\"$_POST[action_by2]\" />                 <input type=\"hidden\" name=\"action3\" value=\"$_POST[action3]\" /> <input type=\"hidden\" name=\"custom_action3\" value=\"$_POST[custom_action3]\" /> <input type=\"hidden\" name=\"action_by3\" value=\"$_POST[action_by3]\" />                 <input type=\"hidden\" name=\"action4\" value=\"$_POST[action4]\" /> <input type=\"hidden\" name=\"custom_action4\" value=\"$_POST[custom_action4]\" /> <input type=\"hidden\" name=\"action_by4\" value=\"$_POST[action_by4]\" />                 <input type=\"hidden\" name=\"action5\" value=\"$_POST[action5]\" /> <input type=\"hidden\" name=\"custom_action5\" value=\"$_POST[custom_action5]\" /> <input type=\"hidden\" name=\"action_by5\" value=\"$_POST[action_by5]\" />                 <input type=\"hidden\" name=\"action6\" value=\"$_POST[action6]\" /> <input type=\"hidden\" name=\"custom_action6\" value=\"$_POST[custom_action6]\" /> <input type=\"hidden\" name=\"action_by6\" value=\"$_POST[action_by6]\" />                 <input type=\"hidden\" name=\"action7\" value=\"$_POST[action7]\" /> <input type=\"hidden\" name=\"custom_action7\" value=\"$_POST[custom_action7]\" /> <input type=\"hidden\" name=\"action_by7\" value=\"$_POST[action_by7]\" />                 <input type=\"hidden\" name=\"action8\" value=\"$_POST[action8]\" /> <input type=\"hidden\" name=\"custom_action8\" value=\"$_POST[custom_action8]\" /> <input type=\"hidden\" name=\"action_by8\" value=\"$_POST[action_by8]\" />                 <p><input type=\"submit\" value=\"Back\" /></p> <p><b>NOTE: </b>If you don't use the Back button above, you will have to fill out the change form again!</p> </form>";     }else{ // if no errors process the data } [/code] You can see that i've added a form with hidden fields so that when the back button on the form is clicked it posts the data back to the original form on form.php What i'm trying to get at is - I shouldn't need to have that form with hidden fields on form-parse.php because when you hit the back button on the browser the post variables should appear back in the form on form.php like it does on the website i have which is not on an intranet.
  8. Hi, I wonder if any one can help me.. I am developing a drawing register for the company i work for on our intranet. We recently got a new server (Windows 2003) and IIS6, so i installed PHP and MySQL on it. When a user fills in a web form (i'll call it form.php) on the intranet i make the form post the variables to another file (i'll call this one form-parse.php) which parses the data. If they have not entered the required information i display the form errors on the form-parse.php telling them to go back to the original form and fill in the required fields. My problem is that when a user clicks the back button on the browser (from form-parse.php to form.php) after getting an error for not entering data in a required field the $_POST variables are lost and they have to fill in the complete form again. I have included value="<? echo $_POST[variable1];?>" for each of the relevant <input> tags in the original form. I have managed to work around this for now by displaying a "Back" button under the errors which posts hidden post data back to form.php, but this is quite long winded and in my opinion unneccessary. I have not come across this problem before after using a few different web hosting companies.... Could it be a setting in the php.ini file or is this something to do with the server settings and this post is in the wrong forum completely. Thanks in advance Seamless
  9. your absolutely right, i think i was reading into it too much. A new revision would also have a new date (later date). Thanks for your help.
  10. I have been developing an engineering drawing register on a companies intranet. This enables a user to upload a drawing and enter the drawing details. The drawing itself (PDF) is uploaded to the server and the data entered into the MySQL database. I have written some php code to do a search on the drawing database e.g. customer search. The trouble is some customers when issuing a new drawing to the company don't update the revision number only the date of the drawing. Here's my problem: I need a MySQL statement to select the drawings with the highest revsion AND the most recent date. Here's what i have so far. [code] <? $search_vals = array("drg_desc", "drg_num", "cust_id"); while (list ($key, $value) = each ($HTTP_POST_VARS)) { if (in_array ($key, $search_vals)) { if (is_numeric($value) and!empty($value)) { $addtosql .= " $key LIKE '%$value%' AND"; $get_val .= "$key=$value&amp;"; }elseif(!is_numeric($value) and!empty($value)){ $newval = urlencode($value); $topost .= "&$key=$newval"; //used later in reposting $value = addslashes($value); $addtosql .= " $key LIKE '%$value%' AND"; $get_val .= "$key=$value&amp;"; } //fi } //fi } //wend $addtosql = substr("$addtosql", 0, -3); $sql = "SELECT cust_id, drg_num, drg_desc, max(rev) as rev, drg_date, date, filename FROM drawings WHERE $addtosql GROUP BY drg_num"; ?> [/code] There are 3 search fields - drg_desc (Drawing Description), drg_num (Drawing Number) and cust_id (Customer). The above code will select all drawings with the highest revision according to what is entered into the search fields BUT it if there are 2 drawings with the same details but one has a more recent date, it doesn't neccessarily select the latest drawing. So to simplify how do i add a max(drg_date) to the SQL statement to make the query select drawings with the highest revision and the most recent date.
  11. Hi, when extracting data from my database, i have placed and IF statement to output the results. For example in the db column 'city' i have set the default to '0', when a user updates their information they often input what i expect and that is their City. So i inserted an IF statement shown below: [code] <?php //db connection info etc.. if($row[city] == "0"){ // the user did not input their city   echo "<p>Not Given</p>"; }else{ // the user inserted information   echo "<p>$row[city]</p>"; } ?> [/code] While browsing through my database i noticed that some users 'city' columns contain nothing, which is ok, because it is not a required field in my form. So i modified my IF statement below: [code] <?php //db connection info etc.. if($row[city] == "0"){ // the user did not input their city   echo "<p>Not Given</p>"; }elseif($row[city] == ""){ // the db column conatins nothing   echo "<p>Not Given</p>"; }else{ // the user inserted information   echo "<p>$row[city]</p>"; } ?> [/code] But this does not seem to work. I don't know if the user entered nothing or if they entered a space or even if using the "" in my code is correct. Now i could correct this when i parse the form by adding an if statement stating: [code] <?php if(!isset($_POST[city]){   $city = "0"; } ?> [/code] But once again if it contains a space how do specifiy that in my if statement. I hope some one can shine some light on this for me, Thanks in advance Seamless
  12. [!--quoteo(post=372574:date=May 9 2006, 08:29 AM:name=v3x)--][div class=\'quotetop\']QUOTE(v3x @ May 9 2006, 08:29 AM) [snapback]372574[/snapback][/div][div class=\'quotemain\'][!--quotec--] Dumb question but how do you make it execute a PHP script? [/quote] well after some research i'm entering this into my cron settings via cpanel: curl -s -o /dev/null [a href=\"http://www.my-website.com/crons/check-links.php\" target=\"_blank\"]http://www.my-website.com/crons/check-links.php[/a] i'm not getting an email now saying there is an error, so can i assume that as long as the php script is correct its doing its job? Seamless.
  13. [!--quoteo(post=372296:date=May 8 2006, 10:36 AM:name=Lofty)--][div class=\'quotetop\']QUOTE(Lofty @ May 8 2006, 10:36 AM) [snapback]372296[/snapback][/div][div class=\'quotemain\'][!--quotec--] If Ober's answer doesn't, check with your ISP. Many ISP's disable user crons, but when talked to nicely will set individual ones up foryou. [/quote] I've set chmod on all my cron file to 777 and i am now getting different errors: /home/my-username/www/my-website/crons/check-links.php: line 1: ? : No such file or directory /home/my-username/www/my-website/crons/check-links.php: line 2: : command not found /home/my-username/www/my-website/crons/check-links.php: line 3: =: command not found /home/my-username/www/my-website/crons/check-links.php: line 3: : command not found /home/my-username/www/my-website/crons/check-links.php: line 4: =: command not found /home/my-username/www/my-website/crons/check-links.php: line 4: : command not found /home/my-username/www/my-website/crons/check-links.php: line 5: =: command not found /home/my-username/www/my-website/crons/check-links.php: line 5: : command not found /home/my-username/www/my-website/crons/check-links.php: line 6: =: command not found /home/my-username/www/my-website/crons/check-links.php: line 6: : command not found /home/my-username/www/my-website/crons/check-links.php: line 7: : command not found /home/my-username/www/my-website/crons/check-links.php: line 9: syntax error near unexpected token `(' /home/my-username/www/my-website/crons/check-links.php: line 9: `$connection = mysql_pconnect("$dbhost","$dbusername","$dbpasswd") or die ("Couldn't connect to server."); ' The files are php, and if i access them via a browser they work correctly that way, am i doing something else wrong? Thanks Seamless
  14. Hi There, i wonder if anyone can help me.... i have some php scripts in a directory on my web server and want them to run and specific times using a cron tab. I thought i had set them up correctly but the email confirmation it sends when it performs a cron says: /bin/sh: line 1: /home/my-username/public_html/my-website/crons/check-links.php: Permission denied what am i doing wrong? can anyone shed some light on it. Thanks in advance Seamless.
  15. hmmm, maybe i'll look into that :P Cheers Liam...
  16. So am i right in thinking that the 'file_get_contents()' function checks the page source? If i get the users to enter their 'links page' and use that in the check, it should work out ok. I guess it would have to be somekind of crawler/spider to follow the links on peoples website to eventually find the link to my site.
  17. ahh, nice one. Cheers Liam. i thought 'foreach' was doing the loop! anyway its working, but i think its only checking the first page of the site is that correct?? Seamless
  18. [!--quoteo(post=361500:date=Apr 4 2006, 02:11 AM:name=Enter Display Name Here)--][div class=\'quotetop\']QUOTE(Enter Display Name Here @ Apr 4 2006, 02:11 AM) [snapback]361500[/snapback][/div][div class=\'quotemain\'][!--quotec--] Thank you for your quick response, but could you tell me how i can echo each vistors id so that they can see it on-screen and then write that to a file? Sorry for the simplistic question, but i'm really rather new to this. PHP is my first language ^^ Thanks [/quote] I'm not an expert, but i think it would probably be something like this... [code] <? $unique_id = session_id(); echo $unique_id; ?> [/code] Seamless..
  19. Hi I'm fairly new to php and i am building my first php website. I am allowing users to post there website URLs on my site providing they put a link to my site on theirs. Rather than having to check if they have I wanted a script to check for me. I found a simple backlink checker on the web which takes URLs from a text file and checks them for links to 'my domain'. I have modified it slightly so that it should update my database accordingly if a link to my site is found on theirs. Here's the orginal code.. [code] <?php $mydomain = "www.mydomain.com"; // Set this to your domain $list = file_get_contents("sites.txt"); $urls = explode ("\n", $list); echo "<B>Checking back links to $mydomain....</B><P><FONT SIZE=-1>"; foreach ($urls as $url) { if (strlen ($url)) { echo $url . "<B><FONT COLOR="; if (strpos (file_get_contents($url), $mydomain) != FALSE) { echo "GREEN> Found"; } else { echo "RED> Missing"; } echo "</FONT></B><BR>"; } } echo "</FONT>"; ?> [/code] And here is what i have modified.... [code] <? //include db connection info here $mydomain = "www.mydomain.com"; // Set this to your domain $sql = "SELECT website FROM table WHERE website like 'http://%'"; $result = mysql_query($sql) or die ("ERROR: ".mysql_error()." with query: $sql"); $urls = mysql_fetch_array($result); echo "<B>Checking back links to $mydomain....</B><P><FONT SIZE=-1><br />"; foreach($urls as $url){     if(strlen($url)){         echo $url . "<B><FONT COLOR=";             if(strpos(file_get_contents($url), $mydomain) != FALSE){                 // do nothing                 mysql_query("UPDATE table SET show_website='1' WHERE website='$url'");             }else{                 mysql_query("UPDATE table SET show_website='0' WHERE website='$url'");             }         echo "</FONT></B><BR>";     } } echo "</FONT>"; ?> [/code] My problem is that it only checks the first domain in the list... Any ideas? Thanks in advance Seamless
  20. [!--quoteo(post=357314:date=Mar 22 2006, 10:26 AM:name=AMcC)--][div class=\'quotetop\']QUOTE(AMcC @ Mar 22 2006, 10:26 AM) [snapback]357314[/snapback][/div][div class=\'quotemain\'][!--quotec--] Is it possible to display a php page for 3 or 4 seconds and then redirect the user back to the main menu page? If so, could you give a simple example or suggest an appropriate tutorial? [/quote] Yes, you can use a meta refresh [code] <meta http-equiv="Refresh" content="3; URL=http://www.yourdomain.com/yourpage.php" > [/code] where 3 is the amount of seconds you want to display the page for. Seamless seems like i need to refresh my page more :P
  21. I do apologise if this has been covered before... I'm retrieving some results from a mysql database and i'm using mysql_fetch_array() everything works fine.. Apart from the results are not case sensitive, i've checked the database using phpMyAdmin and the values stored ARE case sensitive what am i doing wrong? here's a peice of code as an example [code] <? $sql = "SELECT * FROM table ORDER BY signup_date DESC LIMIT 5"; $result    = mysql_query($sql) or die ("ERROR: ".mysql_error()." with query: $sql");     while($row = mysql_fetch_array($result)){         echo "<tr>                     <td class='profile_name'>                         <p><a href='user-profile.php?username=$row[username]'>$row[username]</a></p>                     </td>"; // Format date                 $signup_date = date('d-m-y', strtotime($row[signup_date]));                 echo "<td class='signup_date'>                         <p>$signup_date</p>                     </td>                 </tr>";         } ?> [/code] Thanks in advance Seamless
  22. After palying around with the function from my previous post i came up with this: [code] function remove_emails_from($string){         $pattern = "/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i";         $new_email = " ";         $new_string = preg_replace($pattern, $new_email, $string);     return $new_string;     } [/code] this will now remove an email address from a post. its use - [code] // $_POST[post_body] = "My email is someone@example.com email me!"; $post_body = remove_emails_from($_POST[post_body]); // Output would be - My email is  email me! [/code] Anyway thanks for your help those you contributed. Seamless SOLVED
  23. [!--quoteo(post=352058:date=Mar 6 2006, 08:11 AM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ Mar 6 2006, 08:11 AM) [snapback]352058[/snapback][/div][div class=\'quotemain\'][!--quotec--] What you have there is a regular expression, this can be used with the function preg_replace() - Check the details in the manual, this function should help you with what you are trying to do. [/quote] Ok, after a little research i have got a little function: [code] // input post function extract_emails_from($string){ // check if an email is present         $email = preg_match("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $string); // value you replace email address with         $new_email = "*****"; // replaces email with new value in post       $new_string = str_replace($email, $new_email, $string); // returns post without email     return $newstring; } [/code] The only trouble is instead of replacing an email address in the post with '****' it is removing the whole post.
  24. [!--quoteo(post=352044:date=Mar 6 2006, 07:13 AM:name=edwinsweep)--][div class=\'quotetop\']QUOTE(edwinsweep @ Mar 6 2006, 07:13 AM) [snapback]352044[/snapback][/div][div class=\'quotemain\'][!--quotec--] i would suggest just not to ask the database to send the email addres. if you are using a database and the messages the people post are stored in that database, the messages will have to be extracted from the database to be shown as a page. here is a mysql example. [code] mysql_query = "SELECT * FROM messages WHERE..." [/code] this above will select every entry from the message you selected with the WHERE command. instead of doing this just SELECT only the needed entry's and display them on the screen. just leave out email addres, like this. [code] mysql_query = "SELECT msgname,msgtitle,msgsender FROM messages WHERE..." [/code] if you want the users to be able to send an email message to the poster you could design a mail form that will never show his email address.(just a theorie). [/quote] Cheers for the reply however, i think either you have misunderstood my post or my explanation wasn't very good, this is not a mysql problem, the post or message is being inserted into the database correctly. BUT if a user decides to enter their email address into the post i want to take the email address out so when i collect the information from the database to display it, it displays their post without the email address.
  25. Hi, I'm wondering if anyone can help me? I am writing a page in php which will allow users to post a message for all to see. If a user enters their email address in the post i want my script to either delete or replace the email address from in the post. Any ideas? i've been looking along the lines of str_replace() is this right? i also have a the format of an email which i can implement but i'm just not sure how ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$ Anyway a solution or advice would be musch appreciated. Thanks Seamless
×
×
  • 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.