Checking And Moving Variables ..
I have a variable called $Ident1 which is a few radio box selections and then I have $Ident2 which is a text box.
What I'd like to do is check to see if $Ident1 is not empty [no selections were made] and move it to $Ident .. but if $Ident1 happens to be empty [data filled in for $Ident2] I'll move $Ident2 to $Ident .. both variables are not int, Does anyone understand this and knows how to go about doing it?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Moving Variables
Is it possible to move a variable from one PHP page to another?
Checking Variables In An Include
could anybody explain the following phenomen : I have this line in my project : include "http://".$domain."/help/".$language."/".$defaultIndex."/".$help.".php"; This construct properly includes the file I need to. And the included file contains the following line : echo $domain; - and on this place comes nothing: obviously, the variable '$domain' is not set for the <help.php>.
Checking For Empty Variables
Can I use empty() to check to see if variables actually have data? Basically I want the script or something to check to see if there is data in the variables. If there is no data, give the user some instructions on writing some data (link to a form or admin panel). If there is data, then continue with writing to the database.
Problems With Error Checking / Control Of POST Variables
I have a small form that on button press submits to a PHP file for further processing into a database. I have to change the script as it allows blank / nothing to be submitted to the database. The intention is that if any of the two form fields are blank (empty) then the page is resent stating that they have to fill in all the fields to post (to a database). If I deliberately leave the fields blank and submit the form, querying the database shows that both fields are zero / null - so nothing was entered in to the database. However, if I use an echo command to see what is going on (before the data is entered into a database) I get the $TheName field with a "1" and the $TheComment field with an unknown entry (it doesn't echo anything to the screen - but it's not empty). The code I've used to test this is: $TheName = $_POST[gbName]; $TheComment = $_POST[gbComment]; if (($TheName = NULL) or ($TheComment = NULL)) { echo 'Quick error check running:<BR>' echo "Name: $TheName<BR>"; echo "Comment: $TheComment"; exit; } This does NOT execute as these fields are not empty. It only runs if I change to: if (($TheName = !NULL) or ($TheComment = !NULL)) Which is pointless as it will always execute with genuine entries. Using the amended code below: if (($TheName = !NULL) or ($TheComment = !NULL)) { echo 'Quick error check running:<BR>' } echo "Name: $TheName<BR>"; echo "Comment: $TheComment"; I get the result that both the echoed lines are displayed as blank (no "1").
Moving Things Around
i need to beabe to... for example ----------------------- item_id item price 1 widget 12.40 ----------------------- i need to move the item and price into a new table. here is the script i use at the moment but it only puts the item in to the item column i need the price in there as well. how do i acheive this? $sql="INSERT INTO order_line (item) SELECT shop.item FROM shop WHERE shop.item='widget'";
Moving Files
If there are files that are taken from the users, what would you call the files if you were copy them to places? $_FILES? For example, if I used PCLZIP to take zips from users, once I extract the files, how could I modify those files? How could I move them around? Uploading files uses is_uploaded_file, $file_array, move_uploaded_file, etc., but what about other processes?
Moving To Another Webpage
Is there a way of jumping to another page from PHP. I've got a form that is submitted, and that data is entered into the database. I want the page to then go back to the original page. Can i do this?
Moving Thumbnail Possible In GD?
Is it possible to move the thumbnails(retrived from database) from right to left? Please give function name or materials relating to it.
Moving A Record
Is there way to move a record from one table to another ... or will i just have to get row put each field data in a variable and then insert to a new row and delete old row?
Moving Server
I wrote the code below to access tables that my Drupal installation created to insert information into a custom php page. Specifically it links pictures to a data type pulled from Druapl and makes them all nice. It was working just dandy before, but then 1and1 hosting decided they wanted to overcharge me and then make my site setup unavailable. I got over that quickly, got a new host, and now on the new host the code below is not working. The table is set up like this: What is happening is that the code pulls up the information from the same picture, and it will not put the correct number of images (as you can see in the picture, 3 images but on the report only 2 show). The image is posts is only for the image with "delta" of 0. Code:
Moving An Image....
i am trying to move an image to a directory and i am having no luck. i am working on this as a separate project to the other one i posted about because i have made a lot of progress as far as layout is concerned and the other project is supposed to be a secret anyway... here are the errors i get Warning: move_uploaded_file(/public_html/a/upload/0) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/me/public_html/a/insert.php on line 16 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php9U9t8g' to '/public_html/a/upload/0' in /home/me/public_html/a/insert.php on line 16 I have tried different permitations of the directory such as /upload/, /a/upload/ and /public_html/a/upload/ but still have no luck. the directories are CHMOD'd to 777 Code:
PHP/MySQL Moving Row Data Help!
I have a table with about 600 rows of data in it. I'm trying to figure out how to move row 600 up to row 300. But I can't seem to figure out how.
Moving, And Incrementing, And Readong.
I'm making a guestbook and right now I'm working on the administration options. Currently what I have makes the nessicary files, chmods them and changes the appearance of the guestbook. But I'm having problems reading the current entries (entrylog.txt) placing then in a new file (archivex.txt) and then incrementing the "archive" number by one and logging that in "count.txt". PHP Code:
Moving From -> To . For Object Operators?
Is there a way to change PHP's source and recompile so that I can use "." instead of "->" for the object operator? Of course, I would also change "." (the concat operator) to "&" or "+" for the concat operator. I think it's as simple as editing "zend_language_scanner.l" from the source, changing "." to "&", and "->" to ".", then recompiling, but I haven't tested this. Has anyone done that before?
Moving Uploaded File
I am trying to make a simple file upload page. It will not move the file properly. It only spits out the error message. Here's the code:
Array Issue Since Moving To 5.2.4 From 4.4.0
I have done queries like this for about 8 years. It may not be the best way but it's what 90% of my websites use... When I upgraded to 5.2.4 I realized it doesn't work. while($session->db->next_record()) { $menu->id = $session->db->f('sub_id'); $menu->name = stripslashes($session->db->f('sub_desc')); $menu->link = $session->db->f('link'); $menus[] = $menu; }Normally I can call this later with a simple statement. For simplicity lets just say for($m=0;$m<count($menus);$m++) { $menu = $menus[$m]; echo "<a href=$menu->link>$menu->name</a><BR>"; } Prior to new server this would list out all menus. Currently it lists (lets say 10 rows) of the last menu line. So instead of "Home,Login,Help" I get "Help,Help,Help" I am not looking for someone to say "Why don't you just query this way" because of the severity of this issue if I update 40+ websites to PHP 5.x. Is it purely 5.2 doing this? Or something else? Maybe I was using some bug all this time in the way Array[]'s are handled now or some kind of variable setting?
Moving Php Website To New Host
My boss bought new hosting, and I'm tasked with moving the php website to the new host. There's a digital drop box, and an email form, both broken now. First off, can anyone give me any "don't forget to" tips on editing a php website for a new host? Most of it's working; all except for the forms. Code:
Moving To New Line When Writing Out A File
What I'm trying to do is insert a new category into a array then write the array out to a file. This works, however, the text file uses carrage returns to seperate the items of the array. For example: cat1 cat2 cat3 What happens when I write the file is: cat1 newCatcat2 cat3 (assuming that newCat is sorted between 1 and 2) What I want is to have the next item in the array pushed to the next line, but I have not been able to do this. here's my code:
Moving To A Host Running Fastcgi PHP
My site is currently running on Linux/Apache with mod php. I have the option to move to a host running Redhat on Zeus servers with php running as fastcgi. Unfortunately I know nothing about fastcgi. Is this a sensible move? Would I have to change anything? I currently use a php template, includes, etc, and mod_rewrite in htaccess.
Moving Files On A Linux Server
I need to find a way of moving files on my linux server using PHP. Because of security the folders I am moving files to require you to be logged in as the super user.
Sessions & Moving From Http->https
it appears that sometimes, when i transfer to a secure page from a nonsecure one, i lose track of my session. for example, when i fill out a long form on a nonsecure page and submit it, that data gets saved in the session so that the form is still complete if i come back to that page. then i click a button to continue on to a secure page to collect some sensitive information, and i fail the logged-in test that is at the top of all my scripts. it's not that the session gets destroyed- i can hit Back and then Refresh and that long form that i filled out is still okay. i'm not really logged out, because i can go back to my personal home page and everything is hunky-dory. maybe it's just a problem with misconfiguration or something (i hope it is). on the chance that somebody else has seen this sort of behavior before, what did you do to remedy the problem? does php keep two different sessions for http and https? fwiw, we're thinking of putting the entire site under secure sockets.
Problem With Moving Uploaded Files
I am having a little trouble uploading files (html form with post) with php... I am trying to copy the file from its temporary upload directory to the destination directory, however, the server threw this msg at me... what does it mean? and how do I circumvent it? $user_file_tmp_name = /tmp/phpTeA9Hs $dest_name = /home/free3/user_product_images/jamesjiao/Alizee18.jpg Warning: copy(): open_basedir restriction in effect. File(/tmp/phpTeA9Hs) is not within the allowed path(s): (/home/free3) in /home/free3/my-page-admin.php on line 91 I tried both the copy() function and the move_uploaded_file() function and got the same warning.
Moving A Query Result Into An Array
I have read all the array stuff done searches for examples, but am still not clear if there is a way to do a query from a MySQL table and move those vaules into an arry. I am sure it can be done, but I thought I would find a function that would do it. Am I just overlooking something? $resultID = mysql_query("SELECT DISTINCT slot FROM items"); while(list ($slot) = mysql_fetch_row($resultID)){echo"$slot";} So anyone have a good way to move the result into some array?
Moving Mails Using Imap Functions
i have 2 little questions about this issue: 1. how can i make sure that if i sent a mail that it goes into my sent folder using imapfunctions. 2. how can i move a mail from one folder to another using imapfunctions
Moving Data From A Javascript Form For Use In PHP GD
I'm building a browser app basically I've got a table full of data points (the number can vary anywhere from 5 points to 100+) then I've got a javascript function that analyzes that data and compiles an equation that can be used to create a quadratic regression plot. That's not really important though, just understand that I've got a lot of data of a dynamic quantity. I've started creating another file using PHP GD that I intend to use to create a graph of this data. Both sides of this application work great, the form page can run the calculation populate new fields and even save/recall data from the database. The GD graphing portion graphs the data properly when it's manually set. The problem is I don't know the best method to get the data from the javascript form into the php file that generates the graph. I can think of a few possible methods but I none of them strike me as particularly efficient or best practice especially when you consider the amount of data I'm trying to grab and that the amount varies. The key here is that the data is not coming from a database, the graph is to be used as a feedback tool so the user tweaks the data, checks the graph tweaks the data, check the graph etc. until they like what they see and then they save it to the database once they're done.
PHP, MySQL And Cron - Moving Data Between Tables
Please can someone tell me how to make a system, I would add data into one table, and every 24 hours I would like the oldest 3 entries to be moved to the other table. I would like this to be securely coded as well.
PHP / MySQL -- Moving Rows Between Tables And Dealing With The Primary Key
Let me start by saying that I'm still very new at PHP/MySql and will take any advice. :-) The issues is that every once in a while users get an error when they use this code. I believe the issue is that I'm copying the primary key as well as the other data in the row. So, my thoughts on fixing this are to just select everything but the 'pkey' column, but I'm not sure what would result from that. Would MySql use the next auto incremented primary key for the 'pkey' column when the data is moved into the table, or would it just leave it blank? Also, is their a better strategy for moving data from one table to another than the one I have taken? ///////////////my variables////////////// $newtablename == name of the target table $tablename == name of the current table $pkey == the table's primary key (big int, auto incrementing) //////////////The Code//////////////////// mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error()); mysql_select_db(DB_NAME) or die(mysql_error()); /////////////My move Queries////////////// $sql1 = "insert into $newtablename select * from $tablename where pkey = $pkey"; $sql2 = "DELETE FROM $tablename WHERE pkey = $pkey"; $result1 = mysql_query($sql1) or die(mysql_error()); $result2 = mysql_query($sql2) or die(mysql_error());
Finding Matches In A Table And Then Moving That Match To Another Table?
Ok, I have a database that has a table called critiera in this table is to fields on is ID and the other is critiera. Now I want to filter out all the one that don't apple to the list and move the one that match to a different database. I know how to open a connection, close, select but I don't know how I would inside of a database use another one as the way to create the list of critieras....
File Re-writing And Moving The File Pointer
i have a text file that looks like this: <bt>600</bt> <iregno>123123</iregno> <users> <un>2</un> <u1> <n>Username</n> <ema>username@domain.com<ema> <s>password</s> <t>user type</t> <p>profile name</p> <cat>000000000000000000000000000000000</cat> </u1> and so on </users> Now i run this big user edit function where im reading in their details and displaying them in forms and so on. They then edit the form fields and i read them back in using $POST. That's the easy part. What i then want to do is re-write a section of my text file. I have a variable that tells me what user i need to re-write the details for, i also have all the new details that i need to replace the old ones with. So, in logical terms, what i need to do is move my file pointer to that section of the file: read in $userToEdit variable -> output of variable is <u1> -> move file pointer to next line (<n>username</n>) and let me rewrite the next 6 lines therefore leaving the pointer at </u1> I hope that makes sense. Just basically want to rewrite the text that is there, not append/add.
Same Named Variables.. Or Addressing Variables In A Loop
I'm just starting to program in PHP.. fairly new to programming in general... and I've run across a (probably simple) programming problem I hope someone can help me with. I'm sending variable names through an HTTP get that are generated through a foreach loop. The names are along the lines of name1=, begin1=, end1=, name2=, begin2=, end2=.. etc. The number is the number of the current cycle through the loop. My problem is addressing the variables on the next page... namely how do I evaluate those variables in a loop? I want the value of name1.. but obviously for (i=1; i<3; i++) { echo "$name$i"; }; is not working. Is there an easy way to do this?
URL Checking?
how do you check if a browser came from a specific URL??
Checking For XSS ?
Does the check below ensure that the files are originating from my server, i.e. to prevent or detect any type of XSS ? Or is the HTTP_HOST easily spoofed ? function test ($refer) { if (!stristr($refer, $_SERVER["HTTP_HOST"])) { die(); } else { } } test ($_SERVER["HTTP_HOST"]);
IP Checking
I have to do this for security measures on a script I am doing: To ensure the authenticity of the HTTP requests you should only accept requests from the following IP addresses: 80.87.132.0/26 (ie .0 -> .63) is there a simple way to do a range of IPs ie IF $ipaddress == 80.87.132.* If not does anyone have a good function for this?
Checking %'s
Is there a built in function to check if a value is a certain % of a different value? Like: If($Value < 10% $value2) sort of thing ? Or do i have to work out the 10% first then check against that?
IP Checking
I have a rating system, and its supposed to let people vote only once but right now I can vote 50 times in a row if I want, and I dont know why its letting me vote multiple times, here is my code:
Spell Checking
How can i spell check without including the aspell or pspell libraries ( can't include them because i'm on a virtual host ). I don't mind if its an external service. Spellchecker.net was great, expect now you have to pay for it.
Checking Input Of An Url Or Ip?
i do use the following code: Code: if ($siteurl == "") { $badreg = true; $valid_url = false; echo "<span class='main'><font color='#C10000'><b>Error:</b></font> Please check your url.<br> "; } else { $valid_url = true; $siteurl = ereg_replace("http://", "", $siteurl); list($domain, $file) = explode("/", $siteurl, 2); $siteurl = "http://" . $domain . "/" . $file; } Any idea how i could extend the " if ($siteurl == "") { " for checking for valid domain names and ip-addresses?
Checking Mail
Is there any easy and quick way to check if a user got any/new mail with PHP? assuming that the user's mailbox is on the same system and the system is UNIX (Linux,BSD, etc.)
Checking If A Url Works
ok i need to check a url to make sure it works, and if it does, then i want to print out "online", and if it returns 404 then i want to print out "offline". how do i check if the url works or not?
Checking Paramters In The Url Bar
<?php if ((!isset($s)) && (!isset($msg))) { echo("<table> .... I want some pictures displayed on the main page if its a new visit, but when they search and the url bar changes its skips displaying them, to save scrolling down all the time. I tried the above to read the parameters but get an error when they are not set. Is there something simple like this : if (url has no parameters) { echo("...draw front page section")
PHP And CGI Checking Of The Code
im trying to write a php app for my forums so when a user posts a message that has some programming code in it they can click on a link i plan on setting up that has a text box for them to paste the code into and hit a button (well call it submit) after they hit the button then the code is read and the syntax of this code is colorized much like Crimson editor does for its differant sytanx. programming the checking of the code isnt my problem im having trouble figureing out a way to make it so when they inpute it it gets sent to a php program to be checked and then sent back with the proper color tages..so if they were to enter in the text box: <?php // blah blah blah then soem more crap here ?> they then hit submit the program checks it and sees the syntax for php so it coloriz's it as php syntax and sends back the text liek this <?php // blah blah blah then some more crap here ?> Quote: and the code would looke liek this the [] are () so it doesnt show colors in this part but the code will be with the [] <?(color=blue)php(/color) (color=green)// blah blah blah(/color) then some more crap here ?> and then when they copy and paste it into the forum its then colorized as php syntax, any ideas or a tutorial on how to get a CGI script to call a php file to runs checks would be great.
|