cereal 1,524 Nearly a Senior Poster Featured Poster

You're welcome, bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

getElementById() works like in javascript, if the target page has <div id="mytest"></div> then write getElementById('mytest')
And the script can work if the page is well formed, if there is a doctype... an example:

<?php
$f = file_get_contents('http://website/');
$dom = new domDocument;
$dom->loadHTML($f);
echo $dom->getElementById('mytest')->nodeValue;
?>
cereal 1,524 Nearly a Senior Poster Featured Poster

You're welcome :)

cereal 1,524 Nearly a Senior Poster Featured Poster

From the homepage:

If you've the installed ffmpeg-php extension as a shared library but haven't set it to auto-load in your php.ini file, you'll need to use the PHP dl() function to make ffmpeg-php available to your scripts. Add the following PHP code to the beginning of scripts you want to call ffmpeg-php methods in.

So maybe is this, check on usage section, here: http://ffmpeg-php.sourceforge.net/

Anyway, to update the list of files that locate can find, run sudo updatedb

cereal 1,524 Nearly a Senior Poster Featured Poster

Try PHP DOM, I gave a suggestion here: http://www.daniweb.com/web-development/php/threads/376665

But instead of using getElementsByTagName you can use getElementById:
http://www.php.net/manual/en/domdocument.getelementbyid.php

cereal 1,524 Nearly a Senior Poster Featured Poster

Reloading Apache it should work:

sudo /etc/init.d/apache2 reload
cereal 1,524 Nearly a Senior Poster Featured Poster

This should work: GROUP BY referrer not by userID, so:

"SELECT t1.fname, t1.lname, t1.userID, COALESCE(t2.referrals, 0) AS referrals FROM users as t1  LEFT OUTER JOIN (SELECT referrer, COUNT(*) AS referrals FROM users GROUP BY referrer) AS t2 ON t1.userID = t2.referrer WHERE referrals > 0 "

userID is always one, and it should be a unique key field, so you get always 1, but the referrer no.

cereal 1,524 Nearly a Senior Poster Featured Poster

This is not related to php, search for html5 offline or adobe air on google, you will find some tutorials.

cereal 1,524 Nearly a Senior Poster Featured Poster

Use EOF:

<?php
echo <<<EOF
<?php echo 'test'; ?>
EOF;
?>
cereal 1,524 Nearly a Senior Poster Featured Poster

Just an example:

<style type="text/css" media="screen">
body { font: 14px/20px Arial, Verdana, sans-serif; }
h3 { font-weight: normal; margin: 0; padding: 0; font-size: 20px; }
label { font-weight: bold; display: block; }
input[type=text], input[type=password] { border: 1px solid black; padding: .2em; width: 465px; }
.button { padding: .2em .5em; float: right; }
fieldset { border: none; width: 465px; }
a { text-decoration: none; color: royalblue; display: block; padding: .2em; }
ul { list-style: none; margin: 0; padding: 0; }
li { display: block; float: left; margin: 5px 20px 5px 0; }
.createAccount { background-color: royalblue; color: white; padding: .2em .5em; }
</style>

On line 33 I added a class:

<a class="createAccount" href="/users-component/registration-form">Create an account</a>

You can change input[type=] adding a second class to username and password fields:

<input id="modlgn_username" type="text" name="username" class="inputbox text"  size="18" />

I attached a screenshot result. Bye and good work.

cereal 1,524 Nearly a Senior Poster Featured Poster

Check sendmail logs. And try to send a simple mail from terminal, just to see if it works:

echo "subject: test" | sendmail -v you@email.tld
cereal 1,524 Nearly a Senior Poster Featured Poster

Hi :)

For what I know, you can't. Those are the same operations done by a browser.
You can make a black list of user agents not allowed to cross your website, but a bot can be configured to use a well known user agent browser.

cereal 1,524 Nearly a Senior Poster Featured Poster

Maybe is the dot in front of profil? : ./profil.php?user=$1

cereal 1,524 Nearly a Senior Poster Featured Poster

