premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
Use a join and OR statements. SELECT * FROM table1 tb1, table2 tb2 WHERE tb1.tblid = tb2.tblid AND (tbl1.search like '%search%' OR tbl2.search like '%search%'); As long as tb1 and tb2 are identified by unique ids, if not do 2 seperate queries.
-
[SOLVED] PHP working in 4.4.8 but not 5.2.5
premiso replied to jsciarrino's topic in PHP Coding Help
Umm did you read my reply? Register_globals is a security risk. In PHP5 it is defaulted to off. What register_globals would do is take global variables, such as $_GET and $_POST and convert the arrays to actual variables. So $_GET['bio'] was the same as $bio. But this could cause major issues. So because of that they decided to make the user define the variable to prevent a security breach, thus you now have to set variables, which is the way it should be or access them manually via the array of $_GET/$_POST. Read up on register_globals if you want more explanation, as I stated in the past 2 posts. -
http://www.google.com/search?hl=en&q=create+a+php+search+engine&btnG=Google+Search http://www.developer.com/db/article.php/3671021 A site like the above?
-
OOP and sessions or mysql You probably need at least 3 classes in OOP. ShoppingCart Orders OrderItems As far as sessions/MySQL goes it depends on your preference.
-
[SOLVED] PHP working in 4.4.8 but not 5.2.5
premiso replied to jsciarrino's topic in PHP Coding Help
What is not working is the part where the MyArrays should display, they display nothing. Bio is defined in the links to this page, ie, <a href=attorney_bio.php?bio=Attorney1> So you need to access it with $_GET, since register_globals is off. Also check the if statement, it should be == "Attorney1" ?php $bio = isset($_GET['bio'])?$_GET['bio']:null; if ( $bio == "Attorney1" ) { $MyArray = array( "Attorney 1", "email: <a href=\"mailto:attorney1@attorney.com\">attorney1@attorney.com</a>","Attorney 1 description, hooray."); } else if ( $bio == "Attorney2" ) { $MyArray = array( "Attorney 2", "email: <a href=\"mailto:attorney2@attorney.com\">attorney2@attorney.com</a>","Attorney 2 description, hooray."); } ?> <h2 id="title"><?php echo $MyArray[0];?></h2> <p class="cinfo"><?php echo $MyArray[1];?></p> <p class="cinfo"> phone: 1234567<br> fax: 1234567 </p> <p><?php echo $MyArray[2];?> </p> <?php include("footer.php"); ?> Give that a try and see if it works. I would read up on register_globals so you can fix the rest of the code that assumes it is on. -
[SOLVED] PHP working in 4.4.8 but not 5.2.5
premiso replied to jsciarrino's topic in PHP Coding Help
Short tags could be disabled (if that is possible) <?php if ( $bio == "attorney 1 name" ) { $MyArray = array( "Attorney 1", "email: <a href=\"mailto:attorney1@attorney.com\">attorney1@attorney.com</a>","Attorney 1 description, hooray."); } else if ( $bio == "attorney 2 name" ) { $MyArray = array( "Attorney 2", "email: <a href=\"mailto:attorney2@attorney.com\">attorney2@attorney.com</a>","Attorney 2 description, hooray."); } ?> <h2 id="title"><?php echo $MyArray[0];?></h2> <p class="cinfo"><?php echo $MyArray[1];?></p> <p class="cinfo"> phone: 1234567<br> fax: 1234567 </p> <p><?php echo $MyArray[2];?> </p> <?php include("footer.php"); ?> Also where is BIO set? If it is from GET or POST you need to access with $_GET, $_POST. Since PHP 5 has register_globals turned off by default for security reasons. Edit: Fixed assuming $bio is coming from a form <?php $bio = isset($_REQUEST['bio'])?$_REQUEST['bio']:null; if ( $bio == "attorney 1 name" ) { $MyArray = array( "Attorney 1", "email: <a href=\"mailto:attorney1@attorney.com\">attorney1@attorney.com</a>","Attorney 1 description, hooray."); } else if ( $bio == "attorney 2 name" ) { $MyArray = array( "Attorney 2", "email: <a href=\"mailto:attorney2@attorney.com\">attorney2@attorney.com</a>","Attorney 2 description, hooray."); } ?> <h2 id="title"><?php echo $MyArray[0];?></h2> <p class="cinfo"><?php echo $MyArray[1];?></p> <p class="cinfo"> phone: 1234567<br> fax: 1234567 </p> <p><?php echo $MyArray[2];?> </p> <?php include("footer.php"); ?> -
[ code ] is your friend. <?php session_start(); if (isset($_SESSION['username'])) $user = $_SESSION['username']; else $user = ""; print ($user); ?> Should work. You do not need the extras of session_id and session_is_registered, the above does that for you.
-
Ok, here is a question. Why not assign menuHtml in the page that includes the smarty? Another question...why not have a language variable which would include the right menu? Another question...why not use the {include} and include a menu.php file where the language is set in session so it includes the correct menu?
-
Php Mailing Script with FAKE time ? Please help
premiso replied to kettavan's topic in PHP Coding Help
Change the system's time that your php server is setup on. That is the only I can think of to do it. You could do this temporarily with Linux, by using the exec function and just reset it back after the email was sent... -
how to make thumbnail for youtube and any other video site using php
premiso replied to dustro's topic in PHP Coding Help
Google my friend. http://www.google.com/search?hl=en&q=php+make+thumbnail+of+uploaded+video&btnG=Google+Search First result: http://nettuts.com/videos/screencasts/how-to-dynamically-create-thumbnails/ -
sort($cats); foreach($cats as $cat){ $cat_strip = trim(preg_replace('/[^a-zA-Z]/', ' ', $cat)); echo '<a href="http://burningviolet.com/layouts/'.$site_url.'index.php?id='.$cat.'&page=1" title="'.$cat.' MySpace Layouts">'.ucfirst($cat_strip).' Layouts</a>'."\n";} sort
-
Yep, there are alot of ways. MySQL db is probably the most common and secureist. You could even have a text file of username:password / linktoredirect and just put each new user on a different and hash the password. This is the unsafeway as anyone could potentially read the file unless it is put in the right spot. You could even just hardcode the username/passwords on the php page in a multi-dimm array like this: $usersPass = array(array("username" => "jack", "password" => "md5hash of password", "redirect" => "urltoredirecto"), array("username" => "john", "password" => "md5hash of password", "redirect" => "urltoredirecto")); foreach ($usersPass as $userArr) { if ($userArr['username'] == $_POST['username'] && $userArr['password'] == md5($_POST['password'])) header("location: " . $userArr['redirect']); } It just depends on how secure you want it. My preference, MySQL.
-
No, due to the simple fact that a CD is not re-writeable and is very slow. If you want a modible database use a JumpDrive to store it.
-
Does the site timeout alot? I do not think the timeout happens a ton, and if it does they just have to go in through ftp and remove the bad .htaccess. Which in essentially means I do not think there is a fail safe way. You could however create the file as a temp file such as htaccess.temp, then if it wrote correctly do a rename from htaccess.temp to .htaccess
-
Does billing data change for each user? If so I think it would be stored in billing_table. And if it changes for each user, add a pt_id to the billing table so you know which patient that particular data belongs to. If you want to keep an audit/not delete billing data when it changes, simply add an active field and set the new billing data to active for that user and the rest to inactive (active = 0). Let me know if that helped or not.
-
Use code tags next time please. <option value="<?php echo $row['school']; ?>" selected><?php echo $row['school']; ?></option> <?php while($school_row = mysql_fetch_array($school_results)) { if($row['school'] != $school_row['school']) { ?> <option value="<?php echo $school_row['school']; ?>"><?php echo $school_row['school']; ?></option> <?php } } ?>
-
What exactly is the problem/where abouts could the problem be?
-
<?php $query = "SELECT u.username, w.request FROM Work w LEFT JOIN Users u ON w.User_id = u.Id ORDER BY u.username"; $result = mysql_query($query) while($row = mysql_fetch_assoc($result)) { if ($row['username'] != $lastUsername) { echo $row['username'] . " has<br />"; } $lastUsername = $row['username']; echo "a Request of " . $row['request'] . "<br />"; } ?> Should display it so that if you grabbed multiple usernames, it would show it for each username.
-
You could link java.textfile as long as it prints out actual javascript. You are telling the tag <script that the file should be type text/javascript, or you should I guess: echo "<script type='text/javascript' src='js.php'></script>"; Although it is not needed, best practice. The above is common practice cause sometimes you want to dynamically create a javascript with custom data etc from your script, so the above would allow you to use php to gather data then print out javascript and have it work all hunky dory. Where as the .js does not allow for this functionality, that means the file will not change unless you manually change it. EDIT: I just read the original post more closely, sorry you were asking if you can run the javascript inside of an image file, I do not think this is possible due to the fact the image is a binary type and adding txt to it will kill it/make it not display. So the short answer would be no.
-
lol that reminds me of Mr. Deeds. Good movie.
-
That is doing the exact thing you were trying to do, it is sending GET variables, using the ? & etc sends the get variables in a regular url. So if that does not work, maybe your new server as register_globals off and you were accessing the variables not using $_GET? That is the only explanation I can give. The above works fine with this script: index.php <?php include('page.php?id=3&user=jack'); ?> page.php <?php echo $_GET['id'] . ' is ' . $_GET['user'] . '\'s user id!'; ?> Should print out 4 is jack's user id! when index.php is called.
-
I should have some time in a little while I will work on my regex and get it goin for ya.
-
<?php $_GET['curpg'] = "Home"; if($logged==true) { $_GET['lgdusr'] = true; } include_once("./includes/Navigation.php"); ?> Will work. If it worked on your other server, they must of allowed it or had a function to parse out the get variables. I have never seen that work for server-side files in my time.