Php problem

I created this page using Dreamweaver, and following a php tutorial (thanks, David Powers).  I'm not at all experienced with writing php and have run into problems trying to incorporate a recaptcha spam check.  I've used the check successfully with forms which call a separate script, but need to incorporate the code on the actual page in this case and can't get it to work.
Can anyone help?
Here's the page:  http://www.ukcountryradio.com/vote_artist2.php
And here's the php - I've included all of it so there's quite a lot...  The page works correctly apart from the recaptcha check.
Thanks,
SW
<?php require_once('Connections/ukcr.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;   
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  return $theValue;
mysql_select_db($database_ukcr, $ukcr);
$today = date('l');
$query_schedules = "SELECT `day`, `time`, short_title, presenter FROM schedules WHERE day='{$today}' AND time > '0700' ORDER BY time, short_title ASC";
$schedules = mysql_query($query_schedules, $ukcr) or die(mysql_error());
$row_schedules = mysql_fetch_assoc($schedules);
$totalRows_schedules = mysql_num_rows($schedules);
$errorurl = "http://www.ukcountryradio.com/error.php" ;
$my_recaptcha_private_key = '6LdAFb0SAAAAAP5qTVqEAfoycaImqp7-koT8tWlK' ;
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
if (strlen( $my_recaptcha_private_key )) {
                require_once( 'recaptchalib.php' );
                $resp = recaptcha_check_answer ( $my_recaptcha_private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] );
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "vote_artist")) {
  $insertSQL = sprintf("INSERT INTO vote_artist (`name`, `email`, artist, REMOTE_ADDR) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['artist'], "text"),
                                                                                   GetSQLValueString($_SERVER['REMOTE_ADDR'], "text"));
mysql_select_db($database_ukcr, $ukcr);
  $Result1 = mysql_query($insertSQL, $ukcr) or die(mysql_error());
  $insertGoTo = "vote_thanks_artist.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s", $insertGoTo));
?>

