Jump to content

scotch33

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

scotch33's Achievements

Member

Member (2/5)

0

Reputation

  1. hi, I'm trying to set an item's visibilty based on whether it has been used before. I have got to the stage where, if an item is used I write to a database and save the user's id, the artcle id and a 'lock id'. Then using a foreach I am scrolling through the articles to check whether they have been viewed, setting a session and then doing an if statement to show if the session says it's ok. That's the theory. ;-) In practice although I am getting the right callbacks from the database (a variable called lock_id shows the number of the database entry if there is an entry or '0' if there is not) I seem to be having trouble then setting the Session accordingly. However lock ID is correctly showing as a different number. Here's the code... if( isset($params['article_id']) ) { $article_id = (int)$params['article_id']; } global $gCms; $feusers = $gCms->modules['FrontEndUsers']['object']; if( $feusers ) { $uid = $feusers->LoggedInId(); $user_data = $feusers->GetUserProperties($uid); } echo "The user ID is ".$uid; echo "<br />The article ID is ".$article_id; $article_lock = mysql_query("SELECT lock_id FROM cms_module_news_lock WHERE user_id = '$uid' AND news_id = $article_id"); $article_lock_row = mysql_fetch_array($article_lock); $article_lock = (int)$article_lock_row['lock_id']; echo "<p>Lock ID:".$article_lock."</p>"; if ($article_lock > 0) { $_SESSION['locked'] = "locked"; } else { $_SESSION['locked'] = "unlocked"; }
  2. hi there, here is my query - $affiliateresult = ("SELECT nov_main_firstname, nov_main_surname, nov_main_coname, nov_main_id, nov_affiliate_code FROM nov_affiliate_code, nov_main_account WHERE nov_affiliate_code.nov_affiliate_id = nov_main_account.nov_main_id"); and then on line X i have the following - while ($affiliaterow = mysql_fetch_array($affiliateresult)) { some code } I have been into phpmyadmin and tested the sql in the query window and it resuklts in what i want, but when it is in my own code as above it is giving me the following Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/novusta1/public_html/admin_affiliates.php on line X I have been staring at this for an hour now and cannot work out what I am doing wrong - if anyone can help I would be very grateful. Thanks!
  3. I am having some trouble with getting 'include' working. I have a new dedicated server running Apache 2.0.63 and PHP 5.2.6. Local includes on the same domain are running ok, but remote includes are throwing a problem. On the many sites we plan to host on this servber we use a central 'webmaster' page called as an include from a specific site (also on the same server). Thus I need to edit the PHP.ini and /or recompile the PHP with the appropriate modules to do one of the following... 1 (ideally) - allow includes from any site that is held on this dedicated server 2. allow includes from specified websites 3. simply allow remote includes Can anyone point me at the right settings to get one of these options running and solve my problem? Thanks very much!
  4. ok- that had some effect, but the error is still appearing. the code below includes the settign of the integer. settype($_SESSION['member_show_amount'], 'integer'); $amount = $_SESSION['member_show_amount']; echo gettype($amount); // select the right type of user and amount of records to show if ($_SESSION['member_show_type'] == "active") { $adult_summary = mysql_query("SELECT * FROM hav_main_account WHERE hav_main_active = '2' LIMIT 1, '$amount'"); } elseif ($_SESSION['member_show_type'] == "suspended") { $adult_summary = mysql_query("SELECT * FROM hav_main_account WHERE hav_main_active = '1' LIMIT 1, '$amount'"); } else { $adult_summary = mysql_query("SELECT * FROM hav_main_account LIMIT 1, '$amount'"); } The results I am getting now, are the error below - the '25' it mentions is the number i am using to test and the word integer is from the gettype command b4 the sql query starts. integer error performing query:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''25'' at line 2
  5. That makes sense - will set them as integers before passing on. Thanks!
  6. aha! "25" original inputs are in a form - <input name="member_show_amount" type="radio" value="10"> 10<br /> <input name="member_show_amount" type="radio" value="25"> 25<br /> <input name="member_show_amount" type="radio" value="50"> 5
  7. Well this is an included file. Line 2 of the file that includes it is session_start(); line 2 of the file itself is just html as below <div class="box_top_left"><img src="../sitelook/box_tcorner_left.gif" width="63" height="60" /></div><div class="box_top_right"><img src="../sitelook/box_tcorner_right.gif" width="10" height="60" /></div><div class="box_bottom_left"><img src="../sitelook/box_bcorner_left.gif" /></div><div class="box_bottom_right"><img src="../sitelook/box_bcorner_right.gif" /></div> Also - if i take out '$amount' and use a number, it works as one would expect.
  8. Hi there, Thanks for that, but I am still getting an issue - The problem is - "error performing query:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''25'' at line 2" With the folllowing code (expanded to show all code in section in case anything else in it is causing the issue)... // select the right type of user and amount of records to show if ($_SESSION['member_show_type'] == "active") { $adult_summary = mysql_query("SELECT * FROM hav_main_account WHERE hav_main_active = '2' LIMIT 1, '$amount'"); } elseif ($_SESSION['member_show_type'] == "suspended") { $adult_summary = mysql_query("SELECT * FROM hav_main_account WHERE hav_main_active = '1' LIMIT 1, '$amount'"); } else { $adult_summary = mysql_query("SELECT * FROM hav_main_account LIMIT 1, '$amount'"); } // end select the right type of user and amount of records to show
  9. I am trying to LIMT results for a query based on the amount of results that a user wishes to see - I am saving the amount the user wishes to see to a session variable, then trying to call it into a sql quey - but I cannot work out the syntax to do thjis - each time I try to build the query, it fails. The code below is what I thought it should be (the session mentioned being a number... // select the right type of user $adult_summary = mysql_query("SELECT * FROM hav_main_account WHERE hav_main_active = '2' LIMIT 1, '$_SESSION[member_show_amount]'"); // end select the right type Can anyone help? Thanks.
  10. ah - that's a good idea - will try the output straight to browser and see what the state of play is. the other bits - yes all good on the pc I am testing on, all needed elements are in place.
  11. Hi there, I am having a bit of bother with sending a pdf as an attachment to an automated e-mail send to customers requesting a brochure. I have the mail and attachment working but when I try to open the pdf it says it cannot recognise the filetype. I have looked around and everywhere I have looked the content type for PDF as an attachemnt is 'application/pdf'. I have copied my code below - if anyone can see where I am going wrong I would appreciate the info. Thanks! John $headers = "From: info@newmaticelevators.com \r\n"; $headers .= "Reply-To: info@newmaticelevators.com \r\n"; $headers .= "Bcc: \r\n"; $recipient = $_SESSION['email']; $subject = "Your brochure request from the Newmatic Elavators website"; $bound_text = "antelope2574017"; $bound = "--".$bound_text."\r\n"; $bound_last = "--".$bound_text."--\r\n"; $headers .= "MIME-Version: 1.0\r\n" ."Content-Type: multipart/mixed; boundary=\"$bound_text\""; $message .= "If you can see this MIME than your client doesn't accept MIME types!\r\n" .$bound; $message .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n" ."Content-Transfer-Encoding: 7bit\r\n\r\n". "<html> <head> <title>A brochure request from the Newmatic Elevators website</title> </head> <body><p>Dear ".$_SESSION['title']." ".$_SESSION['surname']."</p> <p>You requested a brochure from the Newmatic elevators website.</p><p>Your brochure was requested as a PDF and is attached to this e-mail. Should you have any futher requests please feel free to contact us on the details below.</p><p>Yours sincerely<br /><br />The Newmatic Elevators Team.</p>The Stag House<br /> Wooburn Town<br /> High Wycombe<br /> Buckinghamshire<br /> HP10 0PN<br /> <br /> Phone: 01628 523977<br /> Fax: 01628 529130<br /> <a href='mailto:info@newmaticelevators.com'>info@newmaticelevators.com</a></body></html>\r\n" .$bound; $file = file_get_contents("http://www.newmaticelevators.com/pdfs/NE_brochure.pdf"); $message .= "Content-Type: application/pdf; name=\"NE_brochure.pdf\"\r\n" ."Content-Transfer-Encoding: base64\r\n" ."Content-disposition: attachment; file=\"NE_brochure.pdf\"\r\n" ."\r\n" .chunk_split(base64_encode($file)) .$bound_last; mail($recipient,$subject,$message,$headers); // end send a confirmation to the requester header('Location: http://www.newmaticelevators.com/download/brochure_request_completed.php');
  12. Hi there, I am in the process of creaing my first image using the GD library and imagettftext. I have got so far, but now hit a stumbling block. The process is as follows... User answers choices to create the text of a letter. Letter variables added to image?get Image called from page. I have got it all working fine apart from getting text to start on newlines when it reaches the end of a section. I have 2 issues - 1. I don't get how to set a boundary for text that tells it to word wrap when it reaches a point on the page. 2. I can't get the text to start a newline with either \n or <br> in the image - however, I can get it to start newlines if I look at the get text in the url. I have scaled down a copy of the image here so you can see what i am getting so far - http:www.webserverworld.co.uk/letter.jpg I have looked around on the web and have seen some references to wordwrapping and tried to implement them but so far have had no luck. If anyone can point me in the right direction on this, I would very much appreciate it. The code I am using thus far is below. <? // Set the content-type header("Content-type: image/jpeg"); // Create the image $im = imagecreatefromjpeg("santa_letter.jpg"); // Create some colors $black = imagecolorallocate($im, 0, 0, 0); // The text to draw $greeting = $_GET['greeting']; $p1 = $_GET['p1']; $p2 = $_GET['p2']; $p3 = $_GET['p3']; $user = $_GET['user']; $pass = $_GET['pass']; // Replace path by your own font path $font = dirname(__FILE__).'/FGWurth.ttf'; // Add the text imagettftext($im, 40, 0, 200, 900, $black, $font, $greeting); imagettftext($im, 40, 0, 200, 1100, $black, $font, $p1); imagettftext($im, 40, 0, 200, 1300, $black, $font, $p2); imagettftext($im, 40, 0, 200, 1500, $black, $font, $p3); imagettftext($im, 40, 0, 200, 1800, $black, $font, $user); imagettftext($im, 40, 0, 200, 1880, $black, $font, $pass); // array imagettftext ( resource $image, float $size, float $angle, int $x, int $y, int $color, string $fontfile, string $text ) imagejpeg($im); imagedestroy($im); ?>
  13. Hi there, I'm trying to create an image using imagettftext - at the moment I am just trying to get some basic image to work and then I plan to do stuff with it. I have grabbed example code from a php site as below... <? // Set the content-type header("Content-type: image/png"); // Create the image $im = imagecreatetruecolor(400, 30); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 399, 29, $white); // The text to draw $text = 'Testing...'; // Replace path by your own font path $font = 'arial.ttf'; // Add some shadow to the text imagettftext($im, 20, 0, 11, 21, $grey, $font, $text); // Add the text imagettftext($im, 20, 0, 10, 20, $black, $font, $text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); ?> However when I try to view it at http://www.havebeengood.com/memberpages/layout/images/letter.php, the result is this message - "The image “http://www.havebeengood.com/memberpages/layout/images/letter.php” cannot be displayed, because it contains errors." I have uploaded a copy of arial.ttf to the directory so that ref is correct If I try to create the image WITHOUT imagettftext - the image displays ok. I have put a php(info) file up to check all and have the following set in my GD library - GD Support enabled GD Version 2.0 or higher FreeType Support enabled FreeType Linkage with freetype FreeType Version 2.1.10 T1Lib Support enabled GIF Read Support enabled GIF Create Support enabled JPG Support enabled PNG Support enabled WBMP Support enabled All seems ok - but its not working! can anyone help me as to why this could be? Thanks!
  14. Hi there, I have just got a new dedicated server and need to setup PHP to work with mysql on it. Now it comes pre-installed with php, my sql and REDHAT. I have checked the PHPO config and can see that the problem I have (found whilst trying to install some software that wouldn't install because "Mysql extension" is not switched on) is that in the .configure php command 'without mysql' is set. I am guessing that by changing this command to 'with mysql' i'll be able to turn on the php ability to work with mysql and thus solve the prob. So my question is how do i do that? If anyone can point me at some help where I can learn about how to change the configure command in apache (if that is right?), then I would appreciate it! Thanks! John.
×
×
  • 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.