Jump to content

kney

Members
  • Posts

    140
  • Joined

  • Last visited

    Never

Posts posted by kney

  1. You use mysql_query 2 times, that shouldn't work :)

     

    <?php
    //THE SEARCH FUNCTION
    $sql = mysql_query ( "SELECT * FROM users WHERE firstname  LIKE '%$first%' 
    OR lastname LIKE '%$last%' OR dob  LIKE '%$dob%' ") or die(mysql_error());			 
    
    $result = mysql_query($sql) or die( "<br>Query: $sql<br>Failed with error: " . mysql_error() );
    ?>
    

  2. I have this code in borrow.php

    Whenever they click the button 'sendMail' an email is sent to that user who tries to borrow that specific book (the book details are left out cuz we don't need them here)

     

    <?php
    global $interface;
    global $user;
    
    if (isset($_POST['sendMail'])){
            $to = $partner->email;
    $subject = "ILB Request";
    if(!isset($user->id)){
    	$lastname = $_POST['lastname'];
    	$firstname = $_POST['firstname'];
    	$email = $_POST['email'];
    	$telephone = $_POST['telephone'];
    	$fax = $_POST['fax'];
    }else{
    	$lastname = $user->lastname;
    	$firstname = $user->firstname;
    	$email = $user->email;
    	$telephone = $user->telephone;
    	$fax = $user->fax;
    }
    $message = "
    <html>
    <body>
    <h2>Loaner Details</h2>
    <table>
    <tr>
    <td>Name: </td>
    <td>" . $lastname . "</td>
    </tr>
    <tr>
    <td>First Name: </td>
    <td>" . $firstname . "</td>
    </tr>
    <tr>
    <td>Email: </td>
    <td>" . $email . "</td>
    </tr>
    <tr>
    <td>Telephone: </td>
    <td>" . $telephone . "</td>
    </tr>
    <tr>
    <td>Fax: </td>
    <td>" . $fax . "</td>
    </tr>
    </table>
    </body>
    </html>
    ";
    
            // Always set content-type when sending HTML email
    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
    
    // More headers
        	if(!isset($user->id)){
    	$headers .= 'From: <' . $_POST['email'] . '>' . "\r\n";
    }else{
    	$headers .= 'From: <' . $user->email . '>' . "\r\n";
    }
    
    if(!empty($email)){
    	if(mail($to,$subject,$message,$headers)){
    		$interface->assign('success', "Your IBL request has been sent succesfully!");
    	}else{
    		$interface->assign('success', "Your IBL request has failed!");
    	}
    }else{
    	$interface->assign('success', "Email address has to be filled in!");
    }
    }
    

     

    And then there is this code in Edit.php:

    Whenever a person changes someone elses profile (like an admin), the person whos profile is being changed needs to be notified by email.

    It's the same function as before though it gives this error:

    "Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\vufind\web\services\MyResearch\Edit.php on line 182"

     

    But the php.ini file hasn't been changed, and it doesn't give error the the previous code above (+ I receive the email)

    So I add to the file below:

    <?php
    ini_set("SMTP","mySMTPserver.");
    ini_set("smtp_port","25");
    ?>
    

     

    and now i get this msg...

    "Warning: mail(): SMTP server response: 503 5.5.2 Need Rcpt command."

     

    <?php
    global $interface;
    global $user;
    
    if (isset($_POST['submit'])) {
    if(isset($_GET['userID'])){
    $updateUser = new User();
    if($user->id != $_GET['userID']){
            	$to = $updateUser->email;
    	$subject = "Profile has been changed by " . $user->firstname . " " . $user->lastname;
    	$message = "
    	<html>
    	<body>
    	<h2>Notification</h2>
    	<br /><br />
    	Hi, <br /><br />
    	This is an email notification you receive when your profile has been changed!
    	</body>
    	</html>";
    
            // Always set content-type when sending HTML email
    	$headers = "MIME-Version: 1.0" . "\r\n";
    	$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
    
    	// More headers
    	$headers .= 'From: admin@felnet.be' . "\r\n";
    
    	echo $to . " " . $subject . " " . $message . " " . $headers;
    
            if(mail($to,$subject,$message,$headers)){
    		$interface->assign('sent', "Success!");
    	}else{
    		$interface->assign('sent', "Fail!");
    	}
    }
    

  3. I have a webservice which gives an XML response after i upload a file.

    Something like this:

     

    <jobs>
        <job>
            <id>50</id>
            <fileName>test.xml</fileName>
            <status>FINISHED</status>
            <creationTime>2011-08-18T13:41:14+02:00</creationTime>
            <lastUpdateTime>2011-08-18T13:44:48+02:00</lastUpdateTime>
        </job>
        <job>
            <id>51</id>
            <fileName>test.xml</fileName>
            <status>FINISHED</status>
            <creationTime>2011-08-18T13:54:48+02:00</creationTime>
            <lastUpdateTime>2011-08-18T13:54:49+02:00</lastUpdateTime>
        </job>
    </jobs>
    

    The link to the XML response is below in the src path.

    This code works in IE but not in FF.

    I need a way to make it work in FF

     

    <html>
    <body>
        <xml id="job" src="http://172.24.16.41:8080/FELNET2/WebServices/getJobs"></xml>
        <table border="1" datasrc="#job">
            <tr>
                <td><span datafld="id"></span></td>
                <td><span datafld="fileName"></span></td>
            </tr>
        </table>
    </body>
    </html> 
    

  4. e.g.

    You have a table "users"

    userID = 1

    name= "testUser"

     

    You have a table "posts"

    postID = 1

    text = "this is my first post"

    userID = 1

     

    You have a table "titleDescriptions" (or something like that)

    titleID = 1

    postsMin = 0

    postsMax = 10

    description = beginner

     

    titleID = 2

    postsMin = 11

    postsMax = 50

    description = advanced

     

    titleID = 3

    postsMin = 51

    postsMax = 250

    description = expert

     

    Next you gonna count how many times the userID exists in the post table & you compare it with the postsMin & postsMax fields

    This is a simple example, probably not the best

  5. This is the error i'm getting..

     

    Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in \web\RecordDrivers\IndexRecord.php on line 322 Notice: Use of undefined constant mail - assumed 'mail' in \web\RecordDrivers\IndexRecord.php on line 323

  6. I checked my spam folders, nothing's there.

    I also tried with 3 different email addresses and checked them if they were correct.

     

    The php.ini file has this configured:

    SMTP = localhost
    smtp_port = 25
    mail.add_x_header = On
    mail.log = C:\
    

  7. Why doesn't this send the mail?

     

    if (isset($_POST['sendMail'])){
            $to = "kenneth.dehouwer@devoteam.be";
    $subject = "TEST email";
    
    $message = "
    <html>
    <head>
    <title>HTML email</title>
    </head>
    <body>
    <p>This email contains HTML Tags!</p>
    <table>
    <tr>
    <th>Firstname</th>
    <th>Lastname</th>
    </tr>
    <tr>
    <td>John</td>
    <td>Doe</td>
    </tr>
    </table>
    </body>
    </html>
    ";
    
    // Always set content-type when sending HTML email
    $headers = "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
    
    // More headers
    $headers .= 'From: <webmaster@felnet.be>' . "\r\n";
    $headers .= 'Cc: myboss@example.com' . "\r\n";
    
    mail($to,$subject,$message,$headers);
    }
    

  8. OK, now i know what you mean..

    but i don't want all the rows in my table.. i only want the rows with the results i searched for..

     

    so if i type "test" i only want to get 6 as count (cuz there are 6 with "test" in db but i have a total of 10 users)

  9. Dit is de code van een zoekfunctie in mijn project.

    De reden waarom ik GET ipv POST gebruikt heb, is omdat het makkelijker werken was in het framework.

    Het probleem dat ik nu ondervind is dat ik altijd maar 5 records terugkrijg als ik een count doe (wat natuurlijk komt door de LIMIT), en door het framework maakt het niet uit of je eerst de count of limit doet, het geeft allebei niet het correcte resultaat.

    Ik zou een manier willen hebben om die count correct te doen zodat ook mijn next en previous knoppen goed gaan werken want nu krijgt hij altijd 1 als resultaat (kijk naar variabele $pages)

     

    This is the code from my search function in my project.

    The reason I use GET instead of POST is because it's easier to manage in the framework.

    The problem that i'm getting right now is that i only get 5 records when i perform a count (obviously because of the LIMIT function) and because of the framework it doesn't matter if you perform the count first and then the limit or the other way around, it doesn't give the correct result.

    I would like to find a way to correctly do the count so my next and previous buttons will work correctly because my $pages variable always gets 1 as result.

     

    <?php
    if(isset($_GET['submit'])){
        $firstname = $_GET['txtFirstname'];
        $lastname = $_GET['txtLastname'];  
        $rol = $_GET['rollen'];
        $partnerID = $_GET['partners'];
        $searchUser = new User();
    
        if (!empty($firstname)) {
            $searchUser->whereAdd("`user`.firstname like '%" . $firstname . "%'");
        }
        if (!empty($lastname)) {
            $searchUser->whereAdd("lastname like '%" . $lastname . "%'");
        }
        $joinPartner = new Partner();
        if (!empty($partnerID)) {
            $joinPartner->id = $partnerID;
        }
        $searchUser->joinAdd($joinPartner, 'LEFT');
        $searchUser->selectAs($joinPartner, 'p_%s');
        $searchUser->selectAs($searchUser, 'u_%s');
    
        $joinRole = new Role();
        if (!empty($rol)) {
            $joinRole->id = $rol;
        }
        $user_role = new User_role();
        $user_role->joinAdd($joinRole);
        $searchUser->joinAdd($user_role);
        $searchUser->selectAs($joinRole, 'r_%s');
    
        $results_per_page = 5;
                    
        if(!isset($_GET['screen'])){
           $_GET['screen'] = 0;
        }
        $start = $_GET['screen'] * $results_per_page;
        $searchUser->limit($start, $results_per_page);
        $interface->assign('screen', $_GET['screen']);
    
        $searchUser->find();
        $searchResult = array();
        
        while($searchUser->fetch()) {
            $searchResult[] = clone($searchUser);
        }
        $interface->assign('searchUsers', $searchResult);
    
        $pages = ceil(COUNT($searchResult) /$results_per_page);
        $interface->assign('pages', $pages);
    
        /* Hier gaat het mis, door de limit krijg ik maar 5 resultaten terug
           Terwijl ik alle gevonden resultaten wil weergeven
        */
        $interface->assign('numberOfUsersFound', count($searchResult));
    ?> 
    

  10. Hi,

     

    I need VuFind for easy searching through lots and lots of documents.

    This is the installation guide I used: http://vufind.org/wiki/installation_windows

    Now, my problem is that i'm getting a blank screen and the guide's sollution is go into debug and look for errors.

    It says:

    Warning: require_once(PEAR.php): failed to open stream: No such file or directory in C:\vufind\web\index.php on line 43 Fatal error: require_once(): Failed opening required 'PEAR.php' (include_path='.;C:\php5\pear') in C:\vufind\web\index.php on line 43 

     

    It's seems to go to the path 'C:\php5\pear' but I need it to go to 'C:\Program Files\PHP\PEAR'

    so I changed line 43 to

    require_once(C:\program files\php\pear\PEAR.php);

    and it just sends me to the next error

    Warning: require_once(Log.php): failed to open stream: No such file or directory in C:\vufind\web\sys\Logger.php on line 28 Fatal error: require_once(): Failed opening required 'Log.php' (include_path='.;C:\php5\pear') in C:\vufind\web\sys\Logger.php on line 28 

     

    When i check in Logger.php it requires Log.php but the file isn't anywhere.

     

     

    Maybe I skipped a step somewhere during the installation?

  11. I changed in my code that when it's supposed to delete the double value, to change it to the string"double"

    But 1 double he doesn't change..

     

    Token 3584819341:
    MS to Complete
    3422
    5100 <==  is a double substep
    3424
    
    Total time for 3584819341: 11946
    
    
    Token 3604480140:
    MS to Complete
    5507
    
    Total time for 3604480140: 5507
    
    
    Token 3611033718:
    MS to Complete
    6297
    2951
    7308
    3322
    double
    
    Total time for 3611033718: 19878
    
    
    Token 3624140932:
    MS to Complete
    2989
    2451
    4487
    2915
    double
    
    Total time for 3624140932: 12842
    
    
    Token 3630694582:
    MS to Complete
    69829
    7047
    68111
    double
    double
    double
    double
    double
    double
    
    Total time for 3630694582: 144987
    
    
    Token 3643801742:
    MS to Complete
    2061
    1503
    3382
    1781
    double
    
    Total time for 3643801742: 8727
    

  12. It is not actually the first word on the line cuz then I would get the date in my variable and i don't want that.

    But i changed it a bit...

    Now I almost have the result I want except sometime it doesn't seem to be working 100%

     

    <?php
    
    function parseTXT($data){
    $file = file_get_contents("server.log");
    $d_array = explode("\n", $file);
    $lastWord ="";
    foreach ($d_array as $line){
    	if (strstr($line, "runtime (ms) for token")){
    		$words = explode(" ",$line);
    		$firstWord = $words[5];
    		if($firstWord == $lastWord){
    			// I don't know what to do here <============
    		}
    		else{
    			$lastWord = $firstWord;
    			$tmp_array = explode(" ", $line);
    			$token = str_replace(":", "", $tmp_array[10]);
    			$token_array[$token][] = $tmp_array[11];
    		}
    	}
    }
    
    foreach ($token_array as $key=>$val2){
    	$token_array[$key]['total'] = 0;
    	foreach ($val2 as $val3){
    		$token_array[$key]['total'] += $val3;
    	}
    }
    return $token_array;
    
    }
    
    foreach (parseTXT("some_file.txt") as $key=>$val){
    echo "<h2>Token $key: </h2>";
    echo "<table border=\"0\"><tr><th>MS to Complete</th></tr>";
    foreach ($val as $key2=>$val2){
    	if (is_int($key2)){
    		echo "<tr><td>$val2</td></tr>";
    	}
    	else{
    		echo "</table><br /><strong>Total time for $key: $val2</strong><br /><br /><br />";
    	}
    }
    }
    
    ?>

     

    This is what I get:

     

    Token 3584819341:
    MS to Complete
    3422
    5100
    3424
    
    Total time for 3584819341: 11946

     

    you can't see this but the 5100 is also transcoder substep (as is the 3422, and I don't want it going through the same step)

    and this is what i should get

     

    Token 3584819341:
    MS to Complete
    transcoder: 3422
    externalDRM: 3424
    
    Total time for 3584819341: 6846

     

    I also can't seem to get the names of the sub steps to display

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