Try the below. I've moved the if/else statment further up the php script:
<?php require_once('Connections/ukcr.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;  
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  return $theValue;
if (!empty($_POST['address2'])) {
exit;
else {
mysql_select_db($database_ukcr, $ukcr);
$today = date('l');
$query_schedules = "SELECT `day`, `time`, short_title, presenter FROM schedules WHERE day='{$today}' AND time > '0700' ORDER BY time, short_title ASC";
$schedules = mysql_query($query_schedules, $ukcr) or die(mysql_error());
$row_schedules = mysql_fetch_assoc($schedules);
$totalRows_schedules = mysql_num_rows($schedules);
$errorurl = "http://www.ukcountryradio.com/error.php" ;
$my_recaptcha_private_key = '6LdAFb0SAAAAAP5qTVqEAfoycaImqp7-koT8tWlK' ;
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
if (strlen( $my_recaptcha_private_key )) {
                require_once( 'recaptchalib.php' );
                $resp = recaptcha_check_answer ( $my_recaptcha_private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] );
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "vote_artist")) {
  $insertSQL = sprintf("INSERT INTO vote_artist (`name`, `email`, artist, REMOTE_ADDR) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['artist'], "text"),
                                                                                    GetSQLValueString($_SERVER['REMOTE_ADDR'], "text"));
mysql_select_db($database_ukcr, $ukcr);
  $Result1 = mysql_query($insertSQL, $ukcr) or die(mysql_error());
  $insertGoTo = "vote_thanks_artist.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
header(sprintf("Location: %s", $insertGoTo));
?>

Similar Messages

  • Big PHP problem (SOLVED)

    Hello. I have a big problem. I installed php. For an example, script <? print "hello"; ?> working good, but script like that:
    <? print "labas"; ?>
    <?php
    session_start();
    include("config.php");
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=windows-1257" />
    <title>4Friends</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <link href="default.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div id="header">
    <div id="logo">
    <h1><a href="#">Hello</a></h1>
    <h2><a href="?">Bla bla bla </a></h2>
    </div>
    </div>
    <div id="menu">
    <ul>
    <li class="first"><a href="#" title="">News</a></li>
    <li><a href="#" title="">Menu</a></li>
    <li><a href="#" title="">Skyrelis 1 </a></li>
    <li><a href="#" title="">Skyrelis 2 </a></li>
    <li><a href="#" title="">Skyrelis 3 </a></li>
    </ul>
    </div>
    <div id="content">
    <div id="sidebar">
    <div id="login" class="boxed">
    <h2 class="title">Wah</h2>
    <div class="content">
    <? include("nevermind :)"); ?>
    </div>
    </div>
    <div id="updates" class="boxed">
    <h2 class="title">Bla bla bla </h2>
    <div class="content">
    <ul>
    <li>
    <h3>Balandio 20, 2007</h3>
    <p><a href="#">Pew pew</a></p>
    </li>
    </ul>
    </div>
    </div>
    <div id="partners" class="boxed">
    <h2 class="title">Aaa</h2>
    <div class="content"></div>
    </div>
    </div>
    <?
    PHP CODE WITCH DOESNT MATTER HERE
    ?>
    </div>
    <div id="footer"><p>
    <a href="http://validator-test.w3.org/check?uri=referer"><img
    src="http://www.w3.org/Icons/valid-xhtml10-blue"
    alt="Valid XHTML 1.0 Strict" height="31" width="88" /></a>
    </p>
    <p>
    <a href="http://jigsaw.w3.org/css-validator/">
    <img style="border:0;width:88px;height:31px"
    src="http://jigsaw.w3.org/css-validator/images/vcss"
    alt="Valid CSS!" />
    </a>
    </p>
    </div>
    </body>
    </html>
    <?
    sql_disconn();
    ?>
    Displays only white screen. short_open_tag is on in php.ini. Can anyone say what is the problem? I tryed to run this script on windows WAMP, and this goes good.
    Last edited by neXTPeer (2007-07-28 08:09:09)

    neXTPeer wrote:
    ralvez wrote:
    It's got to be some misconfiguration on  your end. I just put the file in my server and works fine.
    R
    Am. I still don't get it what is the problem.
    The whole extent of your code is 5 php statements and the rest is HTML but you get a blank page ... take the php code out and see if the HTML shows. Make sure you set the permissions of that file to 744, and test. You should be able to see the html document. If you do not see anything then type on a console (as root) "tail -f /var/log/httpd/error_log" so  you can see the errors that the server returns.
    If HTML works, then begin to add the php code one block at a time  (you only have 5 so that should not be too hard) until it fails and then analyze the logs to see what upsets your server.
    Hope this helps.
    R

  • David Powers Lesson08 forgotten.php problem

    I have a strange problem when running forgotten.php. The program works alright initially with the setting of mail_connector.php as below. I managed to send and received email. Everything works fine intially. After sometime, I found problem running the same program again. This time it generates error message of 'Notice: Underfined index: [email protected] in c:\vhosts\phpcs5\lesson8\scripts\request_reset.php on line 25' and also message 'No connection could be made because the target machine actively refused it.'
    Any idea why ?
    Mail_Connector.php
    <?php
    $mailhost = 'mail.agri-organica.com';
    $mailconfig = array('auth'     => 'login',
                        'username' => '[email protected]',
                                                      'password' => 'password');
    $transport = new Zend_Mail_Transport_Smtp($mailhost, $mailconfig);
    Zend_Mail::setDefaultTransport($transport);

    I changed the From header using agri-organica.com address and send to yahoo address. This time it shows:
    'No connection could be made because the target machine actively refused it.'
    Request Received
    An email has been sent to your registered address with instructions for resetting your password.
    Request_reset.php
    <?php
    $errors = FALSE;
    $result = FALSE;
    if ($_POST) {
      require_once('library.php');
      require_once('mail_connector.php');
      try {
              $val = new Zend_Validate_EmailAddress();
              if (!$val->isValid($_POST['email'])) {
                $errors = TRUE;
              if (!$errors) {
                $sql = $dbRead->quoteInto('SELECT user_id, first_name, family_name, email FROM users WHERE email = ?', $_POST['email']);
                $result = $dbRead->fetchRow($sql);
                if (!$result) {
                        $errors = TRUE;
                } else {
            // update database and send mail
                        $token = md5(uniqid(mt_rand(), TRUE));
                        $data = array('token' => $token);
                        $where = $dbWrite->quoteInto('email = ?', $_POST['email']);
                        $dbWrite->update('users', $data, "user_id = {$result['user_id']}");
                $mail = new Zend_Mail('UTF-8');
                $mail->addTo($result['email'], "{$result['first_name']} {$result['family_name']}");
                $mail->setSubject('Instructions for resetting your password');
                $mail->setFrom('[email protected]', 'Calvin');
                $link = "http://phpcs5/lesson8/reset.php?id={$result['user_id']}&token=$token";
                $message = "Use the following link to reset your password. This link can be used once only. $link";
                $mail->setBodyText($message, 'UTF-8');
                $mail->send();
      } catch (Exception $e) {
              echo $e->getMessage();

  • ZendFramework gateway.php problem

    Hej,
    I make a Flex 4 application with database services using zendframework. All is ok on localhost, when I deploy to Hosting Server, the first 3 hours all is ok, I use Flex application and the data is get ok, but 4 or 5 hours later the zendframework service send the following error:
    "Send failed
    Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Failed: url: 'http://www.sftak.se/gateway.php' "
    My amf_config.ini configuration is:
    [zend]
    ;set the absolute location path of webroot directory, example:
    ;Windows: C:\apache\www
    ;MAC/UNIX: /user/apache/www
    webroot =./
    ;set the absolute location path of zend installation directory, example:
    ;Windows: C:\apache\PHPFrameworks\ZendFramework\library
    ;MAC/UNIX: /user/apache/PHPFrameworks/ZendFramework/library
    zend_path =./ZendFramework
    [zendamf]
    amf.production = false
    amf.directories[]=services
    amf.directories[]=php
    I put ZendFramework in webroot, I can't put outside of webroot, is a hosting server.
    When I work with pure php script, I don't have this problem, never.
    Any idea?????
    Please Help me.
    Thanks in advance.

    Any ideas, this has been a pain in my side all weekend... been moving files and reinstalling things right left and centre!!
    is it a Zend issue or Flash?
    This needs to be resolved as its a key function in their demo!!!

  • Flash cs3 and php problem (system error)

    Hi All,
    Been checking out a free utility, called Tell A Friend - followed the instructions to a t but still getting system error.
    Here is the php code:
    <?php
    $to = ($_POST['friend']);
    $link = ($_POST['link']);
    $subject = "Tell a friend";
    $message = "Your friend ";
    $message .= $_POST['name'] . " wants advice you the following link: ".$link;
    $headers = "My WebSite Name";
    if(@mail($to, $subject, $message, $headers))
    echo "answer=ok";
    else
    echo "answer=error";
    ?>
    The main swf has a main.as attached:
    * Flash Tell A Friend
    * http://www.FlepStudio.org        
    * Author: Filippo Lughi          
    * version 1.0                      
    package
    import flash.display.*;
    import flash.events.*;
    import flash.utils.*;
    import flash.external.*;
    import flash.net.*;
    public class main extends MovieClip
      private const PHP_URL:String="sendMail.php";
      private var checker:CheckEmail;
      private var timer:Timer;
      public function main()
       addEventListener(Event.ADDED_TO_STAGE,init);
      private function init(evt:Event):void
       removeEventListener(Event.ADDED_TO_STAGE,init);
       stage.frameRate=31;
       checker= new CheckEmail();
       addInputListener();
       addSendListener();
      private function addInputListener():void
       clip_mc.name_txt.background=true;
       clip_mc.name_txt.backgroundColor=0x999999;
       clip_mc.name_txt.addEventListener(FocusEvent.FOCUS_IN,onFocusIn);
       clip_mc.name_txt.addEventListener(FocusEvent.FOCUS_OUT,onFocusOut);
       clip_mc.email_txt.background=true;
       clip_mc.email_txt.backgroundColor=0x999999;
       clip_mc.email_txt.addEventListener(FocusEvent.FOCUS_IN,onFocusIn);
       clip_mc.email_txt.addEventListener(FocusEvent.FOCUS_OUT,onFocusOut);
      private function onFocusIn(evt:Event):void
       evt.target.background=true;
       evt.target.backgroundColor=0xFFFFFF;
      private function onFocusOut(evt:Event):void
       evt.target.backgroundColor=0x999999;
      private function addSendListener():void
       clip_mc.send_mc.mouseChildren=false;
       clip_mc.send_mc.buttonMode=true;
       clip_mc.send_mc.addEventListener(MouseEvent.MOUSE_DOWN,onSendDown);
      private function onSendDown(evt:MouseEvent):void
       if(clip_mc.name_txt.text!="")
        if(checker.initCheck(clip_mc.email_txt.text))
         sendEmail();
        else
         displayPhrase("Invalid Email");
       else
        displayPhrase("Invalid name");
      private function sendEmail():void
       clip_mc.send_mc.mouseEnabled=false;
       var variables:URLVariables=new URLVariables();
       variables.name=clip_mc.name_txt.text;
       variables.friend=clip_mc.email_txt.text;
       variables.link=ExternalInterface.call('window.location.href.toString');
       var request:URLRequest=new URLRequest();
       request.url=PHP_URL;
       request.method=URLRequestMethod.POST;
       request.data=variables;
       var loader:URLLoader=new URLLoader();
       loader.dataFormat=URLLoaderDataFormat.VARIABLES;
       loader.addEventListener(Event.COMPLETE,onMessageSent);
       try
        loader.load(request);
       catch (error:Error)
        trace('Unable to load the document.');
      private function onMessageSent(evt:Event):void
       var vars:URLVariables=new URLVariables(evt.target.data);
       if(vars.answer=='ok')
        displayPhrase("Message Sent!");
       else
        displayPhrase("System Error!");
       clip_mc.send_mc.mouseEnabled=true;
       clip_mc.name_txt.text="";
       clip_mc.email_txt.text="";
      private function displayPhrase(s:String):void
       clip_mc.display_txt.text=s;
       resetPhrase();
      private function resetPhrase():void
       timer=new Timer(1500,1);
       timer.addEventListener(TimerEvent.TIMER,hidePhrase);
       timer.start();
      private function hidePhrase(evt:TimerEvent):void
       clip_mc.display_txt.text="";
    Any help appreciated. This is a great viral marketing tool, when it ever works
    Kind Regards,
    Boxing Boom

    Never seen such an error, but if it's in the status bar of the browser then it shouldn't be Flash problem. You can check what's happening in your swf by creating a dynamic text field and setting it's text in every major action, that is: requesting PHP and getting back response, to what's just happened.
    So, on the Flash side you can see whether the browser error stops the PHP script and immobilizes further actions.
    What I'd do is create a new Flash file and PHP file and just send 1 variable to PHP, change it somehow and send it back to Flash and print it in a text field. That way you can check whether it's the method you're using to request PHP or just PHP or something else. Step by step adding complexity and checking on which of these steps the error occurs.
    I wish you good luck.
    Ps. It's probably a very rookie problem, we just don't know the source.

  • Flex/PHP problem lastResult does not work correctly

    hi flex community,
    I am trying to develope a small login but I am still new to flex. It's based a little bit on the tutorial "Flex Test Drive: Build an application in an hour". I have a mysql database where the username and the password are stored in.
    My Flex file looks like this:
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                                xmlns:s="library://ns.adobe.com/flex/spark"
                                xmlns:mx="library://ns.adobe.com/flex/mx"
                                xmlns:loginservice="services.loginservice.*"
                                currentState="Login"
                                width.Login="719" height.Login="606"
                                width.Main="975" height.Main="700" xmlns:valueObjects="valueObjects.*">
         <fx:Script>
              <![CDATA[
                   import mx.controls.Alert;
                   import mx.events.FlexEvent;
                   protected function buttonLogin_clickHandler(event:MouseEvent):void
                        loginResult.token = loginService.login(username.text, password.text);
                        trace(vOLogin.username);
                        trace(vOLogin.password);
                        trace(vOLogin.valid)
                        /*if (vOLogin.valid == true) {
                             currentState = "Main";
              ]]>
         </fx:Script>
         <s:states>
              <s:State name="Login"/>
              <s:State name="Main"/>
         </s:states>
         <fx:Declarations>
              <valueObjects:VOLogin id="vOLogin" />
              <s:CallResponder id="loginResult" result="vOLogin = loginResult.lastResult[0] as VOLogin"/>
              <loginservice:LoginService id="loginService"
                                               fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                               showBusyCursor="true"/>
              <!-- Place non-visual elements (e.g., services, value objects) here -->
         </fx:Declarations>
         <s:TextInput id="username" includeIn="Login" x="118" y="37" width="107"/>
         <s:TextInput id="password" includeIn="Login" x="118" y="88" width="107" displayAsPassword="true"/>
         <s:Label includeIn="Login" x="20" y="38" width="84" height="22" text="Benutzername:"
                    textAlign="right" verticalAlign="middle"/>
         <s:Label includeIn="Login" x="20" y="88" width="84" height="22" text="Passwort:"
                    textAlign="right" verticalAlign="middle"/>
         <s:Button id="buttonLogin" includeIn="Login" x="22" y="143" width="195" label="Login"
                     click="buttonLogin_clickHandler(event)"/>
    </s:WindowedApplication>
    and my 2 php Files look like this:
    VOLogin.php
    <?php
    class VOLogin {
         public $id;
         public $valid;
         public $msg;
          public $username;
          public $password;
         public $versionnumber;
    ?>
    And this is my LoginService.php file:
    <?php
    require_once('VOLogin.php');
    require_once('config.php');
    //$foo = new LoginService();
    //var_dump($foo->login("heinz", "heinz"));
    class LoginService {
    * Retrieve all the records from the table
    * @return an array of VOBenutzer
    * @param string $username
    * @param string $password
    public function login($username, $password) {
        $mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD);
        mysql_select_db(DATABASE_NAME);
        $SQL = "select * from flex where username='".$username."' and password='".$password."'";
        $r = mysql_query($SQL);
        if(mysql_num_rows($r) == 1) {
            $row = mysql_fetch_object($r);
            $tmp = new StdClass();
            $tmp->id = $row->id;
            $tmp->valid = true;
            $tmp->msg = "Login Ok";
            $tmp->username = $row->username;
            $tmp->password = $row->password;
            $tmp->versionnumber = $row->versionnumber;
            $output[] = $tmp;
        }else {
            $tmp = new StdClass();
            $tmp->id = 0;
            $tmp->valid = false;
            $tmp->msg = "Benutzername oder Passwort falsch";
            $tmp->username = $username;
            $tmp->password= $password;
            $tmp->versionnumber = 0;
            $output[] = $tmp;
        return $output;
    ?>
    My actual problem is that I have to press 2 times on the button to get the correct trace information. With the help of the search function I found this thread:
    http://forums.adobe.com/thread/259280
    I am not sure if I have the same problem. If yes where should I put the eventhandler? I would be very happy for every useful answer.
    Greetings
    flexx0r

    Here is a good article on how the % key works.
    It is working as designed. It just isn't what you are expecting. It just isn't designed for Engineers.
    http://blogs.msdn.com/b/oldnewthing/archive/2008/01/10/7047497.aspx

  • Apache/PHP - Problem with shell_exec - ImageMagick - convert

    Hi,
    I have a problem with running external commands from a webpage written in php using Apache. In this case I'm trying to run convert, which is a program in ImageMagick.
    I can run most commands without any problems but when running these I get errors.
    shell_exec("/usr/bin/convert -alpha Set -filter bessel -resize '200'x'200' -density '200'x'200' 'image.eps' -channel A -fx 'B' -negate '/var/im/4.png' 2>&1");
    shell_exec("/usr/bin/convert 'image.eps' -alpha Set -filter bessel -channel A -fx 'B' -negate '/var/im/4.png' 2>&1");
    shell_exec("/usr/bin/convert '/var/im/4.png' -density '200'x'200' -resize '200'x'200' '/var/im/5.png' 2>&1");
    Error:
    convert: Error when saving the profile into a file '.' @ warning/opencl.c/autoSelectDevice/2303.
    The first command generates the new image but it is incorrect. The two others together gives me an output which looks correct but I still get the errors.
    Running either of these commands directly via shell works great and generates the correct output and no error messages.
    I would guess that the issue is how Apache handles the execution of shell_exec and the user that is used to run Apache. There is probably some restrictions that creates the issue but I'm note sure what.
    I have tried running Apache using a new user I created which can run the commands correct directly in shell or by running "php -f testfile.php" but not through a webpage via Apache.
    Any suggestions?
    I also asked in the ImageMagick forum if anyone wants to check that they think so far.
    http://www.imagemagick.org/discourse-se … =1&t=25418

    are your files being uploaded correctly ?
    i think u need to determine that first.

  • (broken record here) php problem

    Okay, this will probably sound really foolish, but here is what happened. I downloaded a script from php resource index (here is the site for the script:
    http://www.giuseppecalbi.com/scripts/gc_formmail/?lan=en ). Apparently, it's extremely simple, lol. Anyway, I could swear I followed the instructions to the tee (there were very few of them), but when I submit a form on the page, instead of sending me an email, it does nothing. Also, instead of going to a confirmation page, it goes to the page of the script and shows the entire thing written out rather than actually running it. Any ideas what could be causing this? Thanks in advance for any help. I think I need to go to a special camp for people with brain blocks against php.

    Thanks for all of your suggestions, guys. Actually, I wasn't browsing to it, php is enabled and it's on the same server that is running other php scripts. I checked everything here, and it still wasn't working. I ended up using a different script for the same thing and it works just fine. I don't know if it was just a problem with the script or if I did something wrong, but either way, it wasn't a great enough script for me to drive myself insane over it. On the plus side, at least this guy has me on his mailing list now.

  • Apache // PHP problems

    Dear all,
    I have a very weird problem with the built-in Apache / PHP I cannot solve myself.
    Whatever I try, my *.php files are not processed but downloaded when locally hosted.
    Background:
    For an experiment I want to locally host a few pages / site. It needs html for the front-end, PHP for processing and MySQL for storing. Nothing special. As I didn't fancy a lot of configuring, I downloaded two instances of such an architecture: MAMP and LAMP. Both did not work and gave the same problem as I'm experiencing now with the built-in Apache and PHP. I'm on a fresh install (as of last night, updated and all), so there should be no problems there.
    To enable Apache and PHP, I've enabled the web-sharing option, uncommented the PHP5-line in the configuration for Apache and tested it via /localhost/manual, phpinfo() and via Terminal. It works well. Now, when I use a simple html-file that uses a form to post something to a linked PHP-file, it does not process the file and carry out the PHP-instructions. Instead, it just downloads the PHP-file...!? (files are stored in and opened form /sites/)
    How can I solve this? Please note I did not yet install MySQL, I am just testing and trying to get this solved. I'm pretty sure it's not my code, as I tested it on an online server where it worked flawlessly (it is not an option to host the final result online as I need LARGE videofiles).
    What can it be? Hope you can help.
    Best,
    -Pim
    Details:
    Mac OS X Snow Leopard. 10.6.3
    PHP 5.3.1
    Apache 2.2

    for php, you must enable your local web server, and access the files through safari with either a bonjour address or an ip address. if you open an html file from finder and click on something that links to a php file, it will show just the php file (all it's code). php is a server-side scripting language that needs a webserver to parse it. try enabling the web server, opening safari, and going to http://localhost/~username/path/to/file if the files are in ~/Sites/, or http://localhost/path/to/file if in the root web document directory (usually /Library/WebServer/Documents/).

  • A php problem. With table/ fourm.

    Ok so basically im following a set of video tutorials, and i got it a part that i cant understand whats going on.
    I have my table set up, then my fourm codes under but when i preview the website the code shows under the table,
    and heres part of the code thats the end of the table and the begining of that code.
    </tr>
    </table>
    </form>
    if ($_POST['submitbtn']) {
    $firstname = strip_tags($_POST['firstname']);
    $lastname = strip_tags($_POST['lastname']);
    i can upload more if it would help.
    Thanks,
    Dominic

    Theres the code, and it just says its a syntax error, and so im guessing somewhere i have something typed wrong or missing, but i just cant find out what it is.
    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Site Name - Register</title>
    <link href='styles/main.css' rel='stylesheet' type="text/css"></link>
    </head>
    <div id='header'></div>
    <div id='nav'><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a></div>
    <div id='wrapper'></div>
    <div id='content'>
    <div id='full'>
    $form = <form action='register.php' method='post'>
    <table>
    <tr>
    <td>First Name:</td>
    <td><input type='text' name='firstname'></td>
    </tr>
    <tr>
    <td>Last Name:</td>
    <td><input type='text' name='lastname'></td>
    </tr>
    <tr>
    <td>Username:</td>
    <td><input type='text' name='username'></td>
    </tr>
    <tr>
    <td>Email:</td>
    <td><input type='text' name='email'></td>
    </tr>
    <tr>
    <td>Password:</td>
    <td><input type='text' name='password'></td>
    </tr>
    <tr>
    <td>Confirm Password:</td>
    <td><input type='text' name='repassword'></td>
    </tr>
    <tr>
    <td>Avatar:</td>
    <td><input type='file' name='Avatar'></td>
    </tr><tr>
    <td>Website:</td>
    <td><input type='text' name='website'></td>
    </tr>
    <tr>
    <td>Youtube:</td>
    <td><input type='text' name='youtube'></td>
    </tr>
    <tr>
    <td>Bio:</td>
    <td><textarea name='bio' cols='35' rows='5'></textarea></td>
    </tr>
    <tr>
    <td></td>
    <td><input type='submit' name='submitbtn' value='Register'</td>
    </tr>
    </table>
    </form>
    <?php
    if ($_POST['submitbtn']) {
    $firstname = strip_tags($_POST['firstname']);
    $lastname = strip_tags($_POST['lastname']);
    $username = strip_tags($_POST['username']);
    $email = strip_tags($_POST['email']);
    $password = strip_tags($_POST['password']);
    $repassword = strip_tags($_POST['repassword']);
    $website = strip_tags($_POST['website']);
    $youtube = strip_tags($_POST['youtube']);
    $bio = strip_tags($_POST['bio']);
    $name = $_FILES['avatar'] ['name'];
    $type = $_FILES['avatar'] ['type'];
    $size = $_FILES['avatar'] ['size'];
    $tmpname = $_FILES['avatar']['tmpname'];
    $ext = substr($name, strrpos($name, '.'))
    if ($firstname && $lastname && $username && $email && $password && $repassword &&){
    if($password == $repassword){
    if(srtsrt($email, "@") && srtsrt($email, "." && srtlen($email) >= 6)){
    require("connect.php");
    $query = mysql_query("SELECT * FROM trucks WHERE username='$username'");
    $numrows = mysql_num_rows($query);
    if($numrows == 0){
    $query = mysql_query("SELECT * FROM trucks WHERE email='$email' ('', '$firstname', '$lastname', '$username', '$email', '$pass', '', '$bio', '', '', '0', '', '0', '$date', '')");
    $numrows = mysql_num_rows($query);
    if($numrows == 0){
    $pass = md5 (md5($password));
    $date = date("F d, Y");
    mysql_query("INSERT INTO trucks VALUES");
    else
    echo "That email is already in use. $form";
    else
    echo "That username is already in use. $form";
    else
    echo "You did not enter a valid email. $form";
    else
    echo "Your passwords did not match. $form";
    else
    echo "You did not fill in all required fields. $form";
    else
    echo "$form";
    ?>
    </div>
    </div>
    <div id='footer'><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a><a href='#'>Link</a></div>
    <body>
    </body>
    </html>

  • MYSQL, PHP Problems

    I am trying to connect Authorware to my mysql database. Both
    are online and I want to write test answers to my database
    and also read them back out and display them in my authorware
    piece.
    In a plain authorware page i have in a calculation:
    Result := ReadURL
    http://www.dundee.ac.uk/.../example/authorware2.php")
    And then {Result} on the authorware page.
    What returns is the source code for the php page plus
    whatever is printed to the screen by that .php page. I want
    what is printed to the screen as it is the contents of the
    variable needed, but not the rest of the stuff. How do I
    simple pass just that variable back to authorware and not all
    the rest of the stuff.
    I also have an issue with writing to the database using:
    action := "?data="
    query := ActivityAnswer1a
    db_loc := "
    http://www.dundee.ac.uk/..../"
    URLstring := db_loc^"authorware.php"^action^query
    queryString := ReadURL(URLstring)
    It seems to sometimes write 2 entries and not the required
    one. Not sure why.

    There are some other things that must be done to connect to
    the database
    (such as passing the usernamee, password, and host info to
    mysql_connect()
    and storing the connection resource), and those might be in
    the include
    files. I generally place all of the connection parameters in
    a separate file
    that is located in a folder that can't be accessed by a
    browser, for
    security purposes.
    Paul Swanson
    Portland, Oregon, USA
    "Amy Blankenship *AdobeCommunityExpert*"
    <[email protected]>
    wrote in message news:edk6ui$69c$[email protected]..
    > What's in the include(s)?
    >
    > "83Dons" <[email protected]> wrote in
    message
    > news:edk5s5$4uk$[email protected]..
    > > Here is the php code for the 'read' and 'write'
    parts:
    > >
    > >
    > >
    > > <?php
    > > include '......';
    > > mysql_select_db('clinskills') or die("UNABLE TO
    CONNECT TO
    DATABASE");
    > > $sql = "select A1Answer from authorware where id =
    '13'";
    > > $result = mysql_query($sql);
    > > $answer1 = mysql_result($result,0,"A1Answer");
    > > print $answer1;
    > > ?>
    > >
    > > <?php
    > > include '............';
    > > mysql_select_db('clinskills') or die("UNABLE TO
    CONNECT TO
    DATABASE");
    > > $newdata = $_GET['data'];
    > > mysql_query("insert into authorware (A1Answer)
    values('$newdata')")
    or
    > > die(mysql_error());
    > > mysql_close(); ?>
    > >
    >
    >

  • Apache, ssl, and php problem

    i just added ssl support to my apache website running php. before i added ssl i had a php flash script that has always worked fine until i altered the httpd.conf file to forbid access to this directory unless it was an encrypted connection. i used the code
    <Directory "/home/httpd/html/folder">
        AuthType Basic
        AuthName "user"
        AuthUserFile /home/httpd/passwords/folder
        Require user user
        SSLRequireSSL
    </Directory>
    i tested the ssl with the directory running php before i altered the code and it worked fine. now that i altered the code to require ssl, the folder's index shows up a blank page. what went wrong, is there some bug or something i did wrong?

    steps to use ssl in arch with apache.
    1) pacman -S openssl apache
    2) Read /etc/httpd/conf/mod_ssl.txt
    2a) Edit /etc/conf.d/httpd and set HTTPD_USE_SSL to "yes"
    2b) Create an ssl key, request, and certificate.
    # This generates the cert and key (valid for 3650 days)
      # Be sure to enter the FQDN of your apache server as the "Common Name".
      openssl req -new -x509 -newkey rsa:1024 -days 3650
        -keyout server.key -out server.crt
      # This will remove the passphrase
      openssl rsa -in server.key -out server.key
    2c) Modify /etc/httpd/conf/ssl.conf to use your new certificate.
    SSLCertificateFile /etc/httpd/conf/server.crt
    SSLCertificateKeyFile /etc/httpd/conf/server.key
    3) Edit /etc/httpd/conf/ssl.conf
    Define an appropriate virtualhost for your ssl site
    4) Restart apache (/etc/rc.d/httpd restart)
    If it hangs or fails to start, check the /var/log/httpd/error_log or try running
    '/usr/sbin/apachectl startssl' and looking for errors/prompts.
    NOTE: Using the same dir for ssl and non-ssl does not make sense, as someone could just use non-ssl to access the same information. Instead, create a new directory (something like /home/httpd/ssl), and use that dir for ssl web activities. Adjust /etc/httpd/conf/ssl.conf accordingly

  • Spry XML dataset + PHP problem

    I have installed Dreamweaver CS3 and created a simple page
    that receives a XML dataset from a PHP page. I was not able to
    display any data in either FF or IE (just got a blank page). I then
    downloaded the 1.5 pre-release and discovered the Data Set Explorer
    which worked well in FF but doesn't do anything in IE. Then I
    copied SpryData.js and xpath.js to my sites' SpryAssets directory,
    overwriting the 1.4 files and my simple page worked in FF,
    but still NOT in IE6/7. I then uploaded the pages to a
    remote server and tested on another PC, but it still doesn't work.
    If I replace the php file with a XML dataset it works on both FF
    and IE. Can someone please look at the
    test page and tell me what
    I am missing? The PHP page that feeds the XML can be viewed
    here

    Thanks for the reply Kin, I also had an idea that it might be
    the headers. When I copied the example from
    here
    the
    header('Content-type:
    text/xml'); line was commented out by mistake! Thanks for
    your help, it's working now!

  • About php problem

    for example :
    first php code:(login.php)
    <?php
    session_unset();
    ?>
    <html>
    <head>
    <title>Please Log In</title>
    </head>
    <body>
    <form method="post" action="movie1.php">
    <p>Enter your username:
    <input type="text" name="user">
    </p>
    <p>Enter your password:
    <input type="password" name="pass">
    </p>
    <p>
    <input type="submit" name="Submit" value="Submit">
    </p>
    </form>
    </body>
    </html>
    </body>
    </html>
    second php code:(movie1.php)
    <?php
    //delete this line: setcookie('username','Joe', time()+60);
    session_start();
    $_SESSION['username'] = $_POST['user'];
    $_SESSION['uerpass'] = $_POST['pass'];
    $_SESSION['authuser'] = 0;
    //Check username and password information
    if (($_SESSION['username'] == 'Joe') and
    ($_SESSION['userpass'] == '12345')) {
    $_SESSION['authuser'] = 1;
    } else {
    echo "Sorry, but you don't have permission to view this
    page,you loser!";
    exit();
    ?>
    <html>
    <head>
    <title>Find my Favorite Movie!</title>
    </head>
    <body>
    <?php
    $myfavmovie = urlencode("Life of Brian");
    echo "<a href='moviesite.php?favmovie=$myfavmovie'>";
    echo "Click here to see information about my favorite movie!";
    echo "</a>";
    ?>
    </body>
    </html>
    the last php code:(moviesite.php)
    <?php
    session_start();
    //check to see if user has logged in with a valid password
    if ($_SESSION['authuser'] != 1) {
    echo "Sorry, but you don't have permission to view this
    page, you loser!";
    exit();
    ?>
    <html>
    <head>
    <title>My Movie Site - <?php echo $_REQUEST['favmovie']; ?></title>
    </head>
    <body>
    <?php
    echo "Welcome to our site. ";
    // delete this line: echo $_COOKIE['username'];
    echo $_SESSION['username'];
    echo "! <br>";
    echo "My favorite movie is ";
    echo $_REQUEST['favmovie'];
    echo "<br>";
    $mvovierate = 5;
    echo "My movie rating for this movie is: ";
    echo $movierate;
    ?>
    </body>
    </html>
    </body>
    </html>
    i[b] want to use session to create user privilege to visit and to run sql code.
    who can test them and help me find that error which cause them not to work.
    thanks

    thanks a lot!
    many questions have been solveted by you!
    thank you very much!

  • Unknown actionscript/php problem

    I have created a form in a flash as 2 document. After the
    user clicks a button it sends 3 variables to PHP, username, email
    and passwrd. PHP then creates a text file called (username) that
    contains the username, email and password in a layout flash can
    read. However, when the button is clicked it does not save the text
    file.
    I have read through these scripts several times and cannot
    see any faults. I have check permissions and every thing i can
    think of. Thanks for any help.

    your
    $fp = fopen(
    line contains a stray character after the left paranthesis.
    remove that and retest.

Maybe you are looking for

  • Cannot install due to registry (iTunes 7)

    I downloaded and attempted to install iTunes 7 last night, however I got this error: http://img225.imageshack.us/img225/1204/itunesld7.jpg I am the computer administrator. I have tried re-downloading the installer, did not work. I also rebooted my co

  • Thunderbolt and FireWire combo

    I know that your clock and RAM have the biggest impact, but... Let's say I exported a full HD ProRes file out of FCP X via FCP (current settings)....and I have two drives to work with when I will be compressing that file.  My system is on my internal

  • Webdynpro abap ALV export to excel with images problem

    Hello experts, I'm having problems with standard excel export functionality in webdynpro abap ALV. In my table i have images taken from content server (employee photos) linked with URL to a table_cell Image, when i export the table to excel using sta

  • Printer will not print legal paper

    hp 8600 system OS X

  • Dynamic actions query

    hello gurus Iam new to  HCM , i have a query when we go in   for dynamic actions configurations what does " PSPAR-MASSN " stand for and where can i see the  details for this . Regards Lakshmi