Try:

RewriteRule ^([0-9a-zA-Z.\-\_]+)$ ./profil.php?user=$1

But the rule seems ok to me, and you should use \. as you already tried. Which error gives you?

Concerning the spaces, you should prevent spaces at the moment of signup. You can add a field in the table for example url, where you remove/replace special characters and spaces:

id | username | password hash | url
-----------------------------------------
 1 | cip cip  | 2139Qdh9hn... | cip_cip
cereal 1,524 Nearly a Senior Poster Featured Poster

Then you can use button tag. Here's an example:

<!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>
<title>test</title>
</head>
<body>

<div id="offers">
	<label for="item">Select your item</label><br />
	<button type="button" id="item1" name="item">item1</button>
	<button type="button" id="item2" name="item">item2</button>
</div>

<div id="form"></div>

<script src="jquery-1.6.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$('#item1').click(function(){
	event.preventDefault();
	$('#offers').css('display','none');
	$('#form').append('<form method="post" action="item1.php"><label for="email">e-mail</label><br /><input type="text" name="email" /><br /><input type="submit" name="getit" value="Get Item" /></form>');
});
$('#item2').click(function(event){
	event.preventDefault();
	$('#offers').css('display','none');
	$('#form').append('<form method="post" action="item2.php"><label for="email">e-mail</label><br /><input type="text" name="email" /><br /><input type="submit" name="getit" value="Get Item" /></form>');
});
</script>
</body>
</html>

Note that due to my limited knowledge of jquery I'm writing all the email form through javascript, but I'm sure someone else can suggest a better & cleaner solution.

cereal 1,524 Nearly a Senior Poster Featured Poster

Try with backticks on word:

$query = "SELECT * FROM `pro_words` WHERE `word` = ".$_GET['w'];

Or just try to do a simple query, without $_GET, to see if that works.

cereal 1,524 Nearly a Senior Poster Featured Poster

If I'm understanding good and you want to redirect, then just change forms for item1 and item2:

<form method="get" action="item1.php">
<input type="submit" name="getit" value="Item 1" />
</form>

<form method="get" action="item2.php">
<input type="submit" name="getit" value="Item 2" />
</form>

But, you still need to set the email field, so it's easier to redirect everything to a single script. I suggest you to simplify, sending a single form:

<form method="post" action="items.php">
<label for="item">Select your item</label><br />
<input type="radio" name="item" value="1" /> item 1 <br />
<input type="radio" name="item" value="2" /> item 2 <br />

<label for="email">e-mail</label><br />
<input type="text" name="email" /><br />

<input type="submit" name="getit" value="Get Item" />
</form>

items.php can do this operation:

<?php
if($_POST['item'] == '1')
{
    echo 'item 1'; # do your action here
}

if($_POST['item'] == '2')
{
    echo 'item 2'; # do your action here
}
?>

you can also hide the email fields if you want:

<form method="post" action="items.php">
<label for="item">Select your item</label><br />
<input type="radio" id="item1" name="item" value="1" /> item 1 <br />
<input type="radio" id="item2" name="item" value="2" /> item 2 <br />

<div id="email" style="display: none;">
   <label for="email">e-mail</label><br />
   <input type="text" name="email" /><br />
</div>

<input type="submit" name="getit" value="Get Item" />
</form>

