Clarkeez 0 Light Poster

Hello

I'm not sure how this is possible but I want to enter a wildcard(?) into a php variable..

like this,

<?php
  if($_SERVER['HTTP_HOST'] == '*.domain.com') {
    //do something
  }
?>

Notice the *
I basically need it to match if its any subdomain of domain.com

Possible?

Clarkeez 0 Light Poster

Hi, I'm in the process of making a forum system for my clan website.

I'm currently making a function that convert bbcode tags to html tags ready for echoing in the div. Additionally, it will check all the images posted in forum post to see if they are over a certain width, and if they are, to apply a 'width=xxx' attribute to the img tag.

Here is the working function I have.

function bbcode($input) {

		// changes all below bbcode to their repsective html partners as html is blocked in the web forms
		$start_arr = array('[b]', '[/b]', '[u]', '[/u]', '[i]', '[/i]', '[img]', '[/img]', '[center]', '[/center]');
		$finish_arr = array('<b>', '</b>', '<u>', '</u>', '<i>', '</i>', '<img src="', '"/>', '<center>', '</center>');
		$replaced = str_replace($start_arr, $finish_arr, $input);
		
		// does the input have a URL within image tags?
		$matchcount = preg_match('!<img (?:.*?)src=([\'"])(http://[^ ]+)\\1(/){0,1}>!i', $replaced, $matches);
		if($matchcount >= 1) { // yes
			$urlWithtags = $matches[2]; $urlWithtags = str_replace('<img src="', '', $urlWithtags); // strip off <img src="
			$urlNotags = str_replace('"/>', '', $urlWithtags); // strip off "/>   we now have the raw URL of image
						
			$imgsize = getimagesize($urlNotags); // Check if image is too wide
			if($imgsize[0] > 777) { // too wide
			
				$doneString = str_replace($urlNotags, ''.$urlNotags.'" width="777', $replaced);
				return $doneString; // send back the new imgtag
				
			} else { // not too wide, dont add size limit
			
				$doneString = str_replace($urlNotags, '<img src="'.$urlNotags.'"/>', $replaced);
				return $doneString; // send back the new imgtag
				
			}
			
		} else { // no
			return $replaced; // send back original string, no …
Clarkeez 0 Light Poster

Hey..
I have a problem with my CSS, let me show you..

CSS

.wrap { font-size:12px; width:980px; margin:auto; }
.left_wrapper { height:auto; float:left; width:20%; background:#699; }
.right_wrapper { height:auto; float:right; width:79.7%; border-color:#b7b6b6; border-top-width:0px; background:#993; }

HTML

<div class="wrap">
  <div class="left_wrapper">
    blah blah
  </div>
  <div class="right_wrapper">
    blah blah
  </div>
</div>

Now, works all fine and this is the output i want
[img]http://i1104.photobucket.com/albums/h333/Clarkey4/903cf051.png[/img]

But, if I add ANY padding to left_wrapper in the css, this happens..
[img]http://i1104.photobucket.com/albums/h333/Clarkey4/2eb02c27.png[/img]

any guidance will be appreciated :)

Clarkeez 0 Light Poster

Your an actual ledgend!
Thanks dude!

Clarkeez 0 Light Poster

Basically. I have this query that is executed on a form submit.

$add_proc = mysql_query(" INSERT INTO `proc` (active, title, desc, notes, link, tags1, tags2, tags3)
VALUES ( '".$_POST['add_proc_active']."',  '".$_POST['add_proc_title']."', '".$_POST['add_proc_desc']."', '".$_POST['add_proc_notes']."', '".$_POST['add_proc_link']."', '".$_POST['add_proc_tag1']."', '".$_POST['add_proc_tag2']."', '".$_POST['add_proc_tag3']."' )

Now.
The form doesn't require you to enter all 3 tags.
However, if someone doesn't fill in 1 or more of the tags fields, it need to set that value to NULL in the database.

Something to the effect of

VALUES ( if(isset($_POST['add_proc_tag1)) { '".$_POST['add_proc_tag1']."' } else { tags1=null } )

But obviously you can't put PHP in an SQL query.

Any ideas? :)

Clarkeez 0 Light Poster

Thanks for the reply but I still dont see how to do it. That link looks way to complicated to take a few numberS?

Clarkeez 0 Light Poster

Hey.

I need to copy the last 2 sets of numbers from this url
https://www.molten-wow.com/?display=info

so I can put each one into a php variable

Can this be done?

Thanks

Clarkeez 0 Light Poster

Hey.
I'd like someone to point me in the right direction.
Basically, my work website shows data from a MySQL db.
If a new line of data is added in the DB, the user has no way of knowing that it has gone in until they have refreshed. Now, its not often they refresh it.

I need a way of making the bar in the taskbar to flash (like msn convo's) or ANY other way of notifying when a new line of data is added.

There has to be a way?
Can anyone help/?

Clarkeez 0 Light Poster

Hey.
I'd like someone to point me in the right direction.
Basically, my work website shows data from a MySQL db.
If a new line of data is added in the DB, the user has no way of knowing that it has gone in until they have refreshed. Now, its not often they refresh it.

I need a way of making the bar in the taskbar to flash (like msn convo's) or ANY other way of notifying when a new line of data is added.

There has to be a way.

Can anyone help/?

Clarkeez 0 Light Poster
date(m-Y);
Clarkeez 0 Light Poster

This..

INSERT INTO `cats` (title, type, cat_parent, cat_descr) VALUES ('Category Name', '0', '0', 'Category Description')

OR, full example..

$sql = mysql_query("INSERT INTO `cats` (title, type, cat_parent, cat_descr) VALUES ('Category Name', '0', '0', 'Category Description')");
Clarkeez 0 Light Poster

Ok so I have this code to submit form to php without reloading page.
It works perfectly, and makes sense.

form.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html>
<head>
    <title>JQuery Form Example</title> 
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
        $("#myform").validate({
            debug: false,
            rules: {
                name: "required",
                email: {
                    required: true,
                    email: true
                }
            },
            messages: {
                name: "Please let us know who you are.",
                email: "A valid email will help us get in touch with you.",
            },
            submitHandler: function(form) {
                // do other stuff for a valid form
                $.post('process.php', $("#myform").serialize(), function(data) {
                    $('#results').html(data);
                });
            }
        });
    });
    </script>
    <style>
    label.error { width: 250px; display: inline; color: red;}
    </style>
</head>
<body>
<form name="myform" id="myform" action="" method="POST">  
<!-- The Name form field -->
    <label for="name" id="name_label">Name</label>  
    <input type="text" name="name" id="name" size="30" value=""/>  
    <br>
<!-- The Email form field -->
    <label for="email" id="email_label">Email</label>  
    <input type="text" name="email" id="email" size="30" value=""/> 
    <br>
<!-- The Submit button -->
    <input type="submit" name="submit" value="Submit"> 
</form>
<!-- We will output the results from process.php here -->
<div id="results"><div>
</body>
</html>

process.php

<?php
    print "Form submitted successfully: <br>Your name is <b>".$_POST['name']."</b> and your email is <b>".$_POST['email']."</b><br>";
?>

Now, is there anyway I can not use teh form validation as I don't really need it. Just need it to submit without page refresh.

Cheers !

Clarkeez 0 Light Poster

Hello

I've looked around and looks as if this can be done with Jquery, but the guides and full of so much bullshit its insane.

Anyone done this and have a good way to do this. Most of the other ones have form validation and crap which 1) doesnt relate to what i need and 2) dont apply for my needs.

I just want my form to be submitted without refreshing the page becauses its causing problems for other things running on the website.

I know PHP / HTML but dont know much when it comes to Javascript/JQuery.

Willing to paypal £10 to whoever can help me acheive this task which should be simple in this day in age.

Clarkeez 0 Light Poster

Problem is nobody wants to have yet ANOTHER logon at work!

Clarkeez 0 Light Poster

I'm building a portal system for my company and need someway of grabbing the windows username of the person logged on accessing the portal.

Setup...
Apache & PHP on Windows.

This is VITAL so any help is MUCH appreciated.

I've tried
echo $_SERVER; - returns IP, not username
echo $_SERVER; - returns nothing
echo $_SERVER; - returns nothing
echo $_ENV; - returns nothing

Clarkeez 0 Light Poster
Clarkeez 0 Light Poster

Ah.
Just spotted a problem.
Every space is turned into a +
So+sentences+look+like+this.

Anyway around this?

Clarkeez 0 Light Poster

It seems that they record where you came from.
So if you was at the facebook homepage and you clicked on an ad or fan page or something it knows where you came from.

99% sure its just used for statistics etc

Clarkeez 0 Light Poster

Just tested it locally. IF freaking works!
YOUR A STAR!
Thank you VERY much!

Clarkeez 0 Light Poster

Thankyou very much Rade.
I will try this first thing tomorrow.

Clarkeez 0 Light Poster

Im not 100% but i think line 23 shouldnt be there

Clarkeez 0 Light Poster

Hi.
I have a PHP script on a form.
It generates a mailto command with lots of variables pulled from the form fields.

The only problem with it is that if someone types &, % or ; in the fields then it will only generate the email up to that character, the rest is missing.

I've done a little researched and im not sure but maybe htmlspecialchars could be a solution?
I'm not 100% what to do, but it is vital I get this right ASAP.
I hope you can help.

<?php
	if(isset($_POST['imtform_submit']) && $_POST['imtform_pass'] == "xxxxxx" && isset($_POST['imtform_upd'])) {
	
	// Get Variables from form
	$imtform_summary = $_POST['imtform_summary'];
	$imtform_ref = $_POST['imtform_ref'];
	$imtform_cate = $_POST['imtform_cate'];
	$imtform_type = $_POST['imtform_type'];
	$imtform_item = $_POST['imtform_item'];
	$imtform_grp = $_POST['imtform_grp'];
	$imtform_pass = $_POST['imtform_pass'];
	$imtform_upd = $_POST['imtform_upd'];
	$imtform_agnt = $_POST['imtform_agnt'];
	
	// Update frontend IMT Shout
		$File = "../matt/inc/imt.txt";
		$fh = fopen($File, 'w') or die("can't open file");
		fwrite($fh, $_POST['imtform_summary']) or die("can't write file");
		fclose($fh);

	// Generate and open email	
	print "<meta http-equiv='refresh' target='_PARENT 'content='0;URL=mailto:<email recepients>&subject=UPDATE: ".$imtform_summary." - ".$imtform_ref."&body=The following Master Ticket has been created to link all calls to:%0A%0A".$imtform_summary."%0A%0ACategory - ".$imtform_cate."%0AType - ".$imtform_type."%0AItem - ".$imtform_item."%0A%0ARemedy Reference - ".$imtform_ref."%0A%0AThis is currently logged with ".$imtform_grp."%0A%0A,<certain team> are aware.%0A%0AThis is an update.%0AUpdate Notes: '/>";
	
?>
<form action="#" method="POST">
	IMT Ticket Summary<br/><input class="form_box" type="text" name="imtform_summary" size="30"/><br />
	Ticket Reference<br/><input class="form_box" type="text" name="imtform_ref" size="20"/><br />
	Ticket Category<br/><input class="form_box" type="text" name="imtform_cate" size="30"/><br />
	Ticket Type<br/><input class="form_box" type="text" name="imtform_type" size="30"/><br />
	Ticket Item<br/><input class="form_box" type="text" name="imtform_item" size="30"/><br />
	Ticket Group<br/><input …
Clarkeez 0 Light Poster

Hi.
Im making a web based automatic email generator using php and a form.
I've got all it working, apart from the email addresses.

Its for works intranet and they use outlook 2003 on exchange.

basically..
I have this

echo "<meta http-equiv=\"refresh\" target=\"_NEW\" content=\"0;URL=mailto:smith, james;beckham, david; minouge, danni; cole, cheryl;?subject=blah blah>"

Outlook uses ';' to separate names in the 'To' part of the email.
Problem with this is that PHP uses ';' to end the statement, so it only puts in 'smith, james' in the TO box.

I've tried using.

mailto:smith, james\;beckham, david\;

But that doesn't work at all. Just ends up blank.
I need a way to keep the ';' after the names so outlook reads it properly but to obv have the whole thing execute properly.

Hope it wasn't too confusing, thanks

Clarkeez 0 Light Poster

Hello world.

Im having problems with my companys intranet and can't work it out.

Basically, I've got a html form text field, which I want to be able to search.
I don't want to make a search engine, its already there, I just need the query typed in the field, to redirect to a search engine.
Lets use google as an example.

They have http://www.google.co.uk/search?q=hello+world if someone searched 'hello world'.

Now, on my site, if someone typed 'damn thing work' in the form field and pressed submit, i want it to take them to http://www.google.co.uk/search?q=damn+thing+work

It would need to load into the parent window or a new window.

I've tried using if(isset with header locations etc, doing my head it.
Calling for help!

Regards

Clarkeez 0 Light Poster

OkThanks it works!
1 more thing to get this to my needs.
How can I make it into a variable so i can use it on another page.

I tried this..

while( $row_hardware=mysql_fetch_assoc($pull_floats_hardware) )
			{
			  $row_hardware2 = '' . $row_hardware['name'] . '<br/>';
			}

Then

echo $row_hardware2;

on another page but it only shows 1 row

Clarkeez 0 Light Poster

Hey
Im getting there with PHP but one thing that does my head in is arrays.
Im trying to get all the content from the db and echo it..

For exmaple, in the db it reads under the 'names' column...
matt
harry
dave
katie
trisha
paul
tracy
brian
martin
sam

I want to be able to echo this on a page, each on a new line.

But, if a new name is added to the database, i want it to automatically display the new one etc

Probably really easy for you lot ;) and maybe ive over complicated the explanation.

Hope you guys can do it.
Also, there is £5 in it via paypal for whoever comes up with a working script.