<script type="text/javascript">
$('#item1').click(function(event){
	event.preventDefault();
	$('#email').css('display','block');
});
$('#item2').click(function(event){
	event.preventDefault();
	$('#email').css('display','block');
</script>

I don't know jquery so I'm not sure .click event will work, I usually use dojo. Hope it's useful :)

cereal 1,524 Nearly a Senior Poster Featured Poster

To me the wrong part are on line 35 an 42: <?=$url='item1.php'?>
Once the page is loaded, PHP won't change the value echoed on line 11: action="<?=$url?>"

Instead of using two different urls, you should send everything to the same script and use the value that you get: item1/item2 to make a conditional statement.

Other than this, the forms item1 and item2 are missing of action and method attributes. When you send a form you are requesting a connection with the server, but you are using this only to display an hidden element by CSS. What you need here is not onSubmit but onClick: $('#item1').click(function(event)

Bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

This is wrong:

$query = "SELECT * FROM pro_words".$_SESSION['where clause'];

this should work:

$query = "SELECT * FROM pro_words WHERE word = ".$_GET['w']; # or $_SESSION['word']

but remember to sanitize data.

cereal 1,524 Nearly a Senior Poster Featured Poster

Try this:

echo "<div class='posterdecoration'><img src='$row[scr1]' width='640' alt='$row[name]' /></div>";
echo (isset($row['scr2'])) ? "<div class='posterdecoration'><img src='$row[scr2]' width='640' alt='$row[name]' /></div>" : NULL;

bye :)

-==Zero==- commented: Thanks For Reply Plz Continue With Me +2
cereal 1,524 Nearly a Senior Poster Featured Poster

Can you provide an example of the array you have and that you want at the end? Just few entries to get an idea.

cereal 1,524 Nearly a Senior Poster Featured Poster

You are using PEAR Mail not the built-in function mail() so you need to read this:

http://pear.php.net/manual/en/package.mail.mail-mime.example.php

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Use switch():

<?php

	$a = 'about'; # replace with $_GET['page']
	switch($a)
	{
		case 'about':
			echo 'about page'; #instead of echo you can include
		break;
		case 'contacts':
			echo 'contact page';
		break;
		default:
			echo 'home page';
		break;
	}

?>

name the page index.php and make these links:

http://your.website/index.php?page=about
http://your.website/index.php?page=contact

If you write something else is not a case switch, then the script will echo the default value. If then you want links like this: http://your.website/about then you need to edit the .htaccess file, search for mod_rewrite to get more information.

PixelatedKarma commented: Well written +2
cereal 1,524 Nearly a Senior Poster Featured Poster

Build an array from the XML feed and then use shuffle():

<?php
$a = array(
	'a' => array('a1','a2','a3'),
	'b' => array('b1','b2','b3'),
	'c' => array('c1','c2','c3'),
	'd' => array('d1','d2','d3'),
	'e' => array('e1','e2','e3')
);
shuffle($a);
echo $a[0][0]; # will print randomly a1, b1, c1, d1, e1
echo $a[0][1]; # will print randomly a2, b2, c2, d2, e2 ...
?>

bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

Maybe you can. On linux the command lp permits you to print to a remote printer. So if the php script runs on a linux box and makes use of system() or exec() you can print, an example:

<?php
exec('lp -h 123.123.123.123 filename.txt');
?>

where 123.123.123.123 is the remote ip of your printer. You'll probably have to convert some types of files before you can print them, check here:

- http://tldp.org/HOWTO/pdf/Printing-Usage-HOWTO.pdf

More reference:
- http://linux.about.com/od/itl_guide/a/gdeitl62t00.htm
- http://unixhelp.ed.ac.uk/CGI/man-cgi?lp
- http://php.net/manual/en/function.exec.php

good luck! :)

cereal 1,524 Nearly a Senior Poster Featured Poster
cereal 1,524 Nearly a Senior Poster Featured Poster

Example:

$string = 'barrack obama';
$a = str_replace(' ','',$string);
if($ctype_alpha($a))
{
   echo $string;
}
else
{
   echo 'error';
}

If data is coming from a form I suggest you to look at the User Guide, you can set up a callback:

# validation rule
$this->form_validation->set_rules('name', 'Name', 'callback_check_string');

# callback
function check_string($str)
{
    return ctype_alpha(str_replace(' ','',$str)) ? true : false;
}

More info: http://codeigniter.com/user_guide/libraries/form_validation.html#callbacks

cereal 1,524 Nearly a Senior Poster Featured Poster

@ivan3510
I think it's better to store friend's id on separate rows, it's easier to maintain, count and so on:

user_id | friend_id
-------------------
    1   |    23
    1   |    90
    2   |    37

:)

cereal 1,524 Nearly a Senior Poster Featured Poster

You need to install a mail server, usually on linux is sendmail, if you want to try there is a porting for Windows: http://glob.com.au/sendmail/

Or just search for a mail server that works in command line.

cereal 1,524 Nearly a Senior Poster Featured Poster

This way:

$a = array(' ','#','$','%','^','&','*','?');
$b = array('','No.','Dollar','Percent','','and','','');
$path1 = str_replace($a,$b,$path1);
cereal 1,524 Nearly a Senior Poster Featured Poster

Just an idea: if you don't need to store those information and your website is not using an SSL Certificate, then it's better to use javascript, so the users can fill the form, display and print it without sending anything to the server.

cereal 1,524 Nearly a Senior Poster Featured Poster

@ddymacek

You're right. I had just woken up, when I wrote my post, and thinking for some strange reason to a form increasing a value o_o'

Pardon for bad suggestion.

cereal 1,524 Nearly a Senior Poster Featured Poster

You need to use ajax to do that. Ajax will send the request to a PHP script that will do the work without refreshing the entire page.

cereal 1,524 Nearly a Senior Poster Featured Poster

You need session, otherwise the array will become empty after each loop. This should work:

<?php 
    session_start();
    while loop
    {
       $blnk = ($_SESSION['numRows'] == NULL) array() : $_SESSION['numRows'];
       $val=mysql_num_rows($result14);
       array_push($blnk,$val);
       if($_SESSION['numRows'] == NULL) { $_SESSION['numRows'] = $blnk; } # start session
    }
    #$blnkarraysum=array_sum($blnk);
    $blnkarraysum = $blnk;
?>
cereal 1,524 Nearly a Senior Poster Featured Poster

To run scripts from the command line check this: http://php.net/manual/en/install.windows.commandline.php

It's simple enough.

To make executables, instead, you need linux and PHC: http://www.phpcompiler.org/

cereal 1,524 Nearly a Senior Poster Featured Poster

Everything is a loop. MySQL operations? Building arrays? Sessions? Setting vars? Is your computer swapping when executing the script? There is not only one solution, it depends on what is done and how. If you don't want to explain more, then, take a look to http://www.php.net/manual/en/function.memory-get-peak-usage.php

Try also a tool like Process Explorer http://technet.microsoft.com/en-us/sysinternals/bb896653 to see if some related processes are still running after the script ends the execution.

cereal 1,524 Nearly a Senior Poster Featured Poster

If you need bold and colors, then you have to use HTML e-mail. There's an example on the mail() page, look at #example 4: http://php.net/manual/en/function.mail.php

There are some tips to apply CSS and make them work on mail clients, like inline CSS instead of using external or style element. Search on google for html email css.

bye!

cereal 1,524 Nearly a Senior Poster Featured Poster

Without details it's hard to help. What does the script and how, which OS are you running?

cereal 1,524 Nearly a Senior Poster Featured Poster

Man, dum da dum, read your private messages! :D

cereal 1,524 Nearly a Senior Poster Featured Poster

Point the redirect to a controller not to a view. So change 'dashboard' to '/dashboard' or '/your_controller/dashboard'. You can also remove 'refresh' it will speed up the redirect. Add an ELSE statement:

if($result){
    redirect('/dashboards');
}
else
{
    echo 'error';
}

And remember to load the url helper before the redirect or in your autoload.php config file: $this->load->helper('url');

cereal 1,524 Nearly a Senior Poster Featured Poster

You should write more information, you get the data from the form? You still display the correct data after you do str_replace()? Have you tried to get response code? Right after r->send(); write:

try
{
    $r->send();
    echo $r->getResponseCode(); # so you know if the request reaches the gateway
    echo "<div cloass='error'>Message sent to : $recipient</div>";
}
cereal 1,524 Nearly a Senior Poster Featured Poster

As you wrote this is not simple. Yours is a requested feature, check this link: http://code.google.com/p/gdata-issues/issues/detail?id=300
If users submit their own YouTube username on your website, you could use the API to check each single user subscriptions:

- http://code.google.com/apis/youtube/2.0/developers_guide_protocol_subscriptions.html#Retrieving_subscriptions

Or you could just make a list of subscribers from this link:

http://www.youtube.com/profile?user=USERNAME&view=subscribers&start=0

where USERNAME is your Channel username. You don't need to be logged. From there you can:

1) parse the page with file_get_contents() or cURL and PHP DOM
2) go through the pages, if you need to retrieve full listing, start=0 is the first page, start=40 the second and so on

First page gives you the newest subscribers. On the top of the page there's a total count of the subscribers. So, once you have an index stored on your database, your script could just read the total number of subscribers, when needed, and check if the first page list is changed.

Or you can parse YouTube Service mail that you receive for each subscription. You will receive subscriber's username.

These are just few raw ideas, maybe someone else will come with better solutions. Bye :)

cereal 1,524 Nearly a Senior Poster Featured Poster

If you need authentication use PEAR Mail:

http://pear.php.net/package/Mail
http://www.php.net/manual/en/function.mail.php#39305 <- example

otherwise use just mail()

cereal 1,524 Nearly a Senior Poster Featured Poster

If you need to change this for all php files in that directory use:

RewriteRule ^(.*)\.html$ $1.php [L]
cereal 1,524 Nearly a Senior Poster Featured Poster

Two questions:
1) can you show the html part?
2) the script is saving the image to the path?

cereal 1,524 Nearly a Senior Poster Featured Poster

$_SERVER not $SERVER maybe is just this?

cereal 1,524 Nearly a Senior Poster Featured Poster

You can use the PHP Document Object Model (DOM), an example:

<?php
    $f = '
    <html>
        <head>
            <title>test</title>
        </head>
        <body>
            <div id="aaa">apples</div>
            <div id="bbb">oranges</div>
        </body>
    </html>
        ';
    $dom = new domDocument;
    $dom->loadHTML($f);
    $dom->preserveWhiteSpace = false;
    
    $t = $dom->getElementsByTagName('div');
    $newElement = $t->item(0)->nodeValue; // 0 to display #aaa, 1 for #bbb
    echo $newElement . "\n";
?>
cereal 1,524 Nearly a Senior Poster Featured Poster

This code should be on modify_data.php not in the first file, because there is no query to do:

$connect=mysql_connect('localhost','root','');
mysql_select_db('bank',$connect);
cereal 1,524 Nearly a Senior Poster Featured Poster

Great! You're welcome and great website :)

cereal 1,524 Nearly a Senior Poster Featured Poster

OK, thank you! But there are some errors you should fix.

If I'm understanding the script, your intention is:

1) to upload an image, save it into a the directory you get from the query $result
2) the destination directory is a sub-directory of /images/
3) the new name ($newname) of the file will be the subcat you get from the first form

But there's no connection between the first form and the second.

When you send the first form you select subcat and cat: you set $_POST and $_POST.
Right after you submit the second form so you can upload the file, with this action PHP will delete $_POST and $_POST that you previously set.
If you want to save them you have to use a session: http://php.net/manual/en/book.session.php
Otherwise you can only echo them to hidden input fields in the second form:

<form name='newad' method='post' enctype='multipart/form-data'  action=''>
    <table>
        <tr><td><input type='file' name='image'></td></tr>
        <tr><td><input name="Submit" type="submit" value="Upload image"></td></tr>
    </table>
    <input type="hidden" name="subcat" value="<?php echo $_POST['subcat']; ?>" />
    <input type="hidden" name="cat" value="<?php echo $_POST['cat']; ?>" />
</form>

About the errors:

You have two different forms on the same page, the first is included through dd.php which it should be a simple php script, not an HTML page with PHP script.

Currently you're going to output a page with two doctypes, two html sections, two head sections and two body sections. This is wrong. You may want to fix this …